pub struct LocalSpawner<'a, R>(/* private fields */)
where
R: RawMutex;
Expand description
Local spawner for an AllocExecutor
This can be used to spawn futures from the same thread as the executor.
Use a Spawner
to spawn futures from other threads.
Implementations§
Source§impl<'a, R> LocalSpawner<'a, R>where
R: RawMutex,
impl<'a, R> LocalSpawner<'a, R>where
R: RawMutex,
Sourcepub fn spawn_raw<F>(&mut self, future: F) -> Result<(), SpawnError>where
F: UnsafeFutureObj<'a, ()>,
pub fn spawn_raw<F>(&mut self, future: F) -> Result<(), SpawnError>where
F: UnsafeFutureObj<'a, ()>,
Spawn a FutureObj
into the corresponding AllocExecutor
Sourcepub fn spawn<F>(&mut self, future: F) -> Result<(), SpawnError>
pub fn spawn<F>(&mut self, future: F) -> Result<(), SpawnError>
Spawn a Future
into the corresponding AllocExecutor
While the lifetime on the Future is 'a
, unless you’re calling this on a
non-'static
Future
before the executor has started, you’re most
likely going to be stuck with the Spawn
trait’s 'static
bound.
Trait Implementations§
Source§impl<'a, R> Clone for LocalSpawner<'a, R>
impl<'a, R> Clone for LocalSpawner<'a, R>
Source§fn clone(&self) -> LocalSpawner<'a, R>
fn clone(&self) -> LocalSpawner<'a, R>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'a, R> From<LocalSpawner<'a, R>> for Spawner<'a, R>where
R: RawMutex,
impl<'a, R> From<LocalSpawner<'a, R>> for Spawner<'a, R>where
R: RawMutex,
Source§fn from(other: LocalSpawner<'a, R>) -> Self
fn from(other: LocalSpawner<'a, R>) -> Self
Converts to this type from the input type.
Source§impl<'a, R> LocalSpawn for LocalSpawner<'a, R>where
R: RawMutex,
impl<'a, R> LocalSpawn for LocalSpawner<'a, R>where
R: RawMutex,
Source§fn spawn_local_obj(
&self,
future: LocalFutureObj<'a, ()>,
) -> Result<(), SpawnError>
fn spawn_local_obj( &self, future: LocalFutureObj<'a, ()>, ) -> Result<(), SpawnError>
Spawns a future that will be run to completion. Read more
Source§fn status_local(&self) -> Result<(), SpawnError>
fn status_local(&self) -> Result<(), SpawnError>
Determines whether the executor is able to spawn new tasks. Read more
Auto Trait Implementations§
impl<'a, R> Freeze for LocalSpawner<'a, R>
impl<'a, R> !RefUnwindSafe for LocalSpawner<'a, R>
impl<'a, R> !Send for LocalSpawner<'a, R>
impl<'a, R> !Sync for LocalSpawner<'a, R>
impl<'a, R> Unpin for LocalSpawner<'a, R>
impl<'a, R> !UnwindSafe for LocalSpawner<'a, R>
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