Skip to main content

Codec

Trait Codec 

Source
pub trait Codec:
    Send
    + Sync
    + 'static {
    // Required methods
    fn encode<T: Serialize>(&self, value: &T) -> TaskResult<Vec<u8>>;
    fn decode<T: DeserializeOwned>(&self, data: &[u8]) -> TaskResult<T>;
}
Expand description

Serialization codec for task payloads.

Required Methods§

Source

fn encode<T: Serialize>(&self, value: &T) -> TaskResult<Vec<u8>>

Source

fn decode<T: DeserializeOwned>(&self, data: &[u8]) -> TaskResult<T>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§