Function bt_bencode::from_reader

source ·
pub fn from_reader<R, T>(r: R) -> Result<T>
where R: Read, T: DeserializeOwned,
Expand description

Deserializes an instance of T from the bytes of an io::Read type.

The entire io::Read source is consumed, and it is an error if there is trailing data. If trailing data is expected, then the Deserializer should be constructed directly. See Deserializer::byte_offset() for an example.

§Errors

Deserialization can fail if the data is not valid, if the data cannot cannot be deserialized into an instance of T, if there is trailing data, and other IO errors.