pub struct CurrentThreadExecutor<'a> { /* private fields */ }
Expand description
An Executor that doesn’t spawn new threads, just runs on the current thread.
Implementations§
Source§impl<'a> CurrentThreadExecutor<'a>
impl<'a> CurrentThreadExecutor<'a>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new CurrentThreadExecutor
Sourcepub fn submit<T: 'a, F: Future<Output = T> + 'a>(
&mut self,
fut: F,
) -> LocalTaskHandle<T>
pub fn submit<T: 'a, F: Future<Output = T> + 'a>( &mut self, fut: F, ) -> LocalTaskHandle<T>
Submit a new task to this executor. Note: This does not immediately run the task, you
still need to call either CurrentThreadExecutor::run_some
or
CurrentThreadExecutor::run_until_complete
Sourcepub fn run_some(&mut self)
pub fn run_some(&mut self)
Runs a single loop through the processing queue, in order, letting each task attempt to do work.
Sourcepub fn run_until_complete(&mut self)
pub fn run_until_complete(&mut self)
Runs this executor until all submitted tasks are complete.
Trait Implementations§
Source§impl<'a> Default for CurrentThreadExecutor<'a>
impl<'a> Default for CurrentThreadExecutor<'a>
Source§fn default() -> CurrentThreadExecutor<'a>
fn default() -> CurrentThreadExecutor<'a>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'a> Freeze for CurrentThreadExecutor<'a>
impl<'a> !RefUnwindSafe for CurrentThreadExecutor<'a>
impl<'a> !Send for CurrentThreadExecutor<'a>
impl<'a> !Sync for CurrentThreadExecutor<'a>
impl<'a> Unpin for CurrentThreadExecutor<'a>
impl<'a> !UnwindSafe for CurrentThreadExecutor<'a>
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