#[non_exhaustive]pub enum LegacyVersion {
V05,
V06,
V07,
}Available on crate feature
legacy only.Expand description
One of the pre-1.0 frame formats this crate decodes.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
V05
The v0.5 format, magic number 0xFD2FB525.
V06
The v0.6 format, magic number 0xFD2FB526.
V07
The v0.7 format, magic number 0xFD2FB527.
Implementations§
Source§impl LegacyVersion
impl LegacyVersion
Sourcepub fn of(src: &[u8]) -> Option<LegacyVersion>
pub fn of(src: &[u8]) -> Option<LegacyVersion>
The format whose magic number starts src, if it is one of these.
Sourcepub fn header_size(self, src: &[u8]) -> Option<usize>
pub fn header_size(self, src: &[u8]) -> Option<usize>
The length of a frame header of this format starting src, magic
number included, as its size fields give it; None until src holds
the descriptor byte after the magic number. For a caller reading a
header in pieces, as frame_header_input_needed serves an RFC 8878
one.
use structured_zstd::decoding::LegacyVersion;
// v0.7, a one-byte dictionary ID and a window byte.
let header = [0x27, 0xB5, 0x2F, 0xFD, 0x01];
let version = LegacyVersion::of(&header).unwrap();
assert_eq!(version.header_size(&header[..4]), None);
assert_eq!(version.header_size(&header), Some(7));Trait Implementations§
Source§impl Clone for LegacyVersion
impl Clone for LegacyVersion
impl Copy for LegacyVersion
Source§impl Debug for LegacyVersion
impl Debug for LegacyVersion
impl Eq for LegacyVersion
Source§impl Hash for LegacyVersion
impl Hash for LegacyVersion
Source§impl PartialEq for LegacyVersion
impl PartialEq for LegacyVersion
impl StructuralPartialEq for LegacyVersion
Auto Trait Implementations§
impl Freeze for LegacyVersion
impl RefUnwindSafe for LegacyVersion
impl Send for LegacyVersion
impl Sync for LegacyVersion
impl Unpin for LegacyVersion
impl UnsafeUnpin for LegacyVersion
impl UnwindSafe for LegacyVersion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more