fast_yaml_core/
lib.rs

1//! fast-yaml-core: Core YAML 1.2.2 parser and emitter.
2//!
3//! This crate provides the core functionality for parsing and emitting YAML documents,
4//! wrapping the saphyr library with a consistent, stable API.
5//!
6//! # YAML 1.2.2 Compliance
7//!
8//! This library implements the YAML 1.2.2 specification with the Core Schema:
9//!
10//! - **Null**: `~`, `null`, `Null`, `NULL`, or empty value
11//! - **Boolean**: `true`/`false` (case-insensitive) - NOT yes/no/on/off (YAML 1.1)
12//! - **Integer**: Decimal, `0o` octal, `0x` hexadecimal
13//! - **Float**: Standard notation, `.inf`, `-.inf`, `.nan`
14//! - **String**: Plain, single-quoted, double-quoted, literal (`|`), folded (`>`)
15//!
16//! # Examples
17//!
18//! Parsing YAML:
19//!
20//! ```
21//! use fast_yaml_core::Parser;
22//!
23//! let yaml = "name: test\nvalue: 123";
24//! let doc = Parser::parse_str(yaml)?;
25//! # Ok::<(), Box<dyn std::error::Error>>(())
26//! ```
27//!
28//! Emitting YAML:
29//!
30//! ```
31//! use fast_yaml_core::{Emitter, Value, ScalarOwned};
32//!
33//! let value = Value::Value(ScalarOwned::String("test".to_string()));
34//! let yaml = Emitter::emit_str(&value)?;
35//! # Ok::<(), Box<dyn std::error::Error>>(())
36//! ```
37
38/// YAML emitter for serializing documents to strings.
39pub mod emitter;
40/// Error types for parsing and emitting operations.
41pub mod error;
42/// YAML parser for deserializing strings to documents.
43pub mod parser;
44/// Value types representing YAML data structures.
45pub mod value;
46
47pub use emitter::{Emitter, EmitterConfig};
48pub use error::{EmitError, EmitResult, ParseError, ParseResult};
49pub use parser::Parser;
50pub use value::{Array, Map, OrderedFloat, ScalarOwned, Value};