Skip to main content

LegacyVersion

Enum LegacyVersion 

Source
#[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

Source

pub fn of(src: &[u8]) -> Option<LegacyVersion>

The format whose magic number starts src, if it is one of these.

Source

pub fn minor(self) -> u8

The minor version number: 5, 6 or 7.

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for LegacyVersion

Source§

impl Debug for LegacyVersion

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for LegacyVersion

Source§

impl Hash for LegacyVersion

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for LegacyVersion

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LegacyVersion

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.