Skip to main content

parse_preamble

Function parse_preamble 

Source
pub fn parse_preamble(
    input: &[u8],
    max_header_bytes: u64,
) -> Result<(Preamble, usize), PreambleError>
Expand description

Parses a preamble from the front of input.

Returns the preamble and how many bytes it occupied. max_header_bytes is the local limit; a larger advertised length is rejected here, which is the only place where that check can happen before memory is committed.