Crate fast_yaml_core

Crate fast_yaml_core 

Source
Expand description

fast-yaml-core: Core YAML 1.2.2 parser and emitter.

This crate provides the core functionality for parsing and emitting YAML documents, wrapping the saphyr library with a consistent, stable API.

§YAML 1.2.2 Compliance

This library implements the YAML 1.2.2 specification with the Core Schema:

  • Null: ~, null, Null, NULL, or empty value
  • Boolean: true/false (case-insensitive) - NOT yes/no/on/off (YAML 1.1)
  • Integer: Decimal, 0o octal, 0x hexadecimal
  • Float: Standard notation, .inf, -.inf, .nan
  • String: Plain, single-quoted, double-quoted, literal (|), folded (>)

§Examples

Parsing YAML:

use fast_yaml_core::Parser;

let yaml = "name: test\nvalue: 123";
let doc = Parser::parse_str(yaml)?;

Emitting YAML:

use fast_yaml_core::{Emitter, Value, ScalarOwned};

let value = Value::Value(ScalarOwned::String("test".to_string()));
let yaml = Emitter::emit_str(&value)?;

Re-exports§

pub use emitter::Emitter;
pub use emitter::EmitterConfig;
pub use error::EmitError;
pub use error::EmitResult;
pub use error::ParseError;
pub use error::ParseResult;
pub use parser::Parser;
pub use value::Array;

Modules§

emitter
YAML emitter for serializing documents to strings.
error
Error types for parsing and emitting operations.
parser
YAML parser for deserializing strings to documents.
value
Value types representing YAML data structures.

Structs§

OrderedFloat
Re-export OrderedFloat for users working with YAML float values.

Enums§

ScalarOwned
The resolved value of a scalar YAML node, freed from borrowing.
Value
Wrapper around saphyr’s YamlOwned type for consistent API.

Type Aliases§

Map
The type contained in the YamlOwned::Mapping variant.