Skip to main content

frame_header_size_in_format

Function frame_header_size_in_format 

Source
pub fn frame_header_size_in_format(
    src: &[u8],
    magicless: bool,
) -> Result<usize, ReadFrameHeaderError>
Expand description

frame_header_size for a frame in either format: with magicless the header starts at its descriptor byte and its length counts no magic number.

use structured_zstd::decoding::frame_header_size_in_format;
// A descriptor announcing a window byte only.
assert_eq!(frame_header_size_in_format(&[0x00], true).unwrap(), 2);
assert_eq!(frame_header_size_in_format(&[0x28, 0xB5, 0x2F, 0xFD, 0x00], false).unwrap(), 6);

§Errors

As frame_header_size; a magicless input fails only when it is empty.