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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! # Whirlwind
//!
//! A collection of data structures that allow for concurrent access to shared data.
//!
//! Currently, this crate provides the following data structures:
//!
//! - [`ShardMap`]: A concurrent hashmap using a sharding strategy.
//! - [`ShardSet`]: A concurrent set based on a [`ShardMap`] with values of `()`.
//!
//! ## ShardMap
//!
//! A concurrent hashmap using a sharding strategy.
//!
//! ### Example
//!
//! ```rust
//! use tokio::runtime::Runtime;
//! use std::sync::Arc;
//! use whirlwind::ShardMap;
//!
//! let rt = Runtime::new().unwrap();
//! let map = Arc::new(ShardMap::new());
//!
//! rt.block_on(async {
//! map.insert("foo", "bar").await;
//! assert_eq!(map.len().await, 1);
//! assert_eq!(map.contains_key(&"foo").await, true);
//! });
//! ```
//!
//! ## ShardSet
//!
//! A concurrent set based on a [`ShardMap`] with values of `()`.
//!
//! ### Example
//!
//! ```rust
//! use tokio::runtime::Runtime;
//! use std::sync::Arc;
//! use whirlwind::ShardSet;
//!
//! let rt = Runtime::new().unwrap();
//! let set = Arc::new(ShardSet::new());
//! rt.block_on(async {
//! set.insert("foo").await;
//! assert_eq!(set.contains(&"foo").await, true);
//! set.remove(&"foo").await;
//! assert_eq!(set.contains(&"foo").await, false);
//! assert_eq!(set.len().await, 0);
//! });
//! ```
//!
//!
//! See the documentation for each data structure for more information.
pub use ShardMap;
pub use ShardSet;