Skip to main content

read_yaml

Function read_yaml 

Source
pub fn read_yaml(text: &str) -> Result<Doc, OmnistError>
Expand description

Parse YAML text into a Doc.

Exactly one YAML document is accepted (matching Python’s yaml.safe_load, which raises on a stream containing more than one ----separated document); an empty/blank input parses as a Null document, also matching yaml.safe_load("") returning None. A bare top-level sequence, a sequence nested directly inside another sequence, or nesting past crate::document::MAX_DEPTH all surface as crate::error::DocumentError (via Doc::of), matching json.rs’s identical read_json behavior.