pub trait CoolCodec:
Clone
+ Send
+ Sync
+ 'static {
const CONTENT_TYPE: &'static str;
// Required methods
fn encode<T: Serialize + ?Sized>(
&self,
value: &T,
) -> Result<Vec<u8>, CoolError>;
fn decode<T: for<'de> Deserialize<'de>>(
&self,
bytes: &[u8],
) -> Result<T, CoolError>;
}Required Associated Constants§
const CONTENT_TYPE: &'static str
Required Methods§
fn encode<T: Serialize + ?Sized>(&self, value: &T) -> Result<Vec<u8>, CoolError>
fn decode<T: for<'de> Deserialize<'de>>( &self, bytes: &[u8], ) -> Result<T, CoolError>
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.