pub struct EventQueue { /* private fields */ }Expand description
A bounded, priority-ordered queue of MediaEvents.
Implementations§
Source§impl EventQueue
impl EventQueue
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
Create a new EventQueue with the given maximum capacity.
Sourcepub fn push(&mut self, event: MediaEvent) -> bool
pub fn push(&mut self, event: MediaEvent) -> bool
Push an event onto the queue.
Returns false if the queue is full (event is discarded).
Sourcepub fn pop(&mut self) -> Option<MediaEvent>
pub fn pop(&mut self) -> Option<MediaEvent>
Pop the highest-priority event from the queue.
Returns None if the queue is empty.
Sourcepub fn drain_high_priority(&mut self) -> Vec<MediaEvent>
pub fn drain_high_priority(&mut self) -> Vec<MediaEvent>
Drain all events with EventPriority::High or higher into a Vec.
The remaining events stay in the queue.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EventQueue
impl RefUnwindSafe for EventQueue
impl Send for EventQueue
impl Sync for EventQueue
impl Unpin for EventQueue
impl UnsafeUnpin for EventQueue
impl UnwindSafe for EventQueue
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