Skip to main content

CompressionParametersBuilder

Struct CompressionParametersBuilder 

Source
pub struct CompressionParametersBuilder { /* private fields */ }
Expand description

Builder for CompressionParameters. Each setter records one knob; Self::build validates them against CParameter::bounds.

Implementations§

Source§

impl CompressionParametersBuilder

Source

pub fn window_log(self, value: u32) -> Self

Override the maximum back-reference distance (log2). C ZSTD_c_windowLog.

Source

pub fn hash_log(self, value: u32) -> Self

Override the match-finder hash table size (log2). C ZSTD_c_hashLog.

Source

pub fn chain_log(self, value: u32) -> Self

Override the match-finder chain table size (log2). C ZSTD_c_chainLog.

Source

pub fn search_log(self, value: u32) -> Self

Override the search-attempts count (log2). C ZSTD_c_searchLog.

Source

pub fn min_match(self, value: u32) -> Self

Override the minimum match length in bytes. C ZSTD_c_minMatch.

Source

pub fn target_length(self, value: u32) -> Self

Override the “good enough” target match length. C ZSTD_c_targetLength.

Source

pub fn strategy(self, value: Strategy) -> Self

Override the match-finder Strategy. C ZSTD_c_strategy.

Source

pub fn enable_long_distance_matching(self, enable: bool) -> Self

Enable or disable long-distance matching. C ZSTD_c_enableLongDistanceMatching. Off at every level preset. This is the explicit activation toggle; the ldm_* knob setters also enable LDM implicitly. The flag is plain last-write-wins, so a trailing enable_long_distance_matching(false) disables LDM even if an earlier ldm_* call set a knob (the knob is then ignored at build).

Source

pub fn ldm_hash_log(self, value: u32) -> Self

Override the LDM hash table size (log2). C ZSTD_c_ldmHashLog. Implies Self::enable_long_distance_matching(true).

Source

pub fn ldm_min_match(self, value: u32) -> Self

Override the LDM minimum match length. C ZSTD_c_ldmMinMatch. Implies Self::enable_long_distance_matching(true).

Source

pub fn ldm_bucket_size_log(self, value: u32) -> Self

Override the LDM bucket size (log2). C ZSTD_c_ldmBucketSizeLog. Implies Self::enable_long_distance_matching(true).

Source

pub fn ldm_hash_rate_log(self, value: u32) -> Self

Override the LDM hash-insertion rate (log2). C ZSTD_c_ldmHashRateLog. Implies Self::enable_long_distance_matching(true).

Source

pub fn build(self) -> Result<CompressionParameters, ParameterError>

Validate every set knob against CParameter::bounds and produce the resolved CompressionParameters.

§Errors

Returns ParameterError::OutOfBounds for the first knob whose value falls outside its inclusive range.

Trait Implementations§

Source§

impl Clone for CompressionParametersBuilder

Source§

fn clone(&self) -> CompressionParametersBuilder

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 CompressionParametersBuilder

Source§

impl Debug for CompressionParametersBuilder

Source§

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

Formats the value using the given formatter. Read more

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 = 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>,

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.