Function read_buf

Source
pub fn read_buf<const BUF_SIZE: usize>(
    left_over: &[u8],
    input: &mut impl Read,
) -> Result<Option<Vec<u8>>>
Expand description

Read a buffer of BUF_SIZE (the resulting Vec can be smaller); left_over is copied into the buffer at the start, then the remainder is attempted to be filled from input. Returns None if eof was reached (nothing could be read) and left_over is empty. Panics if left_over.len() >= BUF_SIZE`.