JrMessageHandlerSend

Trait JrMessageHandlerSend 

Source
pub trait JrMessageHandlerSend: Send {
    type Role: JrRole;

    // Required methods
    fn handle_message(
        &mut self,
        message: MessageCx,
        cx: JrConnectionCx<Self::Role>,
    ) -> impl Future<Output = Result<Handled<MessageCx>, Error>> + Send;
    fn describe_chain(&self) -> impl Debug;
}
Expand description

A version of JrMessageHandler where the handle_message code is required to be Send; any type implementing this trait must also implement JrMessageHandler.

If you are implementing JrMessageHandler explicitly, as opposed to using helper methods like JrConnectionBuilder::on_receive_message, then it is better to implement this Send trait when possible.

Required Associated Types§

Source

type Role: JrRole

The role type for this handler’s connection.

Required Methods§

Source

fn handle_message( &mut self, message: MessageCx, cx: JrConnectionCx<Self::Role>, ) -> impl Future<Output = Result<Handled<MessageCx>, Error>> + Send

Returns a (sendable) future that will potentially handle the message. The Handled return value indicates whether the message was handled or not. If the message was not handled, it may have been modified, and the modified message (and return cx) should be used from that point forward.

Source

fn describe_chain(&self) -> impl Debug

Describe this handler chain.

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§