pub enum ActorRunner {
    GlobalRuntime,
    DedicatedThread,
}
Expand description

The ActorRunner defines the environment in which an actor should be executed.

While all actor’s handlers have a asynchronous trait, some actor can be implemented to do some heavy blocking work and no rely on any asynchronous contructs.

In that case, they should simply rely on the DedicatedThread runner.

Variants

GlobalRuntime

Returns the actor as a tokio task running on the global runtime.

This is the most lightweight solution. Actor running on this runtime should not block for more than 50 microsecs.

DedicatedThread

Spawns a dedicated thread, a Tokio runtime, and rely on tokio::Runtime::block_on to run the actor loop.

This runner is suitable for actors that are heavily blocking.

Implementations

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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