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
Usually, the default attribute is not required on Option fields and if such a field is missing it'll just be set as None. If the with attribute is used, however, the default attribute also needs to be specified or the deserialization will fail if the field is missing.
Usually, the
default
attribute is not required onOption
fields and if such a field is missing it'll just be set asNone
. If thewith
attribute is used, however, thedefault
attribute also needs to be specified or the deserialization will fail if the field is missing.Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=875ca8186b694b73047655afd75895e6
Expanding the code highlights the differences
with
nordefault
attributes: (missing_field
does not error forOption
)with
attribute but nodefault
:with
anddefault
attributes:Just like
with
,deserialize_with
also causes this.serialize_with
seems to not have any effect though.I imagine a simple fix would be to use the same private
missing_field
function rather than<A::Error>::missing_field
.The text was updated successfully, but these errors were encountered: