Skip to main content

from_reader

Function from_reader 

pub fn from_reader<R, T>(reader: R) -> Result<T, Error>
where R: Read, T: DeserializeOwned + 'static,
Expand description

Deserialize a YAML document from any std::io::Read source.

serde_yaml::from_reader and noyalib’s from_reader have identical signatures, so this is a direct re-export.

§Examples

use noyalib::compat::serde_yaml as syml;
let bytes: &[u8] = b"port: 8080\n";
let m: std::collections::BTreeMap<String, u16> =
    syml::from_reader(bytes).unwrap();
assert_eq!(m["port"], 8080);