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.
Object Safety§
This trait is not object safe.