Skip to main content

Reactor

Struct Reactor 

Source
pub struct Reactor<'l, C: Clock> { /* private fields */ }
Expand description

The reactor of one executor: registrations made by the futures it hands out.

Implementations§

Source§

impl<'l, C: Clock> Reactor<'l, C>

Source

pub fn new(clock: C) -> Self

An empty reactor reading clock.

Source

pub fn clock(&self) -> &C

The clock the reactor reads.

Source

pub fn ready( &self, desc: MemoryDescriptor<'l>, until: Option<MonoNs>, ) -> Ready<'_, 'l, C> ⓘ

A future that resolves true once desc completes, or false once the clock reads until first (no bound with None).

Source

pub fn pending(&self) -> (usize, usize)

Registered descriptors and timers (for a host’s counters and tests).

Source

pub fn turn<I: Idle>( &self, idle: &mut I, park_bound: DurNs, tasks_left: usize, ) -> Result<Turn>

The executor’s step when no task is ready (module docs).

§Errors

Stalled when nothing is registered: no store and no timer can ever wake the executor.

Source

pub fn fire(&self) -> bool

Wake every task whose descriptor completed or whose deadline passed, without idling; true if any was woken. The executor calls this between task polls, so a completion becomes ready work as soon as it lands, not only when the thread runs out of work.

Source§

impl<'l, C: Clock> Reactor<'l, C>

Source

pub fn alarm(&self, at: MonoNs) -> Alarmed<'_, 'l, C> ⓘ

A future that resolves once the clock reads at; the executor sleeps to the earliest one.

Trait Implementations§

Source§

impl<C: Clock> Clock for Reactor<'_, C>

Source§

fn monotonic_ns(&self) -> MonoNs

Monotonic nanoseconds from the host’s origin.
Source§

impl<C: Clock> Timer for Reactor<'_, C>

Source§

async fn sleep_until(&self, at: MonoNs)

Resolves once the host clock reads at or later.

Auto Trait Implementations§

§

impl<'l, C> !Freeze for Reactor<'l, C>

§

impl<'l, C> !RefUnwindSafe for Reactor<'l, C>

§

impl<'l, C> !Sync for Reactor<'l, C>

§

impl<'l, C> Forget for Reactor<'l, C>

§

impl<'l, C> Move for Reactor<'l, C>

§

impl<'l, C> Send for Reactor<'l, C>
where C: Send,

§

impl<'l, C> Unpin for Reactor<'l, C>
where C: Unpin,

§

impl<'l, C> UnsafeUnpin for Reactor<'l, C>
where C: UnsafeUnpin,

§

impl<'l, C> UnwindSafe for Reactor<'l, C>
where C: 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.