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§
Source§impl SendSpawner
impl SendSpawner
Sourcepub fn for_current_executor() -> impl Future<Output = Self>
pub fn for_current_executor() -> impl Future<Output = Self>
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.
Sourcepub fn spawn<S: Send>(&self, token: SpawnToken<S>)
pub fn spawn<S: Send>(&self, token: SpawnToken<S>)
Spawn a task into an executor.
You obtain the token by calling a task function (i.e. one marked with #[hazard3_executor::task]).
Trait Implementations§
Source§impl Clone for SendSpawner
impl Clone for SendSpawner
impl Copy for SendSpawner
Auto Trait Implementations§
impl Forget for SendSpawner
impl Freeze for SendSpawnerwhere
&'static SyncExecutor: Freeze,
impl Move for SendSpawner
impl RefUnwindSafe for SendSpawner
impl Send for SendSpawnerwhere
&'static SyncExecutor: Send,
impl Sync for SendSpawner
impl Unpin for SendSpawnerwhere
&'static SyncExecutor: Unpin,
impl UnsafeUnpin for SendSpawnerwhere
&'static SyncExecutor: UnsafeUnpin,
impl UnwindSafe for SendSpawnerwhere
&'static SyncExecutor: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more