Skip to main content

ProtocolWire

Trait ProtocolWire 

Source
pub trait ProtocolWire: Sized {
    const PROTOCOL_ID: &'static str;

    // Required methods
    fn encode_to_vec(&self) -> Vec<u8> ;
    fn decode_from_bytes(bytes: &[u8]) -> Result<Self>;
}
Expand description

Encode/decode the typed payload inside ProtocolAttachment.

Required Associated Constants§

Source

const PROTOCOL_ID: &'static str

Protocol slug this wire type belongs to.

Required Methods§

Source

fn encode_to_vec(&self) -> Vec<u8>

Serialize this payload to bytes for attachment storage.

Source

fn decode_from_bytes(bytes: &[u8]) -> Result<Self>

Deserialize bytes produced by Self::encode_to_vec.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl ProtocolWire for GrpcErrorMeta

Source§

const PROTOCOL_ID: &'static str = "grpc"

Source§

fn encode_to_vec(&self) -> Vec<u8>

Source§

fn decode_from_bytes(bytes: &[u8]) -> Result<Self>

Source§

impl ProtocolWire for GrpcOperationMeta

Source§

const PROTOCOL_ID: &'static str = "grpc"

Source§

fn encode_to_vec(&self) -> Vec<u8>

Source§

fn decode_from_bytes(bytes: &[u8]) -> Result<Self>

Source§

impl ProtocolWire for HttpErrorMeta

Source§

const PROTOCOL_ID: &'static str = "http"

Source§

fn encode_to_vec(&self) -> Vec<u8>

Source§

fn decode_from_bytes(bytes: &[u8]) -> Result<Self>

Source§

impl ProtocolWire for HttpOperationMeta

Source§

const PROTOCOL_ID: &'static str = "http"

Source§

fn encode_to_vec(&self) -> Vec<u8>

Source§

fn decode_from_bytes(bytes: &[u8]) -> Result<Self>

Implementors§