Skip to main content

Message

Trait Message 

Source
pub trait Message: EmptyState {
Show 14 methods // Required methods fn encode<B: BufMut + ?Sized>(&self, buf: &mut B) -> Result<(), EncodeError> where Self: Sized; fn prepend<B: ReverseBuf + ?Sized>(&self, buf: &mut B) where Self: Sized; fn encode_length_delimited<B: BufMut + ?Sized>( &self, buf: &mut B, ) -> Result<(), EncodeError> where Self: Sized; fn encoded_len(&self) -> usize; fn encode_to_vec(&self) -> Vec<u8> ; fn encode_to_bytes(&self) -> Bytes; fn encode_fast(&self) -> ReverseBuffer; fn encode_length_delimited_fast(&self) -> ReverseBuffer; fn encode_contiguous(&self) -> ReverseBuffer; fn encode_length_delimited_contiguous(&self) -> ReverseBuffer; fn encode_dyn(&self, buf: &mut dyn BufMut) -> Result<(), EncodeError>; fn encode_length_delimited_to_vec(&self) -> Vec<u8> ; fn encode_length_delimited_to_bytes(&self) -> Bytes; fn encode_length_delimited_dyn( &self, buf: &mut dyn BufMut, ) -> Result<(), EncodeError>;
}
Expand description

A Bilrost message. Provides basic encoding functionality for message types.

Required Methods§

Source

fn encode<B: BufMut + ?Sized>(&self, buf: &mut B) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message to a buffer.

An error will be returned if the buffer does not have sufficient capacity.

Source

fn prepend<B: ReverseBuf + ?Sized>(&self, buf: &mut B)
where Self: Sized,

Prepends the message to a buffer.

Source

fn encode_length_delimited<B: BufMut + ?Sized>( &self, buf: &mut B, ) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message with a length-delimiter to a buffer.

An error will be returned if the buffer does not have sufficient capacity.

Source

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.

Source

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

Encodes the message to a newly allocated buffer.

Source

fn encode_to_bytes(&self) -> Bytes

Encodes the message to a Bytes buffer.

Source

fn encode_fast(&self) -> ReverseBuffer

Encodes the message to a ReverseBuffer.

Source

fn encode_length_delimited_fast(&self) -> ReverseBuffer

Encodes the message with a length-delimiter to a ReverseBuffer.

Source

fn encode_contiguous(&self) -> ReverseBuffer

Encodes the message to a new RevserseBuffer which will have exactly the required capacity in one contiguous slice.

Source

fn encode_length_delimited_contiguous(&self) -> ReverseBuffer

Encodes the message with a length-delimiter to a new RevserseBuffer which will have exactly the required capacity in one contiguous slice.

Source

fn encode_dyn(&self, buf: &mut dyn BufMut) -> Result<(), EncodeError>

Encodes the message to a Bytes buffer.

Source

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

Encodes the message with a length-delimiter to a newly allocated buffer.

Source

fn encode_length_delimited_to_bytes(&self) -> Bytes

Encodes the message with a length-delimiter to a Bytes buffer.

Source

fn encode_length_delimited_dyn( &self, buf: &mut dyn BufMut, ) -> Result<(), EncodeError>

Encodes the message with a length-delimiter to a Bytes buffer.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<T> Message for T
where T: RawMessage + Sized,

Message is implemented as a usability layer on top of the basic functionality afforded by RawMessage.