pub trait Codec: Send + Sync {
// Required methods
fn encode(message: &SynapseMessage) -> Result<Bytes>
where Self: Sized;
fn decode(data: &[u8]) -> Result<SynapseMessage>
where Self: Sized;
fn content_type() -> ContentType
where Self: Sized;
}Expand description
Codec trait for serializing/deserializing SynapseMessage envelope
Required Methods§
Sourcefn encode(message: &SynapseMessage) -> Result<Bytes>where
Self: Sized,
fn encode(message: &SynapseMessage) -> Result<Bytes>where
Self: Sized,
Encode a SynapseMessage to bytes
Sourcefn decode(data: &[u8]) -> Result<SynapseMessage>where
Self: Sized,
fn decode(data: &[u8]) -> Result<SynapseMessage>where
Self: Sized,
Decode bytes to a SynapseMessage
Sourcefn content_type() -> ContentTypewhere
Self: Sized,
fn content_type() -> ContentTypewhere
Self: Sized,
Get the content type this codec produces