Trait ChanMsg

Source
pub trait ChanMsg {
    // Required methods
    fn cmd(&self) -> ChanCmd;
    fn encode_onto<W: Writer + ?Sized>(self, w: &mut W) -> EncodeResult<()>;
    fn decode_from_reader(cmd: ChanCmd, r: &mut Reader<'_>) -> Result<Self>
       where Self: Sized;
}
Expand description

Trait implemented by anything that can serve as a channel message.

Typically, this will be AnyChanMsg (to represent an unrestricted relay message), or some restricted subset of those messages.

Required Methods§

Source

fn cmd(&self) -> ChanCmd

Return the ChanCmd for this message.

Source

fn encode_onto<W: Writer + ?Sized>(self, w: &mut W) -> EncodeResult<()>

Write the body of this message (not including length or command).

Source

fn decode_from_reader(cmd: ChanCmd, r: &mut Reader<'_>) -> Result<Self>
where Self: Sized,

Decode this message from a given reader, according to a specified command value. The reader must be truncated to the exact length of the body.

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§