pub trait DntCodec: Send + Sync {
// Required methods
fn codec_id(&self) -> CodecId;
fn encode(&self, value: &[u8]) -> Result<Vec<u8>, CodecError>;
fn decode(&self, payload: &[u8]) -> Result<Vec<u8>, CodecError>;
// Provided methods
fn matches_codec_id(&self, codec_id: &CodecId) -> bool { ... }
fn decode_owned(&self, payload: Vec<u8>) -> Result<Vec<u8>, CodecError> { ... }
}Expand description
Payload codec used before encryption and after authentication.
Required Methods§
Provided Methods§
Sourcefn matches_codec_id(&self, codec_id: &CodecId) -> bool
fn matches_codec_id(&self, codec_id: &CodecId) -> bool
Returns true when this codec can decode the authenticated identifier.
Sourcefn decode_owned(&self, payload: Vec<u8>) -> Result<Vec<u8>, CodecError>
fn decode_owned(&self, payload: Vec<u8>) -> Result<Vec<u8>, CodecError>
Decodes an owned authenticated payload after opening.
Codecs that are identity transforms can return payload directly to
avoid an allocation in the read path. Transforming codecs may keep the
default implementation.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".