[−][src]Function futures_delay_queue::delay_queue
pub fn delay_queue<T: 'static + Send>(
cap: usize
) -> (DelayQueue<T>, Receiver<T>)
Creates a delay queue and a multi consumer channel for receiving expired items.
The delay queue's underlying channel can buffer up to cap items internally.
However, depending upon the underlying channel cap might be ignored as there
are different types of ring buffers that can be used. This basically depends
on future-intrusive's generic channel. Therefor cap as buffersize is guaranteed,
but the delay queue might allow more items to be added than capacity.
Example
use futures_delay_queue::delay_queue; use std::time::Duration; let (delay_queue, expired_items) = delay_queue(1); delay_queue.insert(1, Duration::from_millis(10)); // approximately 10ms later assert_eq!(expired_items.receive().await, Some(1));