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§
Required Methods§
Sourcefn codec_config_schema(&self) -> Schema
fn codec_config_schema(&self) -> Schema
JSON schema for the codec’s configuration.
Sourcefn codec_from_config<'de, D: Deserializer<'de>>(
&self,
config: D,
) -> Result<Self::Codec, D::Error>
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 config
uration.
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.