Skip to main content

SendsExt

Trait SendsExt 

Source
pub trait SendsExt<T: Message>: Sends<T> {
    // Provided methods
    fn request(
        &self,
        msg: T,
    ) -> impl Future<Output = Result<Reply<T>, RequestError<T>>> + Send + '_ { ... }
    fn request_blocking(&self, msg: T) -> Result<Reply<T>, RequestError<T>> { ... }
}
Expand description

Extension trait for Sends.

Provided Methods§

Source

fn request( &self, msg: T, ) -> impl Future<Output = Result<Reply<T>, RequestError<T>>> + Send + '_

Sends a message of type T to the inbox and waits for a reply, if the message type has a reply type.

This is equivalent to calling Sends::send and then MessageReply::receive.

Source

fn request_blocking(&self, msg: T) -> Result<Reply<T>, RequestError<T>>

Same as SendsExt::request, 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".

Implementors§

Source§

impl<T: Message, S: Sends<T>> SendsExt<T> for S