Skip to main content

EventQueue

Struct EventQueue 

Source
pub struct EventQueue<E, const N: usize> { /* private fields */ }
Expand description

Allocation-free FIFO used for deferred and explicitly processed events.

Implementations§

Source§

impl<E, const N: usize> EventQueue<E, N>

Source

pub const fn new() -> Self

Creates an empty queue.

Source

pub const fn len(&self) -> usize

Returns the number of queued events.

Source

pub const fn is_empty(&self) -> bool

Returns true when no events are queued.

Source

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

Defers an event until events already in the queue have been processed.

Source

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

Schedules an event ahead of currently deferred events.

Source

pub fn pop(&mut self) -> Option<E>

Removes the next event.

Source

pub fn clear(&mut self)

Drops all queued events.

Trait Implementations§

Source§

impl<E, const N: usize> Default for EventQueue<E, N>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<E, const N: usize> Freeze for EventQueue<E, N>
where E: Freeze,

§

impl<E, const N: usize> RefUnwindSafe for EventQueue<E, N>
where E: RefUnwindSafe,

§

impl<E, const N: usize> Send for EventQueue<E, N>
where E: Send,

§

impl<E, const N: usize> Sync for EventQueue<E, N>
where E: Sync,

§

impl<E, const N: usize> Unpin for EventQueue<E, N>
where E: Unpin,

§

impl<E, const N: usize> UnsafeUnpin for EventQueue<E, N>
where E: UnsafeUnpin,

§

impl<E, const N: usize> UnwindSafe for EventQueue<E, N>
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.