Trait numcodecs::DynCodecType

source ·
pub trait DynCodecType:
    'static
    + Send
    + Sync {
    type Codec: DynCodec<Type = Self>;

    // Required methods
    fn codec_id(&self) -> &str;
    fn codec_config_schema(&self) -> Schema;
    fn codec_from_config<'de, D: Deserializer<'de>>(
        &self,
        config: D,
    ) -> Result<Self::Codec, D::Error>;
}
Expand description

Type object for dynamically typed compression codecs.

Required Associated Types§

source

type Codec: DynCodec<Type = Self>

Type of the instances of this codec type object.

Required Methods§

source

fn codec_id(&self) -> &str

Codec identifier.

source

fn codec_config_schema(&self) -> Schema

JSON schema for the codec’s configuration.

source

fn codec_from_config<'de, D: Deserializer<'de>>( &self, config: D, ) -> Result<Self::Codec, D::Error>

Instantiate a codec of this type from a serialized configuration.

The config must not contain an id field. If the config may contain one, use the codec_from_config_with_id helper function.

The config must be compatible with JSON encoding.

§Errors

Errors if constructing the codec fails.

Object Safety§

This trait is not object safe.

Implementors§