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
The decodable implementation created here tries to decode an object with a field named _field0 and of type int, like { "_field0": 5 }
There two problems with this:
Most people won't expect this behavior (I would expect this code to decode a single int, not an object)
The fact that the field name is arbitrary makes this trait impl useless anyway
I think that the deriving implementation of decodable for structs with one anonymous field should be equivalent to decoding the type of the field itself.
Structs with multiple anonymous fields are ambiguous, so I think deriving decodable for them should simply trigger a compilation error.
The text was updated successfully, but these errors were encountered:
For example:
The
decodable
implementation created here tries to decode an object with a field named_field0
and of typeint
, like{ "_field0": 5 }
There two problems with this:
I think that the deriving implementation of
decodable
for structs with one anonymous field should be equivalent to decoding the type of the field itself.Structs with multiple anonymous fields are ambiguous, so I think deriving decodable for them should simply trigger a compilation error.
The text was updated successfully, but these errors were encountered: