Skip to main content

Crate asdf_yaml

Crate asdf_yaml 

Source
Expand description

ASDF-flavoured YAML: document model, parser and emitter.

ASDF stores its tree as a YAML 1.1 document with three requirements that general-purpose Rust YAML crates do not currently meet together:

  • Tags are the type system. !core/ndarray-1.1.0 is what makes a mapping an array, so tags must survive parsing and be re-emitted.
  • Anchors and aliases are load-bearing. Files in the standard’s own reference corpus share nodes through aliases, and a round trip must not silently duplicate or drop them.
  • Scalar style carries meaning. A quoted "123" is a string where an unquoted 123 is an integer.

This crate builds on saphyr-parser’s event stream, which surfaces tags, anchor ids and styles, and adds the document model and emitter on top.

Re-exports§

pub use compare::CompareOptions;
pub use compare::Comparison;
pub use compare::Difference;
pub use compare::compare;
pub use compare::compare_from;
pub use document::Document;
pub use document::YamlVersion;
pub use emit::EmitError;
pub use emit::EmitOptions;
pub use emit::emit;
pub use emit::emit_with;
pub use node::CollectionStyle;
pub use node::Entry;
pub use node::Node;
pub use node::NodeData;
pub use node::NodeId;
pub use node::ScalarStyle;
pub use node::Span;
pub use parse::ParseError;
pub use parse::YamlEvent;
pub use parse::YamlEventKind;
pub use parse::parse_document;
pub use parse::scan_events;
pub use path::Component;
pub use path::Path;
pub use path::PathError;
pub use scalar::Resolved;
pub use scalar::Schema;
pub use scalar::ValueType;
pub use scalar::resolve;
pub use scalar::resolve_tagged;
pub use tag::ASDF_CORE_TAG_PREFIX;
pub use tag::ASDF_STANDARD_TAG_PREFIX;
pub use tag::Tag;
pub use tag::TagHandle;

Modules§

compare
Comparing two documents at the value level.
document
The document: a node arena plus the directives that introduced it.
emit
Emitting a Document back to YAML.
node
Nodes in an ASDF YAML document.
parse
Building a Document from saphyr-parser’s event stream.
path
The YAML Pointer path syntax used to address values in the tree.
scalar
Resolving a scalar’s text into a typed value.
tag
YAML tags, and the ASDF conventions layered on top of them.