pub struct TypedMailbox<A: Actor + Send + Sync> { /* private fields */ }Expand description
Concrete Mailbox for a specific actor type A. Holds the channel
sender to the actor’s run loop and performs the type-safe downcast on
each send. Constructed in Actor::run_actor and erased to
Arc<dyn Mailbox> for storage in the system’s actor map.
Implementations§
Trait Implementations§
Source§impl<A> Mailbox for TypedMailbox<A>
impl<A> Mailbox for TypedMailbox<A>
Source§fn send<'life0, 'async_trait>(
&'life0 self,
msg: Arc<dyn Any + Send + Sync>,
) -> Pin<Box<dyn Future<Output = Result<(), ActorError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 self,
msg: Arc<dyn Any + Send + Sync>,
) -> Pin<Box<dyn Future<Output = Result<(), ActorError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Fire-and-forget send. Downcast the payload to
A::Message and push
it onto the actor’s mpsc channel.Source§fn send_and_recv<'life0, 'async_trait>(
&'life0 self,
msg: Arc<dyn Any + Send + Sync>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Any + Send>, ActorError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_and_recv<'life0, 'async_trait>(
&'life0 self,
msg: Arc<dyn Any + Send + Sync>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Any + Send>, ActorError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send and await the actor’s reply. The reply is returned as a boxed
Any; the caller downcasts to A::Result.Auto Trait Implementations§
impl<A> Freeze for TypedMailbox<A>
impl<A> RefUnwindSafe for TypedMailbox<A>
impl<A> Send for TypedMailbox<A>
impl<A> Sync for TypedMailbox<A>
impl<A> Unpin for TypedMailbox<A>
impl<A> UnsafeUnpin for TypedMailbox<A>
impl<A> UnwindSafe for TypedMailbox<A>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more