1use std::borrow::Borrow;
2use std::cmp::Eq;
3use std::hash::Hash;
45/// Abstracts the stack operations needed to track timeouts.
6pub(crate) trait Stack: Default {
7/// Type of the item stored in the stack
8type Owned: Borrow<Self::Borrowed>;
910/// Borrowed item
11type Borrowed: Eq + Hash;
1213/// Item storage, this allows a slab to be used instead of just the heap
14type Store;
1516/// Returns `true` if the stack is empty
17fn is_empty(&self) -> bool;
1819/// Push an item onto the stack
20fn push(&mut self, item: Self::Owned, store: &mut Self::Store);
2122/// Pop an item from the stack
23fn pop(&mut self, store: &mut Self::Store) -> Option<Self::Owned>;
2425/// Peek into the stack.
26fn peek(&self) -> Option<Self::Owned>;
2728fn remove(&mut self, item: &Self::Borrowed, store: &mut Self::Store);
2930fn when(item: &Self::Borrowed, store: &Self::Store) -> u64;
31}