Struct Executor

Source
pub struct Executor<I, F> { /* private fields */ }
Available on crate feature executor only.
Expand description

Task executor for a single 'static future.

This provides a polling interface for a Future running on an interrupt handler. If the provided Waker is woken, the executor will pend the provided interrupt with Interrupt::pend.

Executors must be static for use with the waker and Pin support.

use async_hal::Executor;

static mut EXECUTOR: Executor<(), ()> = Executor::new(());

Implementations§

Source§

impl<I, F> Executor<I, F>

Source

pub const fn new(interrupt: I) -> Self

Create a new empty executor.

Source

pub fn spawn(&self, future: F) -> Result<(), F>

Spawn a single Future on the executor. This method returns Ok(()) if the executor was empty and Err(value) if it was full.

Source

pub fn poll(&'static self) -> Poll<F::Output>
where I: Interrupt, F: Future,

Poll the current Future on the executor.

Trait Implementations§

Source§

impl<I: Interrupt, F> Interrupt for Executor<I, F>

Source§

fn pend(&self)

Auto Trait Implementations§

§

impl<I, F> !Freeze for Executor<I, F>

§

impl<I, F> !RefUnwindSafe for Executor<I, F>

§

impl<I, F> Send for Executor<I, F>
where I: Send, F: Send,

§

impl<I, F> !Sync for Executor<I, F>

§

impl<I, F> Unpin for Executor<I, F>
where I: Unpin, F: Unpin,

§

impl<I, F> UnwindSafe for Executor<I, F>
where I: UnwindSafe, F: UnwindSafe,

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.