Trait tor_cell::chancell::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.

Object Safety§

This trait is not object safe.

Implementors§