[][src]Struct zstd::stream::read::Encoder

pub struct Encoder<R: BufRead> { /* fields omitted */ }

An encoder that compress input data from another Read.

Methods

impl<R: Read> Encoder<BufReader<R>>[src]

pub fn new(reader: R, level: i32) -> Result<Self>[src]

Creates a new encoder.

impl<R: BufRead> Encoder<R>[src]

pub fn with_buffer(reader: R, level: i32) -> Result<Self>[src]

Creates a new encoder around a BufRead.

pub fn with_dictionary(reader: R, level: i32, dictionary: &[u8]) -> Result<Self>[src]

Creates a new encoder, using an existing dictionary.

The dictionary must be the same as the one used during compression.

pub fn with_prepared_dictionary(
    reader: R,
    dictionary: &EncoderDictionary
) -> Result<Self>
[src]

Creates a new encoder, using an existing EncoderDictionary.

The dictionary must be the same as the one used during compression.

pub fn recommended_output_size() -> usize[src]

Recommendation for the size of the output buffer.

pub fn get_ref(&self) -> &R[src]

Acquire a reference to the underlying reader.

pub fn get_mut(&mut self) -> &mut R[src]

Acquire a mutable reference to the underlying reader.

Note that mutation of the reader may result in surprising results if this encoder is continued to be used.

pub fn finish(self) -> R[src]

Return the inner Read.

Calling finish() is not required after reading a stream - just use it if you need to get the Read back.

pub fn include_checksum(&mut self, include_checksum: bool) -> Result<()>[src]

Controls whether zstd should include a content checksum at the end of each frame.

pub fn multithread(&mut self, n_workers: u32) -> Result<()>[src]

Enables multithreaded compression

  • If n_workers == 0 (default), then multithreaded will be disabled.
  • If n_workers >= 1, then compression will be done in separate threads. So even n_workers = 1 may increase performance by separating IO and compression.

Trait Implementations

impl<R: BufRead> Read for Encoder<R>[src]

Auto Trait Implementations

impl<R> Send for Encoder<R> where
    R: Send

impl<R> !Sync for Encoder<R>

impl<R> Unpin for Encoder<R> where
    R: Unpin

impl<R> UnwindSafe for Encoder<R> where
    R: UnwindSafe

impl<R> RefUnwindSafe for Encoder<R> where
    R: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]