decode_from_read_unbuffered_with

Function decode_from_read_unbuffered_with 

Source
pub fn decode_from_read_unbuffered_with<T, R, const BUFFER_SIZE: usize>(
    reader: R,
) -> Result<T, ReadError<<T::Decoder as Decoder>::Error>>
where T: Decodable, R: Read,
Expand description

Decodes an object from an unbuffered reader using a custom-sized buffer.

For most use cases, prefer decode_from_read with a std::io::BufReader. This function is only needed when you have an unbuffered reader which you cannot wrap. It will probably have worse performance.

§Buffer

The BUFFER_SIZE parameter controls the intermediate buffer size used for reading. The buffer is allocated on the stack (not heap) and reused across read operations. Larger buffers reduce the number of system calls, but use more memory.

§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.