EncodableMessage

Trait EncodableMessage 

Source
pub trait EncodableMessage:
    Sized
    + Debug
    + Send {
    // Provided methods
    fn read_body(
        _data: BytesMut,
        _header: &NetMessageHeader,
    ) -> Result<Self, MalformedBody> { ... }
    fn write_body<W: Write>(&self, _writer: W) -> Result<(), Error> { ... }
    fn encode_size(&self) -> usize { ... }
    fn process_header(&self, _header: &mut NetMessageHeader) { ... }
}
Expand description

A message which can be encoded and/or decoded

Applications can implement this trait on a struct to allow sending it using raw_send_with_kind. To use the higher level messages a struct also needs to implement NetMessage

Provided Methods§

Source

fn read_body( _data: BytesMut, _header: &NetMessageHeader, ) -> Result<Self, MalformedBody>

Source

fn write_body<W: Write>(&self, _writer: W) -> Result<(), Error>

Source

fn encode_size(&self) -> usize

Source

fn process_header(&self, _header: &mut NetMessageHeader)

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§

Source§

impl<ProtoMsg: RpcMessageWithKind + Send> EncodableMessage for ProtoMsg