some_local_executor

Struct Executor

Source
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>

Source

pub fn new() -> Self

Creates a new executor.

Source

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.

Source

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.

Source

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.

Source

pub fn has_unfinished_tasks(&self) -> bool

Returns true if there are tasks that are not yet complete.

Trait Implementations§

Source§

impl<'tasks> Debug for Executor<'tasks>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Executor<'_>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<&mut Executor<'_>> for SomeExecutorAdapter

Source§

fn from(executor: &mut Executor<'_>) -> Self

Converts to this type from the input type.
Source§

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.

Source§

type ExecutorNotifier = Infallible

Source§

fn spawn_local<F, Notifier: ObserverNotified<F::Output>>( &mut self, task: Task<F, Notifier>, ) -> Observer<F::Output, Self::ExecutorNotifier>
where Self: Sized, F: 'future + Future, <F as Future>::Output: Unpin,

Spawns a future onto the runtime. Read more
Source§

fn spawn_local_async<F, Notifier: ObserverNotified<F::Output>>( &mut self, task: Task<F, Notifier>, ) -> impl Future<Output = Observer<F::Output, Self::ExecutorNotifier>>
where Self: Sized, F: 'future + Future,

Spawns a future onto the runtime. Read more
Source§

fn spawn_local_objsafe( &mut self, task: Task<Pin<Box<dyn Future<Output = Box<dyn Any>>>>, Box<dyn ObserverNotified<dyn Any + 'static>>>, ) -> Observer<Box<dyn Any>, Box<dyn ExecutorNotified>>

Spawns a future onto the runtime. Read more
Source§

fn spawn_local_objsafe_async<'executor>( &'executor mut self, task: Task<Pin<Box<dyn Future<Output = Box<dyn Any>>>>, Box<dyn ObserverNotified<dyn Any + 'static>>>, ) -> Box<dyn Future<Output = Observer<Box<dyn Any>, Box<dyn ExecutorNotified>>> + 'executor>

Source§

fn executor_notifier(&mut self) -> Option<Self::ExecutorNotifier>

Source§

impl<'tasks> LocalExecutorExt<'tasks> for Executor<'tasks>

Auto Trait Implementations§

§

impl<'tasks> Freeze for Executor<'tasks>

§

impl<'tasks> !RefUnwindSafe for Executor<'tasks>

§

impl<'tasks> !Send for Executor<'tasks>

§

impl<'tasks> !Sync for Executor<'tasks>

§

impl<'tasks> Unpin for Executor<'tasks>

§

impl<'tasks> !UnwindSafe for Executor<'tasks>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.