decode_from_read

Function decode_from_read 

Source
pub fn decode_from_read<T, R>(
    reader: R,
) -> Result<T, ReadError<<T::Decoder as Decoder>::Error>>
where T: Decodable, R: BufRead,
Expand description

Decodes an object from a buffered reader.

§Performance

For unbuffered readers (like std::fs::File or std::net::TcpStream), consider wrapping your reader with std::io::BufReader in order to use this function. This avoids frequent small reads, which can significantly impact performance.

§Errors

Returns ReadError::Decode if the decoder encounters an error while parsing the data, or ReadError::Io if an I/O error occurs while reading.