pub struct Actor<T: 'static + Send>(_);
Expand description

Actor wrapping a state.

Cloning the actor provides an handle to the same actor.

Implementations

Creates a new Actor with default inbound channel capacity (1024).

Returned future must be spawned in an async executor.

Creates a new Actor with given capacity for its inbound channel.

Returned future must be spawned in an async executor.

Queue an async function on the state. The future that this function returns can hold the state across await points, meaning it will prevent other functions to be processed until the future is complete.

queue_blocking resolves once the order is sent to the actor, and doesn’t wait for it to be processed by the actor, but cannot have an output value.

To wait for the order to be processed and get an output, use query_blocking.

Queue a function on the state. It is more performant to have multiple queue/query in a row, as it can avoid using .await on the internal channel or on a future-based change (queue_blocking/query_blocking).

queue resolves once the order is sent to the actor, and doesn’t wait for it to be processed by the actor, but cannot have an output value.

To wait for the order to be processed and get an output, use query.

Queue an async function on the state. The future that this function returns can hold the state across await points, meaning it will prevent other functions to be processed until the future is complete.

query_blocking resolves once the order as been processed by the actor, which allows it to return an output.

If an output is not needed and it is not needed to wait for the order to be processed, use queue_blocking.

Queue a function on the state. It is more performant to have multiple queue/query in a row, as it can avoid using .await on the internal channel or on a future-based change (queue_blocking/query_blocking).

query_blocking resolves once the order as been processed by the actor, which allows it to return an output.

If an output is not needed and it is not needed to wait for the order to be processed, use queue_blocking.

Tells if the actor still accepts new invokes.

Stop the actor, which will process every already queued invokes before really stopping.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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.

Calls U::from(self).

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

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.