Trait near_async::messaging::CanSendAsync
source · pub trait CanSendAsync<M, R>: Send + Sync + 'static {
// Required method
fn send_async(&self, message: M) -> BoxFuture<'static, R>;
}
Expand description
Allows the sending of a message while expecting a response.
Required Methods§
fn send_async(&self, message: M) -> BoxFuture<'static, R>
Implementations on Foreign Types§
source§impl<M, A> CanSendAsync<M, Result<<M as Message>::Result, ()>> for Addr<A>where
M: Message + Send + 'static,
M::Result: Send,
A: Actor + Handler<M>,
A::Context: ToEnvelope<A, M>,
impl<M, A> CanSendAsync<M, Result<<M as Message>::Result, ()>> for Addr<A>where M: Message + Send + 'static, M::Result: Send, A: Actor + Handler<M>, A::Context: ToEnvelope<A, M>,
An actix Addr implements CanSendAsync for any message type that the actor handles. Here, the future output of send_async is a Result, because Actix may return an error. The error is converted to (), so that the caller does not need to be aware of Actix-specific error messages.
Implementors§
impl<A: AsRef<AsyncSender<M, R>> + Send + Sync + 'static, M: 'static, R: 'static> CanSendAsync<M, R> for A
impl<M, R, S: CanSendAsync<M, R>> CanSendAsync<M, R> for LateBoundSender<S>
Allows LateBoundSender to be convertible to an AsyncSender as long as the inner object could be.