pub struct SendSpawner { /* private fields */ }
Expand description

Handle to spawn tasks into an executor from any thread.

This Spawner can be used from any thread (it is Send), but it can only spawn Send tasks. The reason for this is spawning is effectively “sending” the tasks to the executor thread.

If you want to spawn non-Send tasks, use Spawner.

Implementations

Get a Spawner for the current executor.

This function is async just to get access to the current async context. It returns instantly, it does not block/yield.

Panics

Panics if the current executor is not an Embassy executor.

Spawn a task into an executor.

You obtain the token by calling a task function (i.e. one marked with #[embassy_executor::task]).

Spawn a task into an executor, panicking on failure.

Panics

Panics if the spawning fails.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. 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.

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.