Struct EncodeOptions

Source
pub struct EncodeOptions<'a> { /* private fields */ }
Expand description

Options that configure how data is compressed.

§Examples

Supports builder like chaining.

use zeekstd::{EncodeOptions, FrameSizePolicy};

let raw_encoder = EncodeOptions::new()
    .checksum_flag(false)
    .compression_level(5)
    .frame_size_policy(FrameSizePolicy::Uncompressed(8192))
    .into_raw()?;

Implementations§

Source§

impl<'a> EncodeOptions<'a>

Source

pub fn new() -> Self

Creates a set of options with default initial values.

§Panics

If allocation of CCtx fails.

Source

pub fn try_new() -> Option<Self>

Tries to create new options with default initial values.

Returns None if allocation of CCtx fails.

Source

pub fn with_cctx(cctx: CCtx<'a>) -> Self

Create options with the given compression context.

Source

pub fn cctx(self, cctx: CCtx<'a>) -> Self

Sets a CCtx.

Source

pub fn frame_size_policy(self, policy: FrameSizePolicy) -> Self

Source

pub fn checksum_flag(self, flag: bool) -> Self

Whether to write 32 bit checksums at the end of frames.

Source

pub fn compression_level(self, level: CompressionLevel) -> Self

Sets the compression level used by zstd.

Source

pub fn into_raw(self) -> Result<RawEncoder<'a>>

Creates a RawEncoder with the configuration.

§Errors

Fails if the raw encoder cannot be created.

Source

pub fn into_encoder<W>(self, writer: W) -> Result<Encoder<'a, W>>

Creates an Encoder with the configuration.

§Errors

Fails if the encoder cannot be created.

§Examples
use std::fs::File;
use zeekstd::EncodeOptions;

let output = File::create("data.zst").unwrap();
let raw = EncodeOptions::new()
    .checksum_flag(true)
    .into_encoder(output)
    .unwrap();

Trait Implementations§

Source§

impl Default for EncodeOptions<'_>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<'a> Freeze for EncodeOptions<'a>

§

impl<'a> RefUnwindSafe for EncodeOptions<'a>

§

impl<'a> Send for EncodeOptions<'a>

§

impl<'a> Sync for EncodeOptions<'a>

§

impl<'a> Unpin for EncodeOptions<'a>

§

impl<'a> UnwindSafe for EncodeOptions<'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.