pub trait FromMessage: Sized {
    type Error;

    // Required method
    fn parse_message(msg: &mut Message) -> Result<Self, Self::Error>;

    // Provided method
    fn from_message(msg: Message) -> Result<Self, Self::Error> { ... }
}
Expand description

Trait for converting a Message to a Self.

Required Associated Types§

source

type Error

The error type returned when parsing a Message.

Required Methods§

source

fn parse_message(msg: &mut Message) -> Result<Self, Self::Error>

Parse (while consuming) a Message into a Self.

Provided Methods§

source

fn from_message(msg: Message) -> Result<Self, Self::Error>

Convert an owned Message into a Self.

Implementors§