Skip to main content

MessageRecv

Trait MessageRecv 

Source
pub trait MessageRecv: MessageBody {
    type DecodeError: Error + Send + Sync + 'static;

    // Required method
    fn decode(bytes: &[u8]) -> Result<Self, Self::DecodeError>
       where Self: Sized;
}
Expand description

Trait describing a Message that can be received.

This trait is used both as a marker and to define how a Message can be decoded.

Note that for convenience this trait is automatically implemented for any type that implements both MessageBody and bitcode’s DecodeOwned trait.

Required Associated Types§

Source

type DecodeError: Error + Send + Sync + 'static

Error tyep that may occur while decoding.

Required Methods§

Source

fn decode(bytes: &[u8]) -> Result<Self, Self::DecodeError>
where Self: Sized,

Decode raw byte data into a new message body.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§