pub trait Codec: Default {
type Encode: Send + 'static;
type Decode: Send + 'static;
type Encoder: Encoder<Item = Self::Encode>;
type Decoder: Decoder<Item = Self::Decode>;
const CONTENT_TYPES: &'static [&'static str];
// Required methods
fn encoder(&mut self) -> Self::Encoder;
fn decoder(&mut self) -> Self::Decoder;
// Provided method
fn check_content_type(&self, ct: &str) -> bool { ... }
}Expand description
Represents a type that can encode/decode a message
Required Associated Constants§
Sourceconst CONTENT_TYPES: &'static [&'static str]
const CONTENT_TYPES: &'static [&'static str]
Content types
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn check_content_type(&self, ct: &str) -> bool
fn check_content_type(&self, ct: &str) -> bool
Returns whether the specified content type is supported
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.