Skip to main content

Codec

Trait Codec 

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

Serialization codec for task payloads.

Required Methods§

Source

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

Source

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

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§