asdf_yaml/lib.rs
1//! ASDF-flavoured YAML: document model, parser and emitter.
2//!
3//! ASDF stores its tree as a YAML 1.1 document with three requirements that
4//! general-purpose Rust YAML crates do not currently meet together:
5//!
6//! - **Tags are the type system.** `!core/ndarray-1.1.0` is what makes a
7//! mapping an array, so tags must survive parsing and be re-emitted.
8//! - **Anchors and aliases are load-bearing.** Files in the standard's own
9//! reference corpus share nodes through aliases, and a round trip must not
10//! silently duplicate or drop them.
11//! - **Scalar style carries meaning.** A quoted `"123"` is a string where an
12//! unquoted `123` is an integer.
13//!
14//! This crate builds on `saphyr-parser`'s event stream, which surfaces tags,
15//! anchor ids and styles, and adds the document model and emitter on top.
16
17#![forbid(unsafe_code)]
18
19// Named so `alloc::` paths can be written directly. The crate links `std`,
20// but spelling collection and string types at the narrowest layer that
21// defines them keeps a future `no_std` build a small step away.
22extern crate alloc;
23
24pub mod compare;
25pub mod document;
26pub mod emit;
27pub mod node;
28pub mod parse;
29pub mod path;
30pub mod scalar;
31pub mod tag;
32
33pub use compare::{CompareOptions, Comparison, Difference, compare, compare_from};
34pub use document::{Document, YamlVersion};
35pub use emit::{EmitError, EmitOptions, emit, emit_with};
36pub use node::{CollectionStyle, Entry, Node, NodeData, NodeId, ScalarStyle, Span};
37pub use parse::{ParseError, YamlEvent, YamlEventKind, parse_document, scan_events};
38pub use path::{Component, Path, PathError};
39pub use scalar::{Resolved, Schema, ValueType, resolve, resolve_tagged};
40pub use tag::{ASDF_CORE_TAG_PREFIX, ASDF_STANDARD_TAG_PREFIX, Tag, TagHandle};