[][src]Struct toolshed::map::BloomMap

pub struct BloomMap<'arena, K, V> { /* 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>[src]

pub const fn new() -> Self[src]

Create a new, empty BloomMap.

impl<'arena, K, V: Copy> BloomMap<'arena, K, V>[src]

Important traits for MapIter<'arena, K, V>
pub fn iter(&self) -> MapIter<'arena, K, V>[src]

Get an iterator over key value pairs.

pub fn is_empty(&self) -> bool[src]

Returns true if the map contains no elements.

pub fn clear(&self)[src]

Clears the map.

impl<'arena, K, V> BloomMap<'arena, K, V> where
    K: Eq + Hash + Copy + AsRef<[u8]>,
    V: Copy
[src]

pub fn insert(&self, arena: &'arena Arena, key: K, value: V) -> Option<V>[src]

Inserts a key-value pair into the map. If the key was previously set, old value is returned.

pub fn get(&self, key: K) -> Option<V>[src]

Returns the value corresponding to the key.

pub fn contains_key(&self, key: K) -> bool[src]

Returns true if the map contains a value for the specified key.

Trait Implementations

impl<'a, 'b, KA, VA, KB, VB> PartialEq<BloomMap<'b, KB, VB>> for BloomMap<'a, KA, VA> where
    (&'a KA, VA): PartialEq<(&'b KB, VB)>,
    VA: Copy,
    VB: Copy
[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'arena, K: Clone, V: Clone> Clone for BloomMap<'arena, K, V>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'arena, K: Copy, V: Copy> Copy for BloomMap<'arena, K, V>[src]

impl<'arena, K, V> From<Map<'arena, K, V>> for BloomMap<'arena, K, V> where
    K: Eq + Hash + Copy + AsRef<[u8]>,
    V: Copy
[src]

impl<'arena, K, V> From<BloomMap<'arena, K, V>> for Map<'arena, K, V>[src]

impl<'arena, K, V: Copy> IntoIterator for BloomMap<'arena, K, V>[src]

type Item = (&'arena K, V)

The type of the elements being iterated over.

type IntoIter = MapIter<'arena, K, V>

Which kind of iterator are we turning this into?

impl<'arena, K, V> Debug for BloomMap<'arena, K, V> where
    K: Debug,
    V: Debug + Copy
[src]

Auto Trait Implementations

impl<'arena, K, V> Send for BloomMap<'arena, K, V>

impl<'arena, K, V> !Sync for BloomMap<'arena, K, V>

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]