pub fn with_capacity(capacity: usize) -> DelayQueue<T> {
        DelayQueue {
            wheel: Wheel::new(),
            slab: Slab::with_capacity(capacity),
            expired: Stack::default(),
            delay: None,
            wheel_now: 0,
            start: Instant::now(),
            waker: None,
        }
    }
/// Creates a new, empty, `DelayQueue` with the specified capacity.
///
/// The queue will be able to hold at least `capacity` elements without
/// reallocating. If `capacity` is 0, the queue will not allocate for
/// storage.
///
/// # Examples
///
/// ```rust
/// # use tokio_util::time::DelayQueue;
/// # use std::time::Duration;
///
/// # #[tokio::main]
/// # async fn main() {
/// let mut delay_queue = DelayQueue::with_capacity(10);
///
/// // These insertions are done without further allocation
/// for i in 0..10 {
///     delay_queue.insert(i, Duration::from_secs(i));
/// }
///
/// // This will make the queue allocate additional storage
/// delay_queue.insert(11, Duration::from_secs(11));
/// # }
/// ```
Creates a new, empty, `DelayQueue` with the specified capacity.
The queue will be able to hold at least `capacity` elements without
reallocating. If `capacity` is 0, the queue will not allocate for
storage.
Creates a new empty ` DelayQueue ` with the specified capacity . The queue will be able to hold at least ` capacity ` elements without reallocating . If ` capacity ` is 0 the queue will not allocate for storage .
pub fn with_capacity(capacity: usize) -> DelayQueue<T> {
        DelayQueue {
            wheel: Wheel::new(),
            slab: Slab::with_capacity(capacity),
            expired: Stack::default(),
            delay: None,
            wheel_now: 0,
            start: Instant::now(),
            waker: None,
        }
    }
pub fn with_capacity ( capacity : usize ) -> DelayQueue < T > { DelayQueue { wheel : Wheel :: new ( ) , slab : Slab :: with_capacity ( capacity ) , expired : Stack :: default ( ) , delay : None , wheel_now : 0 , start : Instant :: now ( ) , waker : None , } }
Creates a new, empty, `DelayQueue` with the specified capacity.
Creates a new empty ` DelayQueue ` with the specified capacity .
capacity
usize
examples
None
use tokio_util::time::delayqueue;
None
use std::time::duration;
None
#[tokio::main]
None
async fn main() {
let mut delay_queue = DelayQueue::with_capacity(10).

These insertions are done without further allocation
for i in 0..10 {
delay_queue.insert(i, Duration::from_secs(i));
}

This will make the queue allocate additional storage
delay_queue.insert(11, Duration::from_secs(11)).
let mut delay_queue = DelayQueue :: with_capacity ( 10 ) . These insertions are done without further allocation for i in 0 .. 10 { delay_queue . insert ( i Duration :: from_secs ( i )) ; } This will make the queue allocate additional storage delay_queue . insert ( 11 Duration :: from_secs ( 11 )) .
}
None