Skip to main content

Format

Trait Format 

Source
pub trait Format: Send + Sync {
    // Required method
    fn worker(&self, threads: u32) -> Result<Box<dyn Worker + '_>>;

    // Provided methods
    fn stream(&self, _unit: &Unit) -> Result<Option<Stream>> { ... }
    fn solid(&self) -> Option<&dyn SolidStream> { ... }
    fn serial(&self) -> bool { ... }
    fn refuses_in_place(&self) -> Option<String> { ... }
    fn password_check(&self) -> PasswordCheck { ... }
    fn prove_password(&self) -> Result<()> { ... }
}

Required Methods§

Source

fn worker(&self, threads: u32) -> Result<Box<dyn Worker + '_>>

A worker decodes units on one thread. threads is a hint for codecs that can decode a single stream on several cores.

Provided Methods§

Source

fn stream(&self, _unit: &Unit) -> Result<Option<Stream>>

For a unit holding one file whose data resumable can decode from the middle: where that data lies. Such units can free their archive bytes while they are extracted instead of only once they are done.

Source

fn solid(&self) -> Option<&dyn SolidStream>

For an archive that is one compressed stream, decodable only from the front: its single unit, extracted front to back while the bytes behind the decoder are freed.

Source

fn serial(&self) -> bool

The decoder finds a unit only by reading everything before it, and one handle can’t be shared between threads. A batch is then decoded on one thread by one worker, lowest unit first, so the worker can walk forward instead of starting over for every unit.

Source

fn refuses_in_place(&self) -> Option<String>

Why the archive can’t be extracted in place, if it can’t: it can still be extracted while it is kept.

Source

fn password_check(&self) -> PasswordCheck

Source

fn prove_password(&self) -> Result<()>

Proves the password from the headers alone; only called when password_check says it can.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§