numcodecs

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

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§