pub struct ActorContext<A: Actor> { /* private fields */ }

Implementations

This function returns a guard that prevents any supervisor from identifying the actor as dead. The protection ends when the ProtectZoneGuard is dropped.

In an ideal world, you should never need to call this function. It is only useful in some corner cases, like calling a long blocking from an external library that you trust.

Gets a copy of the actor kill switch. This should rarely be used.

For instance, when quitting from the process_message function, prefer simply returning Error(ActorExitStatus::Failure(..))

Records some progress. This function is only useful when implementing actors that may take more than HEARTBEAT to process a single message. In that case, you can call this function in the middle of the process_message method to prevent the actor from being identified as blocked or dead.

Posts a message in an actor’s mailbox.

This method does not wait for the message to be handled by the target actor. However, it returns a oneshot receiver that the caller that makes it possible to .await it. If the reply is important, chances are the .ask(...) method is more indicated.

Droppping the receiver channel will not cancel the processing of the messsage. It is a very common usage. In fact most actors are expected to send message in a fire-and-forget fashion.

Regular messages (as opposed to commands) are queued and guaranteed to be processed in FIFO order.

This method hides logic to prevent an actor from being identified as frozen if the destination actor channel is saturated, and we are simply experiencing back pressure.

Similar to send_message, except this method waits asynchronously for the actor reply.

Send the Success message to terminate the destination actor with the Success exit status.

The message is queued like any regular message, so that pending messages will be processed first.

async version of send_self_message.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

The resulting type after dereferencing.

Dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more