Struct zstd_safe::DCtx

source ·
pub struct DCtx<'a>(_, _);
Expand description

A Decompression Context.

The lifetime references the potential dictionary used for this context.

If no dictionary was used, it will most likely be 'static.

Same as DStream.

Implementations

Try to create a new decompression context.

Returns None if the operation failed (for example, not enough memory).

Creates a new decoding context.

Panics

If the context creation fails.

Fully decompress the given frame.

This decompress an entire frame in-memory. If you can have enough memory to store both the input and output buffer, then it may be faster that streaming decompression.

Wraps the ZSTD_decompressDCtx() function.

Fully decompress the given frame using a dictionary.

Dictionary must be identical to the one used during compression.

If you plan on using the same dictionary multiple times, it is faster to create a DDict first and use decompress_using_ddict.

Wraps ZSTD_decompress_usingDict

Fully decompress the given frame using a dictionary.

Dictionary must be identical to the one used during compression.

Wraps the ZSTD_decompress_usingDDict() function.

Initializes an existing DStream for decompression.

This is equivalent to calling:

  • reset(SessionOnly)
  • disable_dictionary()

Wraps the ZSTD_initCStream() function.

👎Deprecated
Available on crate feature experimental only.

Wraps the ZSTD_initDStream_usingDict() function.

👎Deprecated
Available on crate feature experimental only.

Wraps the ZSTD_initDStream_usingDDict() function.

Resets the state of the context.

Depending on the reset mode, it can reset the session, the parameters, or both.

Wraps the ZSTD_DCtx_reset() function.

Loads a dictionary.

This will let this context decompress frames that were compressed using this dictionary.

The dictionary content will be copied internally and does not need to be kept alive after calling this function.

If you need to use the same dictionary for multiple contexts, it may be more efficient to create a DDict first, then loads that.

The dictionary will apply to all future frames, until a new dictionary is set.

Return to “no-dictionary” mode.

This will disable any dictionary/prefix previously registered for future frames.

References a dictionary.

This will let this context decompress frames compressed with the same dictionary.

It will apply to all frames decompressed by this context (until a new dictionary is set).

Wraps the ZSTD_DCtx_refDDict() function.

Use some prefix as single-use dictionary for the next frame.

Just like a dictionary, this only works if compression was done with the same prefix.

But unlike a dictionary, this only applies to the next frame.

Wraps the ZSTD_DCtx_refPrefix() function.

Sets a decompression parameter.

Performs a step of a streaming decompression operation.

This will read some data from input and/or write some data to output.

Returns
  • Ok(0) if the current frame just finished decompressing successfully.
  • Ok(hint) with a hint for the “ideal” amount of input data to provide in the next call. Can be safely ignored.

Wraps the ZSTD_decompressStream() function.

Wraps the ZSTD_DStreamInSize() function.

Returns a hint for the recommended size of the input buffer for decompression.

Wraps the ZSTD_DStreamOutSize() function.

Returns a hint for the recommended size of the output buffer for decompression.

Wraps the ZSTD_sizeof_DCtx() function.

Available on crate feature experimental only.

Wraps the ZSTD_decompressBlock() function.

Available on crate feature experimental only.

Wraps the ZSTD_insertBlock() function.

Available on crate feature experimental only.

Creates a copy of this context.

This only works before any data has been decompressed. An error will be returned otherwise.

Trait Implementations

Returns the “default value” for a type. Read more
Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.