Trait tonic::codec::Decoder

source ·
pub trait Decoder {
    type Item;
    type Error: From<Error>;

    // Required method
    fn decode(
        &mut self,
        src: &mut DecodeBuf<'_>,
    ) -> Result<Option<Self::Item>, Self::Error>;

    // Provided method
    fn buffer_settings(&self) -> BufferSettings { ... }
}
Expand description

Decodes gRPC message types

Required Associated Types§

source

type Item

The type that is decoded.

source

type Error: From<Error>

The type of unrecoverable frame decoding errors.

Required Methods§

source

fn decode( &mut self, src: &mut DecodeBuf<'_>, ) -> Result<Option<Self::Item>, Self::Error>

Decode a message from the buffer.

The buffer will contain exactly the bytes of a full message. There is no need to get the length from the bytes, gRPC framing is handled for you.

Provided Methods§

source

fn buffer_settings(&self) -> BufferSettings

Controls how tonic creates and expands decode buffers.

Implementors§