pub struct EventQueue<T> { /* private fields */ }Expand description
Thread-safe in-memory FIFO event queue.
Implementations§
Source§impl<T> EventQueue<T>
impl<T> EventQueue<T>
Sourcepub fn push(&self, e: T) -> Result<(), EventQueueError>
pub fn push(&self, e: T) -> Result<(), EventQueueError>
Pushes an event to the back of the queue and wakes one waiter.
Sourcepub fn push_front(&self, e: T) -> Result<(), EventQueueError>
pub fn push_front(&self, e: T) -> Result<(), EventQueueError>
Pushes an event to the front of the queue and wakes one waiter.
Sourcepub fn poll(&self) -> Result<Option<T>, EventQueueError>
pub fn poll(&self) -> Result<Option<T>, EventQueueError>
Waits briefly for an event, then returns the next event if one is available.
Sourcepub fn pop(&self) -> Result<Option<T>, EventQueueError>
pub fn pop(&self) -> Result<Option<T>, EventQueueError>
Returns the next event immediately, or None if the queue is empty.
Sourcepub fn len(&self) -> Result<usize, EventQueueError>
pub fn len(&self) -> Result<usize, EventQueueError>
Returns the number of events currently in the queue.
Sourcepub fn is_empty(&self) -> Result<bool, EventQueueError>
pub fn is_empty(&self) -> Result<bool, EventQueueError>
Returns whether the queue currently contains no events.
Trait Implementations§
Source§impl<T: Debug> Debug for EventQueue<T>
impl<T: Debug> Debug for EventQueue<T>
Source§impl<T: Default> Default for EventQueue<T>
impl<T: Default> Default for EventQueue<T>
Source§fn default() -> EventQueue<T>
fn default() -> EventQueue<T>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<T> Freeze for EventQueue<T>
impl<T> RefUnwindSafe for EventQueue<T>
impl<T> Send for EventQueue<T>where
T: Send,
impl<T> Sync for EventQueue<T>where
T: Send,
impl<T> Unpin for EventQueue<T>
impl<T> UnsafeUnpin for EventQueue<T>
impl<T> UnwindSafe for EventQueue<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more