Skip to main content

from_reader_with_config

Function from_reader_with_config 

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

Deserialize YAML from an std::io::Read source with a custom ParserConfig.

§Errors

  • Error::Io — the underlying reader returns an I/O error.
  • All variants documented on from_str_with_config. The reader is read at most one byte past max_document_length, so an oversized or unbounded source fails the length budget without being buffered first.

§Examples

use noyalib::{from_reader_with_config, ParserConfig};
let cfg = ParserConfig::new();
let bytes = b"7".to_vec();
let n: i32 = from_reader_with_config(&bytes[..], &cfg).unwrap();
assert_eq!(n, 7);