Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for zero-copy deserializing #36

Open
bdbai opened this issue Dec 27, 2021 · 3 comments
Open

Request for zero-copy deserializing #36

bdbai opened this issue Dec 27, 2021 · 3 comments

Comments

@bdbai
Copy link

bdbai commented Dec 27, 2021

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.

@sunny-g
Copy link

sunny-g commented Aug 29, 2022

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

@bdbai
Copy link
Author

bdbai commented Aug 29, 2022

@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.

@ahmedcharles
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: New
Development

No branches or pull requests

3 participants