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 Types§
sourcetype Config<'de>: Serialize + Deserialize<'de> + JsonSchema
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 Associated Constants§
Required Methods§
sourcefn from_config(config: Self::Config<'_>) -> Self
fn from_config(config: Self::Config<'_>) -> Self
Instantiate a codec from its config
uration.
sourcefn get_config(&self) -> StaticCodecConfig<'_, Self>
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.