Skip to main content

read_with_config

Function read_with_config 

Source
pub fn read_with_config<R, T>(
    reader: R,
    config: &ParserConfig,
) -> Result<DocumentReadIterator<T>>
where R: Read, T: for<'de> Deserialize<'de> + 'static,
Expand description

read with a custom ParserConfig for tightened security limits.

§Errors

Same as read.

§Examples

use std::io::Cursor;
use noyalib::{read_with_config, ParserConfig, Value};

let cfg = ParserConfig::strict();
let yaml = "a: 1\n---\nb: 2\n";
let count = read_with_config::<_, Value>(Cursor::new(yaml), &cfg)
    .unwrap()
    .count();
assert_eq!(count, 2);