yaml_rt/lib.rs
1//! YAML 1.2.2 parsing, source-preserving editing, typed overlays, and optional
2//! Serde conversion.
3//!
4//! `YamlDoc` keeps the original source as its source of truth. Unedited YAML is
5//! returned byte-for-byte, while editor operations queue localized patches.
6//!
7//! ```
8//! use yaml_rt::{YamlDoc, YamlError};
9//!
10//! # fn main() -> Result<(), YamlError> {
11//! let mut doc = YamlDoc::parse("port: 8080 # selected port\n")?;
12//! doc.set_scalar(&["port"], "9090")?;
13//! assert_eq!(doc.to_string(), "port: 9090 # selected port\n");
14//! # Ok(())
15//! # }
16//! ```
17//!
18//! The default `derive` feature re-exports [`YamlRoundTrip`] for named mapping
19//! structs, transparent newtypes, and locally tagged enums. The optional
20//! `serde` feature re-exports serialization and deserialization APIs for
21//! conversions where presentation preservation is not required.
22
23pub use yaml_rt_core::*;
24
25#[cfg(feature = "derive")]
26pub use yaml_rt_derive::YamlRoundTrip;
27
28#[cfg(feature = "serde")]
29pub use yaml_rt_serde::{
30 Deserializer, Error, Location, Result, Serializer, from_reader, from_slice, from_str,
31 to_string, to_writer,
32};