Expand description
YAML parser and serializer using facet-format.
This crate provides YAML support via the FormatParser trait,
using saphyr-parser for streaming event-based parsing.
§Example
use facet::Facet;
use facet_yaml::{from_str, to_string};
#[derive(Facet, Debug, PartialEq)]
struct Config {
name: String,
port: u16,
}
let yaml = "name: myapp\nport: 8080";
let config: Config = from_str(yaml).unwrap();
assert_eq!(config.name, "myapp");
assert_eq!(config.port, 8080);
let output = to_string(&config).unwrap();
assert!(output.contains("name: myapp"));Structs§
- Yaml
Error - Error type for YAML operations.
- Yaml
Parser - Streaming YAML parser backed by
saphyr-parser. - Yaml
Serialize Error - Error type for YAML serialization.
- Yaml
Serializer - YAML serializer with streaming output.
Enums§
- Deserialize
Error - Error produced by
FormatDeserializer. - Yaml
Error Kind - Specific error kinds for YAML operations
Functions§
- from_
slice - Deserialize a value from YAML bytes into an owned type.
- from_
slice_ borrowed - Deserialize a value from YAML bytes, allowing zero-copy borrowing.
- from_
str - Deserialize a value from a YAML string into an owned type.
- from_
str_ borrowed - Deserialize a value from a YAML string, allowing zero-copy borrowing.
- peek_
to_ string - Serialize a
Peekinstance to a YAML string. - peek_
to_ writer - Serialize a
Peekinstance to YAML and write it to astd::io::Writewriter. - to_
string - Serialize a value to a YAML string.
- to_vec
- Serialize a value to YAML bytes.
- to_
writer - Serialize a value to YAML and write it to a
std::io::Writewriter.