numcodecs

Trait 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§