Crate facet_yaml

Crate facet_yaml 

Source
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§

YamlError
Error type for YAML operations.
YamlParser
Streaming YAML parser backed by saphyr-parser.
YamlSerializeError
Error type for YAML serialization.
YamlSerializer
YAML serializer with streaming output.

Enums§

DeserializeError
Error produced by FormatDeserializer.
YamlErrorKind
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 Peek instance to a YAML string.
peek_to_writer
Serialize a Peek instance to YAML and write it to a std::io::Write writer.
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::Write writer.