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 AThirdThing field causes the error the trait bound `&std::string::String: Deserialize<'_>` is not satisfied despite the fact that it is not being deserialized.
The text was updated successfully, but these errors were encountered:
SetOfAllSets
changed the title
Traits are bound even if deserialization is skipped.
Trait bounds are inforced even if deserialization is skipped.
May 6, 2024
SetOfAllSets
changed the title
Trait bounds are inforced even if deserialization is skipped.
Trait bounds are enforced even if deserialization is skipped.
May 6, 2024
SetOfAllSets
changed the title
Trait bounds are enforced even if deserialization is skipped.
Trait bounds for deserialization are enforced even if deserialization is skipped.
May 6, 2024
In the shared code snippet, you only skip deserialization of the second SomethingElse field, not the third AThirdThing. To achieve that, you need to annotate that field as well (I fixed the Rust code too):
However, that still won't quite work, since &'a String does not implement Default, see https://serde.rs/field-attrs.html#skip_deserializing.
You need to specify a default = "..." as well, to tell the deserialization code how the field value should get created, since it doesn't come from the serialized data.
In the example
the AThirdThing field causes the error
the trait bound `&std::string::String: Deserialize<'_>` is not satisfied
despite the fact that it is not being deserialized.The text was updated successfully, but these errors were encountered: