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
{{ message }}
This repository has been archived by the owner on Aug 15, 2021. It is now read-only.
use serde_derive::Deserialize;#[derive(Debug,Deserialize)]structPerson{first_name:String,last_name:String,}fnmain(){let data = serde_cbor::to_vec(&("John","Doe")).unwrap();eprintln!("{:?}", data);eprintln!("{:#?}", serde_cbor::from_slice::<Person>(&data));}
The text was updated successfully, but these errors were encountered:
Fine. I don't think this is an issue but rather a feature of serde to help with the deserialization of some data formats that do not distinguish between arrays and maps. And I don't keep issues around for features people find surprising.
(Btw besides the example with structs and sequences it can be rather surpising how serialized data is deserialized in serde. Serde appears to follow Postel's law "be conservative in what you do, be liberal in what you accept from others" to enable working with various different formats. This can it make it difficult to code against a specification which exactly describes what is allowed and what must not be accepted.)
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This issue in Serde affects Serde Cbor.
Example code adapted to Serde Cbor:
The text was updated successfully, but these errors were encountered: