4 ms·
one thing that has kinda irked me about serde is that there's relatively limited support for bounding memory usage for types like a Vec<T> at deserialize time w
by jlrubin 5y ago
one thing that has kinda irked me about serde is that there's relatively limited support for bounding memory usage for types like a Vec<T> at deserialize time without a lot of manual work.
It is doable (e.g. see SafePSBT deserializer here https://github.com/sapio-lang/sapio/blob/master/ctv_emulators/src/msgs.rs https://github.com/sapio-lang/sapio/blob/master/ctv_emulator...), just not particularly ergonomic.
- jlrubin 5y agoaddendum: if you're like 'when could you want this?', imagine you are deserializing from a Reader which has an internal circular buffer or something from the network (bounded) and you want to limit a peers total resident memory (or something) on your server. Very difficult to do this with Serde!