pub struct Executor<'tasks> { /* private fields */ }Expand description
The main executor type.
The lifetime parameter 'tasks is the lifetime of the tasks that are spawned on this executor, that is
the lifetime of any data they may borrow, in case they are spawned with a reference to that data.
Implementations§
Source§impl<'tasks> Executor<'tasks>
impl<'tasks> Executor<'tasks>
Sourcepub fn do_some(&mut self)
pub fn do_some(&mut self)
Runs the executor until there is no more immediate work to be performed.
It is intended ot be called in a loop with Self::park_if_needed.
Sourcepub fn park_if_needed(&mut self)
pub fn park_if_needed(&mut self)
Parks the thread if there are no tasks to be performed, until tasks are ready to be performed again.
Sourcepub fn drain(self)
pub fn drain(self)
Drains the executor. After this call, the executor can no longer be used.
This function will return when all spawned tasks complete.
Sourcepub fn has_unfinished_tasks(&self) -> bool
pub fn has_unfinished_tasks(&self) -> bool
Returns true if there are tasks that are not yet complete.
Trait Implementations§
Source§impl From<&mut Executor<'_>> for SomeExecutorAdapter
impl From<&mut Executor<'_>> for SomeExecutorAdapter
Source§impl<'future> SomeLocalExecutor<'future> for Executor<'future>
impl<'future> SomeLocalExecutor<'future> for Executor<'future>
Implementation of the SomeLocalExecutor trait from the some_executor project.
This is the main interface to spawn tasks onto the executor.
For details on this trait, see SomeLocalExecutor.