Trait tonic::codec::Encoder

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

    // Required method
    fn encode(
        &mut self,
        item: Self::Item,
        dst: &mut EncodeBuf<'_>,
    ) -> Result<(), Self::Error>;

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

Encodes gRPC message types

Required Associated Types§

source

type Item

The type that is encoded.

source

type Error: From<Error>

The type of encoding errors.

The type of unrecoverable frame encoding errors.

Required Methods§

source

fn encode( &mut self, item: Self::Item, dst: &mut EncodeBuf<'_>, ) -> Result<(), Self::Error>

Encodes a message into the provided buffer.

Provided Methods§

source

fn buffer_settings(&self) -> BufferSettings

Controls how tonic creates and expands encode buffers.

Implementors§