pub struct AATreeMap<K, V> { /* private fields */ }

Implementations

Returns a reference to the value corresponding to the key.

Example
let mut map = AATreeMap::new();
map.insert(1, "a");
assert_eq!(map.get(&1), Some(&"a"));
assert_eq!(map.get(&2), None);

Returns a reference to the key and value corresponding to the key.

Example
let mut map = AATreeMap::new();
map.insert(1, "a");
assert_eq!(map.get_key_value(&1), Some((&1, &"a")));
assert_eq!(map.get_key_value(&2), None);

Returns a mutable reference to the value corresponding to the key.

Example
let mut map = AATreeMap::new();
map.insert(1, "a");
assert_eq!(map.get(&1), Some(&"a"));
*map.get_mut(&1).unwrap() = "b";
assert_eq!(map.get(&1), Some(&"b"));

Returns a reference to the first entry (that is, with the smallest key) in the map.

Example
let mut map = AATreeMap::new();
assert_eq!(map.first_key_value(), None);
map.insert(3, "a");
map.insert(1, "b");
map.insert(2, "c");
assert_eq!(map.first_key_value(), Some((&1, &"b")));
👎 Deprecated since 0.1.1:

Use first_key_value() instead

Returns and removes the first entry (that is, with the smallest key) in the map.

Example
let mut map = AATreeMap::new();
assert_eq!(map.pop_first(), None);
map.insert(3, "a");
map.insert(1, "b");
map.insert(2, "c");
assert_eq!(map.pop_first(), Some((1, "b")));
assert_eq!(map.pop_first(), Some((2, "c")));
assert_eq!(map.pop_first(), Some((3, "a")));
assert_eq!(map.pop_first(), None);
👎 Deprecated since 0.1.1:

Use pop_first() instead

Returns a reference to the last entry (that is, with the largest key) in the map.

Example
let mut map = AATreeMap::new();
assert_eq!(map.last_key_value(), None);
map.insert(1, "a");
map.insert(3, "b");
map.insert(2, "c");
assert_eq!(map.last_key_value(), Some((&3, &"b")));
👎 Deprecated since 0.1.1:

Use last_key_value() instead

Returns and removes the last entry (that is, with the largest key) in the map.

Example
let mut map = AATreeMap::new();
assert_eq!(map.pop_last(), None);
map.insert(1, "a");
map.insert(3, "b");
map.insert(2, "c");
assert_eq!(map.pop_last(), Some((3, "b")));
assert_eq!(map.pop_last(), Some((2, "c")));
assert_eq!(map.pop_last(), Some((1, "a")));
assert_eq!(map.pop_last(), None);

Returns a reference to the first entry with a key greater than or equal to k in the map.

Example
let mut map = AATreeMap::new();
assert_eq!(map.first_key_value_at_or_after(&15), None);
map.insert(10, "a");
map.insert(30, "b");
map.insert(20, "c");
assert_eq!(map.first_key_value_at_or_after(&15), Some((&20, &"c")));
👎 Deprecated since 0.1.1:

Use first_key_value_at_or_after() instead

Returns a mutable reference to the first entry with a key greater than or equal to k in the map.

Example
let mut map = AATreeMap::new();
assert_eq!(map.first_key_value_mut_at_or_after(&15), None);
map.insert(10, "a");
map.insert(30, "b");
map.insert(20, "c");
let value: &mut &str = map.first_key_value_mut_at_or_after(&15).unwrap().1;
assert_eq!(*value, "c");
*value = "d";
assert_eq!(map.first_key_value_at_or_after(&15), Some((&20, &"d")));
👎 Deprecated since 0.1.1:

Use first_key_value_mut_at_or_after() instead

Returns a reference to the last entry with a key smaller than or equal to k in the map.

Example
let mut map = AATreeMap::new();
assert_eq!(map.last_key_value_at_or_before(&25), None);
map.insert(10, "a");
map.insert(30, "b");
map.insert(20, "c");
assert_eq!(map.last_key_value_at_or_before(&25), Some((&20, &"c")));
👎 Deprecated since 0.1.1:

Use last_key_value_at_or_before() instead

Returns a mutable reference to the last entry with a key smaller than or equal to k in the map.

Example
let mut map = AATreeMap::new();
assert_eq!(map.last_key_value_mut_at_or_before(&25), None);
map.insert(10, "a");
map.insert(30, "b");
map.insert(20, "c");
let value: &mut &str = map.last_key_value_mut_at_or_before(&25).unwrap().1;
assert_eq!(*value, "c");
*value = "d";
assert_eq!(map.last_key_value_at_or_before(&25), Some((&20, &"d")));
👎 Deprecated since 0.1.1:

Use last_key_value_mut_at_or_before() instead

Construct a new, empty AA-Tree based map.

Example
let map = AATreeMap::new();
assert!(map.is_empty());

Returns the number of elements in the map.

Example
let mut map = AATreeMap::new();
assert_eq!(map.len(), 0);
map.insert(1, "a");
assert_eq!(map.len(), 1);

Returns true if the map contains no elements.

Example
let mut map = AATreeMap::new();
assert!(map.is_empty());
map.insert(1, "a");
assert!(!map.is_empty());

Clears the map, removing all elements.

Example
let mut map = AATreeMap::new();
map.insert(1, "a");
map.clear();
assert!(map.is_empty());

Creates an iterator over this map that visits all entries with the keys in ascending order.

Creates an iterator visiting all the keys, in sorted order.

Creates an iterator visiting all the values, in sorted order.

Creates a consuming iterator visiting all the keys, in sorted order. The map cannot be used after calling this.

Creates a consuming iterator visiting all the values, in order by key. The map cannot be used after calling this.

Insert a new element into the map, or overwrite an existing element with the same key. If a value was overwritten, the old value will be returned.

Example
let mut map = AATreeMap::new();
map.insert(1, "a");
assert_eq!(map.get(&1), Some(&"a"));
map.insert(1, "b");
assert_eq!(map.get(&1), Some(&"b"));

Check if a key is contained within this map.

Example
let mut map = AATreeMap::new();
assert!(!map.contains_key(&1));
map.insert(1, "a");
assert!(map.contains_key(&1));

Remove a key from the map if it exists, and return the value that was previously stored in the map for that key.

Example
let mut map = AATreeMap::new();
map.insert(1, "a");
map.insert(2, "b");
assert_eq!(map.get(&1), Some(&"a"));
let value = map.remove(&1);
assert_eq!(value, Some("a"));
assert_eq!(map.get(&1), None);
source

pub fn remove_entry<Q>(&mut self, k: &Q) -> Option<(K, V)> where
    K: Borrow<Q> + Ord,
    Q: Ord + ?Sized

Remove a key from the map if it exists, and return the key and the value that was previously stored in the map for that key.

Example
let mut map = AATreeMap::new();
map.insert(1, "a");
map.insert(2, "b");
assert_eq!(map.get(&1), Some(&"a"));
let value = map.remove(&1);
assert_eq!(value, Some("a"));
assert_eq!(map.get(&1), None);

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Creates a value from an iterator. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.