fix: deserialize from str for serde YAML compatibility #149
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Neither
serde_yaml
norserde_yml
used to be able to deserializejiff
types, due to lack of support for serialization from bytes.Furthermore, an inconsistency between deserialization and serialization was brought forth in #138, where
Serialize
implementations instruct the correspondingSerializer
to collect&str
s, butDeserialize
implementations instruct the correspondingDeserializer
s to provide bytes.All serialized representations making use of no more than the ASCII character set, which makes the switch to deserializing from
&str
trivial.This changeset first adds tests, proving the incompatibility.
Then, it provides a fix by hinting to
Deserializer
s that a&str
is expected to be passed to theVisitor
next.Commits
dab4b87 — test: verify serde YAML compatibility
Deserializing
jiff
types from YAML is not currently possible.Neither
serde_yaml
nor its maintained forkserde_yml
support deserializing from bytes.These tests serve in both
Deserialize
implementations todeserializer.deserialize_str
.Related to #148, #138
d69f375 — fix: deserialize from str for serde YAML compatibility
Deserializing
jiff
types from YAML was previously not possible:Neither
serde_yaml
nor its maintained forkserde_yml
support deserializing from bytes.This changset migrates
Deserialize
implementations todeserializer.deserialize_str
, thus providing serde YAML compatibility.Fixes #138
Related to #148