Skip to main content

from_reader

Function from_reader 

Source
pub fn from_reader<T: DeserializeOwned, R: Read>(reader: R) -> Result<T, Error>
Expand description

Deserializes a value from a reader.

The reader is read to the end. Only whitespace may follow the value. The reader does not need to be buffered. To read more than one value (for instance JSON Lines) use DeserializerConfig::reader.

let value: Vec<u32> =
    deser_json5::from_reader(&b"[1, 2, 3]"[..]).unwrap();
assert_eq!(value, [1, 2, 3]);