Open bdbai opened 2 years ago
FYI, this probably isn't possible unless the Deserializer is implemented with a buffer or reads the entire Read
into memory first. https://stackoverflow.com/questions/60801133/how-do-i-use-serde-to-deserialize-structs-with-references-from-a-reader
@sunny-g thanks for pointing that out. But all in all, zero copy could not be achieved without the deserializer supporting it regardless of how I use this library or serde.
I have been looking at the design of https://github.com/3Hren/msgpack-rust for insight into how to approach this in terms of api. Would anyone have a better idea? This is similar to how serde_json does the same thing. I would plan to keep ciborium-io
's support for no_std
, etc.
When I tried deserializing a structure with borrowed strings, an error was returned, stating that an owned string was not expected. It would be great to support zero-copy deserializing.