Skip to main content

EventCodec

Trait EventCodec 

Source
pub trait EventCodec: Send + Sync {
    type Event: Serialize + for<'de> Deserialize<'de> + Send + Sync;

    // Provided methods
    fn encode(&self, event: &Self::Event) -> Result<Vec<u8>> { ... }
    fn decode(&self, bytes: &[u8]) -> Result<Self::Event> { ... }
}
Expand description

Encodes and decodes typed payloads for a namespace.

Required Associated Types§

Source

type Event: Serialize + for<'de> Deserialize<'de> + Send + Sync

Provided Methods§

Source

fn encode(&self, event: &Self::Event) -> Result<Vec<u8>>

Source

fn decode(&self, bytes: &[u8]) -> Result<Self::Event>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§