Skip to main content

parse_stream_with_config

Function parse_stream_with_config 

Source
pub fn parse_stream_with_config(
    input: &str,
    config: &ParserConfig,
) -> Result<Vec<Document>>
Expand description

Parse a YAML stream into one Document per logical document under config, mirroring crate::load_all_with_config.

Boundaries are found exactly as in parse_stream; each document is then parsed as by parse_document_with_config and keeps the configuration for its own re-parses.

§Errors

Same as parse_document_with_config.

§Examples

use noyalib::cst::{parse_stream_with_config, Document};
use noyalib::ParserConfig;

let cfg = ParserConfig::new().alias_anchor_ratio(None);
let src = "---\nfoo: 1\n---\nbar: 2\n";
let docs = parse_stream_with_config(src, &cfg).unwrap();
assert_eq!(docs.len(), 2);
let joined: String = docs.iter().map(Document::source).collect();
assert_eq!(joined, src);