Trait numcodecs::Codec

source ·
pub trait Codec:
    'static
    + Send
    + Sync
    + Clone {
    type Error: 'static + Send + Sync + Error;

    // Required methods
    fn encode(&self, data: AnyCowArray<'_>) -> Result<AnyArray, Self::Error>;
    fn decode(&self, encoded: AnyCowArray<'_>) -> Result<AnyArray, Self::Error>;
    fn decode_into(
        &self,
        encoded: AnyArrayView<'_>,
        decoded: AnyArrayViewMut<'_>,
    ) -> Result<(), Self::Error>;
}
Expand description

Compression codec that encodes and decodes numeric n-dimensional arrays.

Required Associated Types§

source

type Error: 'static + Send + Sync + Error

Error type that may be returned during encodeing and decodeing.

Required Methods§

source

fn encode(&self, data: AnyCowArray<'_>) -> Result<AnyArray, Self::Error>

Encodes the data and returns the result.

§Errors

Errors if encoding the buffer fails.

source

fn decode(&self, encoded: AnyCowArray<'_>) -> Result<AnyArray, Self::Error>

Decodes the encoded data and returns the result.

§Errors

Errors if decoding the buffer fails.

source

fn decode_into( &self, encoded: AnyArrayView<'_>, decoded: AnyArrayViewMut<'_>, ) -> Result<(), Self::Error>

Decodes the encoded data and writes the result into the provided decoded output.

The output must have the correct type and shape.

§Errors

Errors if decoding the buffer fails.

Object Safety§

This trait is not object safe.

Implementors§