pub fn parse_skippable_frame(
src: &[u8],
) -> Result<(u8, &[u8]), SkippableSliceError>Expand description
Borrow the magic variant and payload of the skippable frame src starts
with, without copying. Backs the C ZSTD_readSkippableFrame; bytes after
the frame are ignored.
§Errors
SkippableSliceError::Truncated when src ends before the header or the
declared payload does, SkippableSliceError::BadMagicNumber when it does
not start with a skippable-frame magic.
use structured_zstd::skippable::{parse_skippable_frame, write_skippable_frame};
let mut frame = Vec::new();
write_skippable_frame(7, b"metadata", &mut frame).unwrap();
assert_eq!(parse_skippable_frame(&frame).unwrap(), (7, &b"metadata"[..]));