numcodecs

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

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§