Enum thespis_impl::MailboxEnd
source · pub enum MailboxEnd<A: Actor> {
Actor(A),
Mailbox(Mailbox<A>),
}
Expand description
Type returned to you by the mailbox when it ends. Await the JoinHandle returned by the executor to retrieve this.
Variants§
Actor(A)
When you get the Actor variant, you actor stopped because all addresses to it were dropped. You can however re-use this actor and spawn it on a new mailbox. Also beware if you count on it being dropped (eg. because it holds addresses to other mailboxes you want to shut down). You still need to drop it before it gets cleaned up.
Mailbox(Mailbox<A>)
When you get the Mailbox variant, your actor panicked. You can use this to supervise your actor. This allows you to instantiate a new actor and spawn it on the same mailbox. The message that caused the panic will be gone, but other message in the queue will be delivered and all the addresses to this mailbox remain valid.