read_to_vec

Function read_to_vec 

Source
pub unsafe fn read_to_vec<T: FromBytes, E>(
    max_len: usize,
    read_fn: impl FnOnce(&mut [MaybeUninit<T>]) -> Result<NumberOfElementsRead, E>,
) -> Result<Vec<T>, E>
Expand description

Performs a read into a Vec using the provided read function.

The read function returns the number of elements of type T read.

ยงSafety

The read function must only return Ok(n) if at least one element was read and n holds the number of elements of type T read starting from the beginning of the slice.