roaring/treemap/mod.rs
1use crate::RoaringBitmap;
2use alloc::collections::BTreeMap;
3
4mod fmt;
5mod multiops;
6mod util;
7
8// Order of these modules matters as it determines the `impl` blocks order in
9// the docs
10mod arbitrary;
11mod cmp;
12mod inherent;
13mod iter;
14mod ops;
15#[cfg(feature = "serde")]
16mod serde;
17#[cfg(feature = "std")]
18mod serialization;
19
20pub use self::iter::{BitmapIter, IntoIter, Iter};
21
22/// A compressed bitmap with u64 values.
23/// Implemented as a `BTreeMap` of `RoaringBitmap`s.
24///
25/// # Examples
26///
27/// ```rust
28/// use roaring::RoaringTreemap;
29///
30/// let mut rb = RoaringTreemap::new();
31///
32/// // insert all primes less than 10
33/// rb.insert(2);
34/// rb.insert(3);
35/// rb.insert(5);
36/// rb.insert(7);
37/// println!("total bits set to true: {}", rb.len());
38/// ```
39#[derive(PartialEq)]
40pub struct RoaringTreemap {
41 map: BTreeMap<u32, RoaringBitmap>,
42}