pub fn decode_from_read_with_decoder<D, R>(
reader: R,
) -> Result<D::Output, ReadError<D::Error>>Expand description
Decodes an object from a buffered reader using a Decoder type.
Unlike decode_from_read, this takes a generic Decoder parameter, allowing use with
decoders which don’t have a dedicated Decode implementer (e.g. CompactSizeDecoder).
§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.