#3091·serde

[Feature request] Custom Deserializer impls and functions let you pop out values from Deserializer

Author: SpiderUnderUrBedCreated Jul 29, 2026Updated Jul 29, 2026

I would like a feature where, without having to go through an entire Visitor pattern or something related, you could take a deserializer, and pass a mutable reference into a function which will let you pop out one value from the Deserializer, you could either pass in a mutable reference or some clone or type you get from the deserializer to make it a tiny bit like some writer or reader where with those you could call .next or some related function to get the next segment, and when your done you could pass a owned deserializer or reference to deserializer to handle the rest of the data.

Example use case, I wanted to play around with a few data formats where I simply wanted to get the first u64 from a deserializer, like XXX{} have that deserializer forget about that value, and either just handle the rest of it normally (calling some <type>::deserialize function, or involve serde_json to handle the rest of the values.

Something like musli provides decode_buffer so kind of like that.

Related: https://users.rust-lang.org/t/serde-when-implementing-deserialize-is-it-possible-to-consume-the-first-value-from-the-deserializer-before-moving-onwards/141533/2