-
Notifications
You must be signed in to change notification settings - Fork 63
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
Deserialization doesn't work on hashmap if both generic parameters are constrainted with DeserializeAs types #582
Comments
Seems like duplicate a to #202 . Would be very happy to have this implemented. Least effort solution may be implementing |
The correct attribute is I don't know what your suggested |
Yes, I believe |
Mention that it is supposed to mirror the type structure of the field and what the special `_` placeholder means. This was mentioned as insufficiently explained in #582.
583: Explain better how to use serde_as r=jonasbb a=jonasbb Mention that it is supposed to mirror the type structure of the field and what the special `_` placeholder means. This was mentioned as insufficiently explained in #582. bors r+ Co-authored-by: Jonas Bushart <jonas@bushart.org>
Consider following code:
It fails with cryptic message:
Note the line
<HashMap<KU, VU, S> as DeserializeAs<'de, HashMap<K, V, S>>>
.So if we constraint both hashmap args with Test:
Then it gets compiled as expected. For now I implemented a thin wrapper that is only used to fool this constraint but I think it's overly conservative. Users definitely should be able to deserialize
HashMap<SomeStandardType, SomeWrapperType>
The text was updated successfully, but these errors were encountered: