Struct toolshed::map::BloomMap
[−]
[src]
pub struct BloomMap<'arena, K: 'arena, V: 'arena + Copy> { /* fields omitted */ }
A variant of the Map
that includes a bloom filter using the
bloom
function for keys that can be represented as byte slices.
This is ideal for small maps for which querying for absent keys is
a common behavior. In this case it will very likely outperform a
HashMap
, even one with a fast hashing algorithm.
Methods
impl<'arena, K, V> BloomMap<'arena, K, V> where
K: Eq + Hash + Copy + AsRef<[u8]>,
V: Copy,
[src]
K: Eq + Hash + Copy + AsRef<[u8]>,
V: Copy,
fn new() -> Self
[src]
Create a new, empty BloomMap
.
fn insert(&self, arena: &'arena Arena, key: K, value: V)
[src]
Inserts a key-value pair into the map.
fn get(&self, key: K) -> Option<V>
[src]
Returns the value corresponding to the key.
fn contains_key(&self, key: K) -> bool
[src]
Returns true if the map contains a value for the specified key.
fn is_empty(&self) -> bool
[src]
Returns true if the map contains no elements.
fn clear(&self)
[src]
Clears the map.