Skip to main content

EventQueues

Struct EventQueues 

Source
pub struct EventQueues<E, const DEFERRED: usize, const PROCESSED: usize> { /* private fields */ }
Expand description

Separate bounded queues for deferred events and events requested by actions.

Implementations§

Source§

impl<E, const DEFERRED: usize, const PROCESSED: usize> EventQueues<E, DEFERRED, PROCESSED>

Source

pub const fn new() -> Self

Creates empty queues.

Source

pub fn defer(&mut self, event: E) -> Result<(), QueueFull>

Defers an event until a dispatch changes state.

Source

pub fn process(&mut self, event: E) -> Result<(), QueueFull>

Schedules an event for immediate processing after the current action.

Source

pub const fn deferred_len(&self) -> usize

Returns the number of deferred events.

Source

pub const fn processed_len(&self) -> usize

Returns the number of immediately processed events.

Source

pub fn dispatch<M, F>( &mut self, machine: &mut M, event: E, dispatch: F, ) -> DispatchSummary
where F: FnMut(&mut M, &mut Self, E) -> DispatchStatus,

Dispatches an external event, drains action-requested events, and gives each previously deferred event one retry after a state change.

Trait Implementations§

Source§

impl<E, const DEFERRED: usize, const PROCESSED: usize> Default for EventQueues<E, DEFERRED, PROCESSED>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<E, const DEFERRED: usize, const PROCESSED: usize> Freeze for EventQueues<E, DEFERRED, PROCESSED>
where E: Freeze,

§

impl<E, const DEFERRED: usize, const PROCESSED: usize> RefUnwindSafe for EventQueues<E, DEFERRED, PROCESSED>
where E: RefUnwindSafe,

§

impl<E, const DEFERRED: usize, const PROCESSED: usize> Send for EventQueues<E, DEFERRED, PROCESSED>
where E: Send,

§

impl<E, const DEFERRED: usize, const PROCESSED: usize> Sync for EventQueues<E, DEFERRED, PROCESSED>
where E: Sync,

§

impl<E, const DEFERRED: usize, const PROCESSED: usize> Unpin for EventQueues<E, DEFERRED, PROCESSED>
where E: Unpin,

§

impl<E, const DEFERRED: usize, const PROCESSED: usize> UnsafeUnpin for EventQueues<E, DEFERRED, PROCESSED>
where E: UnsafeUnpin,

§

impl<E, const DEFERRED: usize, const PROCESSED: usize> UnwindSafe for EventQueues<E, DEFERRED, PROCESSED>
where E: 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.