1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! # Overview
//!
//! This crate contains two data structures, [`HashSetDelay`] and [`HashMapDelay`]. These
//! behave like the standard library HashSet and HashMaps with the added feature that entries
//! inserted into the mappings expire after a fixed period of time.
//!
//!
//! # Usage
//!
//! ## Creating a map
//!
//! ```rust
//! use delay_map::HashMapDelay;
//! use futures::prelude::*;
//!
//! // Set a default timeout for entries
//! let mut delay_map = HashMapDelay::new(std::time::Duration::from_secs(1));
//!
//!
//! tokio_test::block_on(async {
//!
//! delay_map.insert(1, "entry_1");
//! delay_map.insert(2, "entry_2");
//!
//! if let Some(Ok((key, value))) = delay_map.next().await {
//! println!("Entry 1: {}, {}", key, value);
//! }
//!
//! if let Some(Ok((key, value))) = delay_map.next().await {
//! println!("Entry 2: {}, {}", key,value);
//! }
//! });
//! ```
pub use HashMapDelay;
pub use HashSetDelay;