-
Notifications
You must be signed in to change notification settings - Fork 99
What if I don't want the packed serialization? #112
Comments
Your assessment is unfortunately correct. In the next version I want to change the default serialization of enums anyway (#85) so I might as well make de-serialization more restrictive. |
@dtolnay Serde deserializes maps with numbered keys like |
From my understanding, this is only code generated in the serde_derive deserializer. You may remove that behavior by manually implementing the Deserializer. I also have another use-case where by spec the format is packed, with custom indexes: I'd be interested to get support for that in serde_derive, that would save a ton of repetitive code. |
One way would be that if the Deserializer is called with deserialize_struct then use an implementation of MapAccess whose next_key only allows string keys. In serde_json we do the same thing. The relevant code is https://github.com/serde-rs/json/blob/v1.0.39/src/de.rs#L1763-L1768 |
this issue is fixed in master and should be closed |
I'm trying to avoid having a format that inadvertently works. While avoiding serialization is a matter of just not calling the
_packed
functions, deserialization seems to implicitly always use it.E.g., coding against a spec, I do not want other, incorrect (according to the spec, which might be agnostic to Rust/
serde_cbor
) to successfully deserialize, lest someone thinks that format is supported.The text was updated successfully, but these errors were encountered: