Struct CParams

Source
pub struct CParams(/* private fields */);
Expand description

Wrapper to blosc2_cparams.
Compression parameters.

A normal way to construct this is using std::convert::From<&T>(val) so it will create with default parameters and the correct typesize.

§Example

use blosc2::CParams;
let values = vec![0u8, 1, 2, 3];
let cparams = CParams::new::<u8>()
    .set_nthreads(2);  // Optionally adjust default values

Implementations§

Source§

impl CParams

Source

pub fn new<T>() -> Self

Source

pub fn from_typesize(typesize: usize) -> Self

Source

pub fn set_codec(self, codec: Codec) -> Self

Set codec, defaults to Codec::BloscLz

Source

pub fn set_clevel(self, clevel: CLevel) -> Self

Set clevel, defaults to CLevel::Nine

Source

pub fn set_filter(self, filter: Filter) -> Self

Set filter, defaults to Filter::Shuffle

Source

pub fn set_nthreads(self, n: usize) -> Self

Set number of threads, defaults to 1

Source

pub fn get_nthreads(&self) -> usize

Get number of threads

Source

pub fn set_typesize<T>(self) -> Self

Set the type size

Source

pub fn get_typesize(&self) -> usize

Trait Implementations§

Source§

impl Default for CParams

Source§

fn default() -> Self

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

impl<T> From<&T> for CParams

Create CParams from a reference to the type being compressed

Source§

fn from(_: &T) -> Self

Converts to this type from the input type.
Source§

impl From<CParams> for Context

Source§

fn from(cparams: CParams) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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.