You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Supports deserialization of:
[...]
str (This is a zero copy operation.) (*)
[...]
Examples of std serde use dynamic allocation and don't speak about this use case.
I put here a proposition of example that would have helped me. If you put this in your documentation I'm sure it will help other newcomers.
// Importuse serde::{Deserialize};use serde_json_core;// The field is a ref that will point directly in the parsed buffer#[derive(Deserialize)]structMyStruct<'a>{the_str:&'astr,}// Deserialize buffermatch serde_json_core::de::from_slice::<MyStruct>(b"{\"the_str\": \"jsoncore\"}"){Err(_e) => {// Err}Ok(deser) => {// result in deser.0.the_str}}
The text was updated successfully, but these errors were encountered:
I see no issue with adding these kind of examples to the main repository docs, and rust-doc would gladly accept examples. I'd be happy to review a PR for the addition :)
I've added a basic doc to the main repo docs in #91 that should cover this case as well as showing how to use the library. Thanks for bringing this up!
Hello Guys,
This is a great crates !
But as a rust newcomer I was a bit lost face to:
Examples of std serde use dynamic allocation and don't speak about this use case.
I put here a proposition of example that would have helped me. If you put this in your documentation I'm sure it will help other newcomers.
The text was updated successfully, but these errors were encountered: