Trait numcodecs::DynCodec

source ·
pub trait DynCodec: Codec {
    type Type: DynCodecType;

    // Required methods
    fn ty(&self) -> Self::Type;
    fn get_config<S: Serializer>(
        &self,
        serializer: S,
    ) -> Result<S::Ok, S::Error>;
}
Expand description

Dynamically typed compression codec.

Every codec that implements StaticCodec also implements DynCodec.

Required Associated Types§

source

type Type: DynCodecType

Type object type for this codec.

Required Methods§

source

fn ty(&self) -> Self::Type

Returns the type object for this codec.

source

fn get_config<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serializes the configuration parameters for this codec.

The config must include an id field with the DynCodecType::codec_id, for which the serialize_codec_config_with_id helper function may be used.

The config must be compatible with JSON encoding.

§Errors

Errors if serializing the codec configuration fails.

Object Safety§

This trait is not object safe.

Implementors§