[][src]Struct yazi::Encoder

pub struct Encoder(_);

Stateful context for compression.

See the crate level compression section for detailed usage.

Implementations

impl Encoder[src]

pub fn new() -> Self[src]

Creates a new deflate encoder. Note that creating an encoder with this method allocates a large (200-300k) chunk of data on the stack and is likely to cause an overflow if not carefully managed. See the boxed() constructor for a safer method that allocates on the heap.

pub fn boxed() -> Box<Self>[src]

Creates a new deflate encoder on the heap.

pub fn set_format(&mut self, format: Format)[src]

Sets the format of the output bitstream for the next usage of the encoder.

pub fn set_level(&mut self, level: CompressionLevel)[src]

Sets the compression level for the next usage of the encoder.

pub fn set_strategy(&mut self, strategy: CompressionStrategy)[src]

Sets the compression strategy for the next usage of the encoder.

pub fn stream<'a, W: Write>(
    &'a mut self,
    writer: &'a mut W
) -> EncoderStream<'a, impl Sink + 'a>

Notable traits for EncoderStream<'a, S>

impl<'a, S: Sink> Write for EncoderStream<'a, S>
[src]

Creates an encoder stream that will write into the specified writer.

pub fn stream_into_vec<'a>(
    &'a mut self,
    vec: &'a mut Vec<u8>
) -> EncoderStream<'a, impl Sink + 'a>

Notable traits for EncoderStream<'a, S>

impl<'a, S: Sink> Write for EncoderStream<'a, S>
[src]

Creates an encoder stream that will write into the specified vector. The resulting stream will not clear the vector but will instead append the compressed data.

pub fn stream_into_buf<'a>(
    &'a mut self,
    buf: &'a mut [u8]
) -> EncoderStream<'a, impl Sink + 'a>

Notable traits for EncoderStream<'a, S>

impl<'a, S: Sink> Write for EncoderStream<'a, S>
[src]

Creates an encoder stream that will write into the specified buffer. The stream will generate an overflow error if the buffer is not large enough to contain the compressed data.

Auto Trait Implementations

impl RefUnwindSafe for Encoder

impl Send for Encoder

impl Sync for Encoder

impl Unpin for Encoder

impl UnwindSafe for Encoder

Blanket Implementations

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

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

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

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

impl<T, U> Into<U> for T where
    U: From<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.