Skip to main content

Codec

Trait Codec 

Source
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§

Source

fn encode(message: &SynapseMessage) -> Result<Bytes>
where Self: Sized,

Encode a SynapseMessage to bytes

Source

fn decode(data: &[u8]) -> Result<SynapseMessage>
where Self: Sized,

Decode bytes to a SynapseMessage

Source

fn content_type() -> ContentType
where Self: Sized,

Get the content type this codec produces

Implementors§