Skip to main content

Encoder

Trait Encoder 

Source
pub trait Encoder {
    type Item;

    const CONTENT_TYPE: &'static str;

    // Required method
    fn encode(
        &mut self,
        item: Self::Item,
        buf: &mut EncodeBuf<'_>,
    ) -> Result<(), Status>;
}
Expand description

Encodes gRPC message types

Required Associated Constants§

Source

const CONTENT_TYPE: &'static str

The content-type header for messages using this encoding.

Should be application/grpc+yourencoding.

Required Associated Types§

Source

type Item

Type that is encoded

Required Methods§

Source

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

Encode a message into the provided buffer.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§