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§
Required Methods§
Sourcefn handle_message(
&mut self,
message: MessageCx,
cx: JrConnectionCx<Self::Role>,
) -> impl Future<Output = Result<Handled<MessageCx>, Error>> + Send
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.
Sourcefn describe_chain(&self) -> impl Debug
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.