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§
Sourcetype Type: DynCodecType
type Type: DynCodecType
Type object type for this codec.
Required Methods§
Sourcefn get_config<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>
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.
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.