Trait numcodecs::StaticCodec

source ·
pub trait StaticCodec: Codec {
    type Config<'de>: Serialize + Deserialize<'de> + JsonSchema;

    const CODEC_ID: &'static str;

    // Required methods
    fn from_config(config: Self::Config<'_>) -> Self;
    fn get_config(&self) -> StaticCodecConfig<'_, Self>;
}
Expand description

Statically typed compression codec.

Required Associated Constants§

source

const CODEC_ID: &'static str

Codec identifier.

Required Associated Types§

source

type Config<'de>: Serialize + Deserialize<'de> + JsonSchema

Configuration type, from which the codec can be created infallibly.

The config must not contain an id field.

The config must be compatible with JSON encoding and have a schema.

Required Methods§

source

fn from_config(config: Self::Config<'_>) -> Self

Instantiate a codec from its configuration.

source

fn get_config(&self) -> StaticCodecConfig<'_, Self>

Get the configuration for this codec.

The StaticCodecConfig ensures that the returned config includes an id field with the codec’s StaticCodec::CODEC_ID.

Object Safety§

This trait is not object safe.

Implementors§