Trait fluxion::message::MessageSender
source · pub trait MessageSender<M: Message>: Send + Sync + 'static {
// Required method
fn request<'life0, 'async_trait>(
&'life0 self,
message: M
) -> Pin<Box<dyn Future<Output = Result<M::Response, SendError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
MessageSender
This trait allows sending messages to an actor without knowing the actor’s type.
This reverses the inversion done in inverted
, while still allowing different message types to be used.
Required Methods§
sourcefn request<'life0, 'async_trait>(
&'life0 self,
message: M
) -> Pin<Box<dyn Future<Output = Result<M::Response, SendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn request<'life0, 'async_trait>( &'life0 self, message: M ) -> Pin<Box<dyn Future<Output = Result<M::Response, SendError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Send a message to an actor, and wait for a response
Errors
Returns [SendError::NoResponse
] if no response was received.
Implementors§
impl<C: FluxionParams, A: Handler<C, M>, M: Message> MessageSender<M> for LocalHandle<C, A>
MessageSender<M>
is implemented on LocalHandle<A>
for every message for which A
implements Handler