Skip to main content

MessageReply

Trait MessageReply 

Source
pub trait MessageReply: Sized + Sealed {
    type Reply;

    // Required method
    fn receive(
        self,
    ) -> impl Future<Output = Result<Self::Reply, RxError>> + Send;

    // Provided method
    fn receive_blocking(self) -> Result<Self::Reply, RxError> { ... }
}
Expand description

A trait for types that can be used as the output of a Message.

This trait is sealed and cannot be implemented outside of this crate. It is implemented for Rx<T> and (), which are the output types of request and fire-and-forget messages, respectively.

Required Associated Types§

Source

type Reply

The reply type of the message.

Required Methods§

Source

fn receive(self) -> impl Future<Output = Result<Self::Reply, RxError>> + Send

Receive the reply of the message.

Provided Methods§

Source

fn receive_blocking(self) -> Result<Self::Reply, RxError>

Same as Self::receive, but blocks the current thread until the reply is received.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl MessageReply for ()

Source§

type Reply = ()

Source§

async fn receive(self) -> Result<Self::Reply, RxError>

Implementors§

Source§

impl<T> MessageReply for Rx<T>
where T: Send + 'static,

Source§

type Reply = T