Skip to main content

load

Function load 

Source
pub fn load(input: &str) -> Result<Vec<Document<Span>>, LoadError>
Expand description

Load YAML text using lossless mode, default security limits, and Core schema tag resolution (YAML 1.2.2 §10.3).

Returns one Document<Span> per YAML document in the stream. Untagged nodes receive resolved tag URIs according to the Core schema; nodes with explicit source tags are left unchanged.

§Errors

Returns Err if the input contains a parse error or exceeds a security limit (nesting depth or anchor count).

use rlsp_yaml_parser::loader::load;
use rlsp_yaml_parser::Node;

let docs = load("hello\n").unwrap();
assert_eq!(docs.len(), 1);
let Node::Scalar { tag, .. } = &docs[0].root else { panic!() };
assert_eq!(tag.as_deref(), Some("tag:yaml.org,2002:str"));