Struct compact::CDict[][src]

pub struct CDict<K: Copy, V: Compact + Clone, A: Allocator = DefaultHeap> { /* fields omitted */ }

A simple linear-search key-value dictionary, implemented using two CompactVec's, one for keys, one for values.

The API loosely follows that of std::collections::HashMap. Spilling behaviour using Allocator is equivalent to CompactVec.

Methods

impl<K: Eq + Copy, V: Compact + Clone, A: Allocator> CompactDict<K, V, A>
[src]

Create new, empty dictionary

Create new, empty dictionary with a given capactity

Amount of entries in the dictionary

Is the dictionary empty?

Look up the value for key query, if it exists

Look up the value for keu query mutably, if it exists

Lookup up the value for key query, if it exists, but also swap the entry to the beginning of the key/value vectors, so a repeated lookup for that item will be faster

Lookup up the value for key query, if it exists, but also swap the entry one index towards the beginning of the key/value vectors, so frequently repeated lookups for that item will be faster

Does the dictionary contain a value for query?

Insert new value at key query and return the previous value at that key, if any existed

Remove value at key query and return it, if it existed

Important traits for Iter<'a, T>

Iterator over all keys in the dictionary

Important traits for Iter<'a, T>

Iterator over all values in the dictionary

Important traits for IterMut<'a, T>

Iterator over mutable references to all values in the dictionary

Iterator over all key-value pairs in the dictionary

impl<K: Eq + Copy, I: Compact, A1: Allocator, A2: Allocator> CompactDict<K, CompactVec<I, A1>, A2>
[src]

Push a value onto the CompactVec at the key query

Iterator over the CompactVec at the key query

Remove the CompactVec at the key query and iterate over its elements (if it existed)

Trait Implementations

impl<K: Copy, V: Compact + Clone, A: Allocator> Compact for CompactDict<K, V, A>
[src]

Is the object's dynamic part stored compactly?

Size of the dynamic part in bytes

Copy the static part of source to dest and compactly store the dynamic part of source as the new dynamic part of dest at new_dynamic_part. This semantically moves source into dest. Read more

Creates a clone of self with the dynamic part guaranteed to be stored freely. Read more

Total size of the object (static part + dynamic part)

Get a pointer to behind the static part of self (commonly used place for the dynamic part)

Like compact with new_dynamic_part set to dest.behind()

impl<K: Copy, V: Compact + Clone, A: Allocator> Clone for CompactDict<K, V, A>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<K: Copy + Eq, V: Compact + Clone, A: Allocator> Default for CompactDict<K, V, A>
[src]

Returns the "default value" for a type. Read more

impl<K: Copy + Eq, V: Compact + Clone, A: Allocator> FromIterator<(K, V)> for CompactDict<K, V, A>
[src]

Construct a compact dictionary from an interator over key-value pairs

impl<K: Copy + Eq, V: Compact + Clone, A: Allocator> Extend<(K, V)> for CompactDict<K, V, A>
[src]

Extend a compact dictionary from an iterator over key-value pairs

Auto Trait Implementations

impl<K, V, A = DefaultHeap> !Send for CDict<K, V, A>

impl<K, V, A = DefaultHeap> !Sync for CDict<K, V, A>