util: add shrink_to_fit and compact methods to DelayQueue (#4170)

This commit is contained in:
b-naber
2022-01-09 12:41:30 +01:00
committed by GitHub
parent ac2343d984
commit c800deaacc
5 changed files with 503 additions and 39 deletions
+1
View File
@@ -6,6 +6,7 @@ mod stack;
pub(crate) use self::stack::Stack;
use std::borrow::Borrow;
use std::fmt::Debug;
use std::usize;
/// Timing wheel implementation.
+3 -1
View File
@@ -1,4 +1,6 @@
use std::borrow::Borrow;
use std::cmp::Eq;
use std::hash::Hash;
/// Abstracts the stack operations needed to track timeouts.
pub(crate) trait Stack: Default {
@@ -6,7 +8,7 @@ pub(crate) trait Stack: Default {
type Owned: Borrow<Self::Borrowed>;
/// Borrowed item
type Borrowed;
type Borrowed: Eq + Hash;
/// Item storage, this allows a slab to be used instead of just the heap
type Store;