Skip to main content

parse_document

Function parse_document 

Source
pub fn parse_document(input: &str) -> Result<Document>
Expand description

Parse a YAML stream into an editable Document.

Runs under the default parser configuration — the same limits as crate::from_str. Use parse_document_with_config to change them.

§Errors

Returns the same parse errors as crate::from_str — the green tree is built off the same scanner, so every strictness fix in the regular parser applies here too.

§Examples

use noyalib::cst::parse_document;

assert_eq!(parse_document("a: 1\n").unwrap().to_string(), "a: 1\n");