pub trait MessageSerializer<T>: Send + Sync {
// Required methods
fn serialize<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 T,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn content_type(&self) -> &str;
}Expand description
Serializer trait for converting messages to bytes
Required Methods§
Sourcefn serialize<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 T,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn serialize<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 T,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Serialize message to bytes
Sourcefn content_type(&self) -> &str
fn content_type(&self) -> &str
Get content type identifier
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".