Struct Encoder

struct Encoder<'a> { ... }

An in-memory encoder for streams of data.

Implementations

impl Encoder<'static>

fn new(level: i32) -> Result<Self>

Creates a new encoder.

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

Creates a new encoder initialized with the given dictionary.

impl<'a> Encoder<'a>

fn with_context(context: &'a mut CCtx<'static>) -> Self

Creates a new encoder that uses the provided context for serialization.

fn with_prepared_dictionary<'b>(dictionary: &EncoderDictionary<'b>) -> Result<Self>
where
    'b: 'a

Creates a new encoder using an existing EncoderDictionary.

fn with_ref_prefix<'b>(level: i32, ref_prefix: &'b [u8]) -> Result<Self>
where
    'b: 'a

Creates a new encoder initialized with the given ref prefix.

fn set_parameter(self: &mut Self, parameter: CParameter) -> Result<()>

Sets a compression parameter for this encoder.

fn set_pledged_src_size(self: &mut Self, pledged_src_size: Option<u64>) -> Result<()>

Sets the size of the input expected by zstd.

May affect compression ratio.

It is an error to give an incorrect size (an error will be returned when closing the stream).

If None is given, it assume the size is not known (default behaviour).

impl<'a> Freeze for Encoder<'a>

impl<'a> Operation for Encoder<'a>

fn run<C: WriteBuf + ?Sized>(self: &mut Self, input: &mut InBuffer<'_>, output: &mut OutBuffer<'_, C>) -> Result<usize>
fn flush<C: WriteBuf + ?Sized>(self: &mut Self, output: &mut OutBuffer<'_, C>) -> Result<usize>
fn finish<C: WriteBuf + ?Sized>(self: &mut Self, output: &mut OutBuffer<'_, C>, _finished_frame: bool) -> Result<usize>
fn reinit(self: &mut Self) -> Result<()>

impl<'a> RefUnwindSafe for Encoder<'a>

impl<'a> Send for Encoder<'a>

impl<'a> Sync for Encoder<'a>

impl<'a> Unpin for Encoder<'a>

impl<'a> UnsafeUnpin for Encoder<'a>

impl<'a> UnwindSafe for Encoder<'a>

impl<T> Any for Encoder<'a>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Encoder<'a>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Encoder<'a>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for Encoder<'a>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Encoder<'a>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Encoder<'a>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Encoder<'a>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>