Codec

Trait Codec 

pub trait Codec:
    Send
    + Sync
    + 'static {
    type Encode: Send + Sync + 'static;
    type Decode: Send + Sync + 'static;
    type Encoder: Encoder<Item = Self::Encode, Error = Status> + Send + Sync + 'static;
    type Decoder: Decoder<Item = Self::Decode, Error = Status> + Send + Sync + 'static;

    // Required methods
    fn encoder(&mut self) -> Self::Encoder;
    fn decoder(&mut self) -> Self::Decoder;
}
Expand description

Trait that knows how to encode and decode gRPC messages.

Required Associated Types§

type Encode: Send + Sync + 'static

The encodable message.

type Decode: Send + Sync + 'static

The decodable message.

type Encoder: Encoder<Item = Self::Encode, Error = Status> + Send + Sync + 'static

The encoder that can encode a message.

type Decoder: Decoder<Item = Self::Decode, Error = Status> + Send + Sync + 'static

The decoder that can decode a message.

Required Methods§

fn encoder(&mut self) -> Self::Encoder

Fetch the encoder.

fn decoder(&mut self) -> Self::Decoder

Fetch the decoder.

Implementors§

§

impl<T, U> Codec for ProstCodec<T, U>
where T: Message + Send + 'static, U: Message + Default + Send + 'static,

§

type Encode = T

§

type Decode = U

§

type Encoder = ProstEncoder<T>

§

type Decoder = ProstDecoder<U>