socketioxide::handler::message

Trait FromMessage

Source
pub trait FromMessage<A: Adapter, M = ViaRequest>: Sized {
    type Error: Error + 'static;

    // Required method
    fn from_message(
        s: Arc<Socket<A>>,
        v: Value,
        ack_id: Option<i64>,
    ) -> Result<Self, Self::Error>;
}
Expand description

A trait used to extract and consume arguments from the message event. The Result associated type is used to return an error if the extraction fails, in this case the handler is not called.

  • See the message module doc for more details on message handler.
  • See the extract module doc for more details on available extractors.

Required Associated Types§

Source

type Error: Error + 'static

The error type returned by the extractor

Required Methods§

Source

fn from_message( s: Arc<Socket<A>>, v: Value, ack_id: Option<i64>, ) -> Result<Self, Self::Error>

Extract the arguments from the message event. If it fails, the handler is not called

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§