meio_protocol

Trait ProtocolCodec

Source
pub trait ProtocolCodec: Send {
    // Required methods
    fn decode<T: ProtocolData>(data: &[u8]) -> Result<T, Error>;
    fn encode<T: ProtocolData>(value: &T) -> Result<Vec<u8>, Error>;
}
Expand description

The serialization format for a Protocol.

Required Methods§

Source

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

Decodes binary data to a type.

Source

fn encode<T: ProtocolData>(value: &T) -> Result<Vec<u8>, Error>

Encodes value to a binary data.

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§