pub struct TickQueue { /* private fields */ }Expand description
A tick queue with a policy. Bounded — never grows unboundedly.
Implementations§
Source§impl TickQueue
impl TickQueue
Sourcepub fn new(policy: TickPolicy) -> Self
pub fn new(policy: TickPolicy) -> Self
Creates a new TickQueue.
Sourcepub fn enqueue(&mut self, tick: TickEvent)
pub fn enqueue(&mut self, tick: TickEvent)
Enqueue a tick. If a tick is already pending, the policy determines what happens.
Sourcepub fn dequeue(&mut self) -> TickDecision
pub fn dequeue(&mut self) -> TickDecision
Dequeue the next tick to process. Returns a TickDecision describing what happened.
Sourcepub fn total_dropped(&self) -> u64
pub fn total_dropped(&self) -> u64
Total ticks dropped since the queue was created.
Sourcepub fn total_processed(&self) -> u64
pub fn total_processed(&self) -> u64
Total ticks processed.
Sourcepub fn has_pending(&self) -> bool
pub fn has_pending(&self) -> bool
Is there a pending tick?
Sourcepub fn policy(&self) -> TickPolicy
pub fn policy(&self) -> TickPolicy
The current policy.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TickQueue
impl RefUnwindSafe for TickQueue
impl Send for TickQueue
impl Sync for TickQueue
impl Unpin for TickQueue
impl UnsafeUnpin for TickQueue
impl UnwindSafe for TickQueue
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