facet-yaml 0.44.6

YAML serialization for facet using the new format architecture - successor to facet-yaml
Documentation

facet-yaml

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"));