Skip to main content

SyncCodec

Trait SyncCodec 

Source
pub trait SyncCodec<T>:
    Send
    + Sync
    + 'static {
    // Required methods
    fn encode(&self, value: &T) -> Result<Payload, BoxError>;
    fn decode(&self, payload: Payload) -> Result<T, BoxError>;
}
Expand description

A synchronous codec. Wrap it in FromSync where a Codec is expected.

Required Methods§

Source

fn encode(&self, value: &T) -> Result<Payload, BoxError>

Serialize value without awaiting.

Source

fn decode(&self, payload: Payload) -> Result<T, BoxError>

Deserialize payload into an independent value without awaiting.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§