[][src]Struct smallmap::Map

pub struct Map<TKey, TValue>(_);

A small hashtable-like map with byte sized key indecies.

Implementations

impl<K, V> Map<K, V> where
    K: Collapse
[src]

pub fn entry(&mut self, key: K) -> Entry<'_, K, V>[src]

pub fn clean(&mut self)[src]

Remove all empty pages from this instance.

pub fn len(&self) -> usize[src]

The number of entries currently in this map

This is an iterating count over all slots in all current pages, if possible store it in a temporary instead of re-calling it.

pub fn num_pages(&self) -> usize[src]

The number of pages currently in this map

pub fn into_pages(self) -> Vec<Page<K, V>>[src]

Consume the instance, returning all pages.

pub fn pages(&self) -> Pages<'_, K, V>

Notable traits for Pages<'a, K, V>

impl<'a, K, V> Iterator for Pages<'a, K, V> type Item = &'a Page<K, V>;
[src]

An iterator over all pages

pub fn pages_mut(&mut self) -> PagesMut<'_, K, V>

Notable traits for PagesMut<'a, K, V>

impl<'a, K, V> Iterator for PagesMut<'a, K, V> type Item = &'a mut Page<K, V>;
[src]

A mutable iterator over all pages

pub fn iter(&self) -> Iter<'_, K, V>

Notable traits for Iter<'a, K, V>

impl<'a, K, V> Iterator for Iter<'a, K, V> where
    K: Collapse
type Item = &'a (K, V);
[src]

An iterator over all elements in the map

pub fn iter_mut(&mut self) -> IterMut<'_, K, V>

Notable traits for IterMut<'a, K, V>

impl<'a, K, V> Iterator for IterMut<'a, K, V> where
    K: Collapse
type Item = &'a mut (K, V);
[src]

A mutable iterator over all elements in the map

pub fn new() -> Self[src]

Create a new empty Map

pub fn with_capacity(pages: usize) -> Self[src]

Create a new empty Map with a specific number of pages pre-allocated

pub fn get_mut<Q: ?Sized>(&mut self, key: &Q) -> Option<&mut V> where
    K: Borrow<Q>,
    Q: Collapse + Eq
[src]

Get a mutable reference of the value corresponding to this key if it is in the map.

pub fn contains_key<Q: ?Sized>(&self, key: &Q) -> bool where
    K: Borrow<Q>,
    Q: Collapse + Eq
[src]

Search the map for entry corresponding to this key

pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&V> where
    K: Borrow<Q>,
    Q: Collapse + Eq
[src]

Get a reference of the value corresponding to this key if it is in the map.

pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<V> where
    K: Borrow<Q>,
    Q: Collapse + Eq
[src]

Remove the entry corresponding to this key in the map, returning the value if it was present

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

Insert a new key-value entry into this map, returning the pervious value if it was present

Trait Implementations

impl<TKey: Clone, TValue: Clone> Clone for Map<TKey, TValue>[src]

impl<TKey: Debug, TValue: Debug> Debug for Map<TKey, TValue>[src]

impl<TKey: Default, TValue: Default> Default for Map<TKey, TValue>[src]

impl<TKey: Eq, TValue: Eq> Eq for Map<TKey, TValue>[src]

impl<TKey: Hash, TValue: Hash> Hash for Map<TKey, TValue>[src]

impl<K: Collapse, V> IntoIterator for Map<K, V>[src]

type Item = (K, V)

The type of the elements being iterated over.

type IntoIter = IntoIter<K, V>

Which kind of iterator are we turning this into?

fn into_iter(self) -> Self::IntoIter[src]

Consume this map into an iterator over all currently inserted entries

impl<TKey: PartialEq, TValue: PartialEq> PartialEq<Map<TKey, TValue>> for Map<TKey, TValue>[src]

impl<TKey, TValue> StructuralEq for Map<TKey, TValue>[src]

impl<TKey, TValue> StructuralPartialEq for Map<TKey, TValue>[src]

Auto Trait Implementations

impl<TKey, TValue> RefUnwindSafe for Map<TKey, TValue> where
    TKey: RefUnwindSafe,
    TValue: RefUnwindSafe

impl<TKey, TValue> Send for Map<TKey, TValue> where
    TKey: Send,
    TValue: Send

impl<TKey, TValue> Sync for Map<TKey, TValue> where
    TKey: Sync,
    TValue: Sync

impl<TKey, TValue> Unpin for Map<TKey, TValue> where
    TKey: Unpin,
    TValue: Unpin

impl<TKey, TValue> UnwindSafe for Map<TKey, TValue> where
    TKey: UnwindSafe,
    TValue: UnwindSafe

Blanket Implementations

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

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

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

impl<T> Collapse for T where
    T: Eq + Hash
[src]

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

impl<T, U> Into<U> for T where
    U: From<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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.