Skip to main content

CodecCaps

Struct CodecCaps 

Source
pub struct CodecCaps {
    pub encode: bool,
    pub decode: bool,
    pub parallel_encode: bool,
    pub parallel_decode: bool,
    pub frame_index: bool,
    pub detects_corruption: CorruptionDetection,
    pub memory_per_worker: Option<u64>,
    pub weak_encoder: bool,
}
Expand description

What a codec can do. Every field defaults to false (or, for detects_corruption, its equivalent conservative variant): a backend must opt in.

Fields§

§encode: bool§decode: bool§parallel_encode: bool§parallel_decode: bool§frame_index: bool

Stream carries a frame/block index enabling random access.

§detects_corruption: CorruptionDetection

See CorruptionDetection for what each state promises.

§memory_per_worker: Option<u64>

Rough working-set cost of one encode worker, in bytes, when the codec knows it. None means unknown — assume modest.

A static, conservative HIGH figure for callers who introspect CodecCaps without encoding anything (property 12’s own governor sizing, and each codec’s clamp test) — it is not what the governor actually divides by during a real encode. The four codecs Phase 1f gave a multi-threaded encoder (zstd-c, xz-c, xz-pure, lzip) each call their own level-aware per_worker_bytes(level) for that, because the true cost varies by preset (roughly 128 MiB below preset 7, ~896 MiB at 7 and above, for xz and lzip) and this field’s contract is to round up to a single figure that covers every level a caller might ask for.

§weak_encoder: bool

This build’s encoder for the format is markedly worse than the format’s usual one — a fallback that produces valid output nobody would choose.

ops refuses to use it unless the caller opts in, because the output is indistinguishable afterwards: a user who asked for .xz expects xz ratios, and two builds of stuffr would otherwise produce very different files from an identical command with no way to tell which they got.

Implementations§

Source§

impl CodecCaps

Source

pub const fn round_trip() -> Self

A codec that both compresses and decompresses, with no parallelism and no frame index. The common shape.

Source

pub const fn decode_only() -> Self

A decode-only codec — the pure-Rust fallbacks that let a build with no C toolchain still open a .zst or .xz.

Trait Implementations§

Source§

impl Clone for CodecCaps

Source§

fn clone(&self) -> CodecCaps

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 CodecCaps

Source§

impl Debug for CodecCaps

Source§

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

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

impl Default for CodecCaps

Source§

fn default() -> CodecCaps

Returns the “default value” for a type. Read more
Source§

impl Eq for CodecCaps

Source§

impl PartialEq for CodecCaps

Source§

fn eq(&self, other: &CodecCaps) -> 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 CodecCaps

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.