Skip to main content

read_bounded_len

Function read_bounded_len 

Source
pub fn read_bounded_len<R>(
    source: &mut R,
    label: &str,
    min_element_size: usize,
) -> Result<usize, DeserializationError>
where R: ByteReader,
Expand description

Reads and validates a serialized length before it is used for allocation.

label names the collection being read and is only used to build the error message. min_element_size is the minimum number of bytes one element occupies once serialized.

ยงErrors

Returns an error if the length cannot be read, or if it fails the checks described in validate_bounded_len.