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§

source

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§

source§

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

source§

impl<S: MessageSerializer, M: Message<Response = R> + Serialize, R: for<'a> Deserialize<'a>> MessageSender<M> for ForeignHandle<S>