Struct bitmaptrie::Trie [] [src]

pub struct Trie<T> {
    // some fields omitted
}

Path-cached bitmap trie.

Caveats for *_with_cache() functions: - no way to prevent a PathCache being used with the wrong MultiCacheTrie instance: safety fail - structure-modifying writes are more expensive due to cache invalidation

Methods

impl<T> Trie<T>
[src]

fn new() -> Trie<T>

Instantiate a new Trie, indexed by a usize integer and storing values of type T.

fn set(&mut self, index: usize, value: T) -> &mut T

Set an entry to a value, moving the new value into the trie. Updates the internal path cache to point at this index.

fn get_default_mut<F>(&mut self, index: usize, default: F) -> &mut T where F: Fn() -> T

Retrieve a mutable reference to the value at the given index. If the index does not have an associated value, call the default function to generate a value for that index and return the reference to it. Updates the internal path cache to point at this index.

fn get_mut(&mut self, index: usize) -> Option<&mut T>

Retrieve a mutable reference to the value at the given index. Updates the internal path cache to point at this index.

fn get(&self, index: usize) -> Option<&T>

Retrieve a reference to the value at the given index. Updates the internal path cache to point at this index.

fn remove(&mut self, index: usize) -> Option<T>

Remove an entry, returning the associated value. Invalidates the internal path cache from the depth of tree modification out to the leaf if anything was removed.

fn retain_if<F>(&mut self, f: F) where F: FnMut(usize, &mut T) -> bool

Retains only the elements specified by the predicate. Invalidates the cache entirely.

fn set_with_cache(&mut self, cache: &mut PathCache<T>, index: usize, value: T) -> &mut T

Set an entry to a value, accelerating access with the given cache, updating the cache with the new path. This function causes a new generation since it can possibly cause memory to move around.

fn get_mut_with_cache(&mut self, cache: &mut PathCache<T>, index: usize) -> Option<&mut T>

Retrieve a value, accelerating access with the given cache, updating the cache with the new path.

fn get_with_cache(&self, cache: &mut PathCache<T>, index: usize) -> Option<&T>

Retrieve a value, accelerating access with the given cache, updating the cache with the new path.

fn remove_with_cache(&mut self, cache: &mut PathCache<T>, index: usize) -> Option<T>

Remove an entry, accelerating access with the given cache, updating the cache with the new path. This function causes a new generation since it can cause memory to move around.

fn new_cache(&self) -> PathCache<T>

Create a new cache for this instance.

fn iter(&self) -> Iter<T>

Create an iterator over immutable data

fn iter_mut(&mut self) -> IterMut<T>

Create an iterator over mutable data

Trait Implementations

impl<T> Drop for Trie<T>
[src]

fn drop(&mut self)

A method called when the value goes out of scope. Read more

impl<T> Index<usize> for Trie<T>
[src]

type Output = T

The returned type after indexing

fn index(&self, index: usize) -> &T

The method for the indexing (Foo[Bar]) operation

impl<T> IndexMut<usize> for Trie<T>
[src]

fn index_mut(&mut self, index: usize) -> &mut T

The method for the indexing (Foo[Bar]) operation