Skip to main content

Message

Trait Message 

Source
pub trait Message: Sized + Default {
    // Required methods
    fn encode_to(&self, w: &mut Writer);
    fn merge_field(
        &mut self,
        field_number: u32,
        wire_type: WireType,
        r: &mut Reader<'_>,
    ) -> Result<()>;
}
Expand description

A message with self-contained encode/decode. Mirrors the role of prost::Message for our trait-based codec.

Required Methods§

Source

fn encode_to(&self, w: &mut Writer)

Append the message’s fields to w. Caller is responsible for the surrounding length prefix when used as a nested message.

Source

fn merge_field( &mut self, field_number: u32, wire_type: WireType, r: &mut Reader<'_>, ) -> Result<()>

Merge a single field (already-decoded tag) into self. Implementations should call r.skip(wire_type) for unknown numbers.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§