Available on crate features
parse and yaml only.Expand description
serde YAML integration via the serde_yaml_ng crate
Since serde derives requires linking with serde crate,
you have to add it to your Cargo.toml:
[dependencies]
serde = "1"use cu::pre::*; // with `serde` feature, Serialize and Deserialize are
// part of the prelude
#[derive(Debug, PartialEq, Serialize, Deserialize)]
struct FooBar {
foo: String,
}
// the yaml module will also be part of the prelude
let value: FooBar = yaml::parse(r#"foo: bar"#)?;
assert_eq!(value.foo, "bar");
Structs§
- Map
- A YAML mapping in which the keys and values are both
serde_yaml_ng::Value. - Number
- Represents a YAML number, whether integer or floating point.
- Yaml
- YAML parse delegate. See
yaml
Enums§
- Value
- Represents any valid YAML value.
Functions§
- co_read
coroutine - Parse value from an async reader that yields YAML
- from_
value - Convert a YAML value into T
- parse
- Parse value from a YAML
&str - read
- Parse value from a reader that yields YAML
- stringify
- Convert the value to a YAML string
- to_
value - Convert a T into a YAML value
- write
- Serialize the value into YAML and write into the writer
Type Aliases§
- Vec
- A YAML sequence in which the elements are
serde_yaml_ng::Value.