This repository has been archived by the owner on Mar 25, 2024. It is now read-only.
Releases: dtolnay/serde-yaml
Releases · dtolnay/serde-yaml
0.6.0
- Update to Serde 0.9. Please see the Serde 0.9 release notes.
The new Serde 0.9 error system gives way more helpful error messages:
- Invalid type. Expected `Str`
+ invalid type: string "abc", expected an integer at line 2 column 7
- Missing field `w`
+ missing field `w` at line 2 column 2
- Invalid length: 2
+ invalid length 2, expected a tuple of size 3 at line 2 column 1
- Unknown field: `w`
+ unknown field `w`, expected one of `x`, `y`, `z` at line 14 column 4
0.6.0-rc1
0.5.1
0.5.0
Breaking changes in 0.5.0
- Real numbers written in YAML are now deserialized through
visit_f64
rather thanvisit_str
; this may affect custom Deserialize implementations that expect to process real numbers as strings (#24, thanks @jwilm) serde_yaml::to_writer
no longer flushes the writer after writing; the caller is responsible for flushing if necessary (#29, thanks @emk)serde_yaml::Value
is no longer the same type asyaml_rust::Yaml
- Order of map keys is preserved where before they were sorted alphanumerically; this means that deserializing from YAML to
serde_yaml::Value
and writing back to YAML will preserve the order of keys in the input, and also serializing a struct to YAML will produce keys in the same order as the fields in the struct
Enhancements
The new serde_yaml::Value
implements the Serde Serialize
and Deserialize
traits, similar to serde_json::Value
. This allows structs to be deserialized containing values of any type (#23, thanks @andrewrynhard).
#[derive(Serialize, Deserialize)]
pub struct GenericInstructions {
#[serde(rename = "type")]
pub typ: String,
pub config: Value,
}
0.4.1
0.4.0
0.4.0-rc1
0.3.0
Unit enum variants are now serialized as strings instead of maps (#16)
Consider the following enum:
enum E { V, W }
A map containing keys "v"
and "w"
and values E::V
and E::W
used to be serialized as:
v:
V: []
w:
W: []
Now it will be serialized as:
v: V
w: W
Deserialization supports both the old and the new format.
This aligns with the corresponding change in serde_json
0.8.0.