Skip to main content

FrameHeader

Struct FrameHeader 

Source
pub struct FrameHeader {
    pub window_size: u64,
    pub content_size: Option<u64>,
    pub dict_id: u32,
    pub checksum: bool,
    pub single_segment: bool,
    pub header_len: usize,
}
Expand description

A parsed frame header.

Fields§

§window_size: u64

Window size in bytes (equal to the content size for single-segment frames).

§content_size: Option<u64>

Declared decompressed size, if recorded.

§dict_id: u32

0 when the frame names no dictionary.

§checksum: bool

A 4-byte XXH64-based checksum follows the last block.

§single_segment: bool

No window descriptor: the window is the whole content.

§header_len: usize

Bytes from the magic number through the end of the header.

Implementations§

Source§

impl FrameHeader

Source

pub fn parse(src: &[u8]) -> Result<FrameHeader>

Parses the header of a zstd frame starting at src[0] (the magic number).

Source

pub fn parse_format(src: &[u8], format: FrameFormat) -> Result<FrameHeader>

Parses a frame header in the given format.

Source

pub fn write(&self, window_log: u32, out: &mut Vec<u8>)

Appends this header (magic included). window_log is used when not single-segment.

Source

pub fn write_format( &self, format: FrameFormat, window_log: u32, out: &mut Vec<u8>, )

Appends this header in the given format.

Trait Implementations§

Source§

impl Clone for FrameHeader

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 FrameHeader

Source§

impl Debug for FrameHeader

Source§

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

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

impl Eq for FrameHeader

Source§

impl PartialEq for FrameHeader

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 FrameHeader

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.