pub trait LocalSpawner {
// Required method
fn spawn_local<F>(&self, task: F) -> Result<(), SpawnError>
where F: Future<Output = ()> + 'static;
}Expand description
Runs a task that is not Send in the background, on a single-threaded executor.
Use it with the *_local_on methods of Deferred. The same
requirements as Spawner apply.
§Embassy
Use embassy_spawner! to declare a LocalSpawner for embassy.
Required Methods§
Sourcefn spawn_local<F>(&self, task: F) -> Result<(), SpawnError>
fn spawn_local<F>(&self, task: F) -> Result<(), SpawnError>
Runs task in the background.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl LocalSpawner for LocalSet
Available on crate feature tokio only.Spawns on this LocalSet. The task only makes progress while the LocalSet is run.
impl LocalSpawner for LocalSet
Available on crate feature
tokio only.Spawns on this LocalSet. The task only makes progress while the LocalSet is run.
fn spawn_local<F>(&self, task: F) -> Result<(), SpawnError>
Source§impl<'a> LocalSpawner for LocalExecutor<'a>
Available on crate feature smol only.Spawns on this smol local executor. The task only makes progress while the executor
is run.
impl<'a> LocalSpawner for LocalExecutor<'a>
Available on crate feature
smol only.Spawns on this smol local executor. The task only makes progress while the executor is run.
fn spawn_local<F>(&self, task: F) -> Result<(), SpawnError>
Source§impl<S: LocalSpawner + ?Sized> LocalSpawner for &S
impl<S: LocalSpawner + ?Sized> LocalSpawner for &S
fn spawn_local<F>(&self, task: F) -> Result<(), SpawnError>
Source§impl<S: LocalSpawner + ?Sized> LocalSpawner for &mut S
impl<S: LocalSpawner + ?Sized> LocalSpawner for &mut S
fn spawn_local<F>(&self, task: F) -> Result<(), SpawnError>
Source§impl<S: LocalSpawner + ?Sized> LocalSpawner for Arc<S>
Available on target_has_atomic=ptr and crate feature alloc only.
impl<S: LocalSpawner + ?Sized> LocalSpawner for Arc<S>
Available on
target_has_atomic=ptr and crate feature alloc only.fn spawn_local<F>(&self, task: F) -> Result<(), SpawnError>
Source§impl<S: LocalSpawner + ?Sized> LocalSpawner for Box<S>
Available on crate feature alloc only.
impl<S: LocalSpawner + ?Sized> LocalSpawner for Box<S>
Available on crate feature
alloc only.fn spawn_local<F>(&self, task: F) -> Result<(), SpawnError>
Source§impl<S: LocalSpawner + ?Sized> LocalSpawner for Rc<S>
Available on crate feature alloc only.
impl<S: LocalSpawner + ?Sized> LocalSpawner for Rc<S>
Available on crate feature
alloc only.