Struct ruzstd::frame::FrameDescriptor

source ·
pub struct FrameDescriptor(/* private fields */);
Expand description

The first byte is called the Frame Header Descriptor, and it describes what other fields are present.

Implementations§

source§

impl FrameDescriptor

source

pub fn frame_content_size_flag(&self) -> u8

Read the Frame_Content_Size_flag from the frame header descriptor.

This is a 2 bit flag, specifying if the Frame_Content_Size field is present within the header. It notates the number of bytes used by Frame_Content_size

When this value is is 0, FCS_Field_Size depends on Single_Segment_flag. If the Single_Segment_flag field is set in the frame header descriptor, the size of the Frame_Content_Size field of the header is 1 byte. Otherwise, FCS_Field_Size is 0, and the Frame_Content_Size is not provided.

Flag Value (decimal)Size of the Frame_Content_Size field in bytes
00 or 1 (see above)
12
24
38
source

pub fn reserved_flag(&self) -> bool

This bit is reserved for some future feature, a compliant decoder must ensure that this value is set to zero.

source

pub fn single_segment_flag(&self) -> bool

If this flag is set, data must be regenerated within a single continuous memory segment.

In this case, the Window_Descriptor byte is skipped, but Frame_Content_Size is present. The decoder must allocate a memory segment equal to or larger than Frame_Content_Size.

source

pub fn content_checksum_flag(&self) -> bool

If this flag is set, a 32 bit Content_Checksum will be present at the end of the frame.

source

pub fn dict_id_flag(&self) -> u8

This is a two bit flag telling if a dictionary ID is provided within the header. It also specifies the size of this field

Value (Decimal)DID_Field_Size (bytes)
00
11
22
34
source

pub fn frame_content_size_bytes(&self) -> Result<u8, FrameDescriptorError>

Read the size of the Frame_Content_size field from the frame header descriptor, returning the size in bytes. If this value is zero, then the Frame_Content_Size field is not present within the header.

source

pub fn dictionary_id_bytes(&self) -> Result<u8, FrameDescriptorError>

Read the size of the Dictionary_ID field from the frame header descriptor, returning the size in bytes. If this value is zero, then the dictionary id is not present within the header, and “It’s up to the decoder to know which dictionary to use.”

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.