zstd_safe

Struct CCtx

Source
pub struct CCtx<'a>(/* private fields */);

Implementations§

Source§

impl CCtx<'static>

Source

pub fn try_create() -> Option<Self>

Tries to create a new context.

Returns None if zstd returns a NULL pointer - may happen if allocation fails.

Source

pub fn create() -> Self

Wrap ZSTD_createCCtx

§Panics

If zstd returns a NULL pointer.

Source§

impl<'a> CCtx<'a>

Source

pub fn compress<C: WriteBuf + ?Sized>( &mut self, dst: &mut C, src: &[u8], compression_level: CompressionLevel, ) -> SafeResult

Wraps the ZSTD_compressCCtx() function

Source

pub fn compress2<C: WriteBuf + ?Sized>( &mut self, dst: &mut C, src: &[u8], ) -> SafeResult

Wraps the ZSTD_compress2() function.

Source

pub fn compress_using_dict<C: WriteBuf + ?Sized>( &mut self, dst: &mut C, src: &[u8], dict: &[u8], compression_level: CompressionLevel, ) -> SafeResult

Wraps the ZSTD_compress_usingDict() function.

Source

pub fn compress_using_cdict<C: WriteBuf + ?Sized>( &mut self, dst: &mut C, src: &[u8], cdict: &CDict<'_>, ) -> SafeResult

Wraps the ZSTD_compress_usingCDict() function.

Source

pub fn init(&mut self, compression_level: CompressionLevel) -> usize

Source

pub fn load_dictionary(&mut self, dict: &[u8]) -> SafeResult

Source

pub fn ref_cdict<'b>(&mut self, cdict: &CDict<'b>) -> SafeResult
where 'b: 'a,

Wraps the ZSTD_CCtx_refCDict() function.

Dictionary must outlive the context.

Source

pub fn ref_prefix<'b>(&mut self, prefix: &'b [u8]) -> SafeResult
where 'b: 'a,

Source

pub fn compress_stream<C: WriteBuf + ?Sized>( &mut self, output: &mut OutBuffer<'_, C>, input: &mut InBuffer<'_>, ) -> SafeResult

Source

pub fn compress_stream2<C: WriteBuf + ?Sized>( &mut self, output: &mut OutBuffer<'_, C>, input: &mut InBuffer<'_>, end_op: ZSTD_EndDirective, ) -> SafeResult

Wraps the ZSTD_compressStream2() function.

Source

pub fn flush_stream<C: WriteBuf + ?Sized>( &mut self, output: &mut OutBuffer<'_, C>, ) -> SafeResult

Wraps the ZSTD_flushStream() function.

Source

pub fn end_stream<C: WriteBuf + ?Sized>( &mut self, output: &mut OutBuffer<'_, C>, ) -> SafeResult

Wraps the ZSTD_endStream() function.

Source

pub fn sizeof(&self) -> usize

Source

pub fn reset(&mut self, reset: ResetDirective) -> SafeResult

Source

pub fn set_parameter(&mut self, param: CParameter) -> SafeResult

Source

pub fn set_pledged_src_size(&mut self, pledged_src_size: u64) -> SafeResult

Source

pub fn in_size() -> usize

Source

pub fn out_size() -> usize

Trait Implementations§

Source§

impl Default for CCtx<'_>

Source§

fn default() -> Self

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

impl<'a> Drop for CCtx<'a>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'a> Send for CCtx<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for CCtx<'a>

§

impl<'a> RefUnwindSafe for CCtx<'a>

§

impl<'a> !Sync for CCtx<'a>

§

impl<'a> Unpin for CCtx<'a>

§

impl<'a> UnwindSafe for CCtx<'a>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

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.