Struct im::ordmap::OrdMap [−][src]
pub struct OrdMap<K, V> { /* fields omitted */ }
An ordered map.
An immutable ordered map implemented as a B-tree.
Most operations on this type of map are O(log n). A
HashMap
is usually a better choice for
performance, but the OrdMap
has the advantage of only requiring
an Ord
constraint on the key, and of being
ordered, so that keys always come out from lowest to highest,
where a HashMap
has no guaranteed ordering.
Methods
impl<K, V> OrdMap<K, V>
[src]
impl<K, V> OrdMap<K, V>
pub fn new() -> Self
[src]
pub fn new() -> Self
Construct an empty map.
pub fn singleton(key: K, value: V) -> Self
[src]
pub fn singleton(key: K, value: V) -> Self
Construct a map with a single mapping.
Examples
let map = OrdMap::singleton(123, "onetwothree"); assert_eq!( map.get(&123), Some(&"onetwothree") );
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Test whether a map is empty.
Time: O(1)
Examples
assert!( !ordmap!{1 => 2}.is_empty() ); assert!( OrdMap::<i32, i32>::new().is_empty() );
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Get the size of a map.
Time: O(1)
Examples
assert_eq!(3, ordmap!{ 1 => 11, 2 => 22, 3 => 33 }.len());
pub fn get_max(&self) -> Option<&(K, V)>
[src]
pub fn get_max(&self) -> Option<&(K, V)>
Get the largest key in a map, along with its value. If the map
is empty, return None
.
Time: O(log n)
Examples
assert_eq!(Some(&(3, 33)), ordmap!{ 1 => 11, 2 => 22, 3 => 33 }.get_max());
pub fn get_min(&self) -> Option<&(K, V)>
[src]
pub fn get_min(&self) -> Option<&(K, V)>
Get the smallest key in a map, along with its value. If the
map is empty, return None
.
Time: O(log n)
Examples
assert_eq!(Some(&(1, 11)), ordmap!{ 1 => 11, 2 => 22, 3 => 33 }.get_min());
impl<K: Ord + Clone, V: Clone> OrdMap<K, V>
[src]
impl<K: Ord + Clone, V: Clone> OrdMap<K, V>
ⓘImportant traits for Iter<'a, A>pub fn iter(&self) -> Iter<(K, V)>
[src]
pub fn iter(&self) -> Iter<(K, V)>
Get an iterator over the key/value pairs of a map.
ⓘImportant traits for Keys<'a, K, V>pub fn keys(&self) -> Keys<K, V>
[src]
pub fn keys(&self) -> Keys<K, V>
Get an iterator over a map's keys.
ⓘImportant traits for Values<'a, K, V>pub fn values(&self) -> Values<K, V>
[src]
pub fn values(&self) -> Values<K, V>
Get an iterator over a map's values.
ⓘImportant traits for DiffIter<'a, A>pub fn diff<'a>(&'a self, other: &'a Self) -> DiffIter<'a, (K, V)>
[src]
pub fn diff<'a>(&'a self, other: &'a Self) -> DiffIter<'a, (K, V)>
Get an iterator over the differences between this map and another, i.e. the set of entries to add, update, or remove to this map in order to make it equal to the other map.
This function will avoid visiting nodes which are shared between the two maps, meaning that even very large maps can be compared quickly if most of their structure is shared.
Time: O(n) (where n is the number of unique elements across the two maps, minus the number of elements belonging to nodes shared between them)
pub fn get<BK: ?Sized>(&self, key: &BK) -> Option<&V> where
BK: Ord,
K: Borrow<BK>,
[src]
pub fn get<BK: ?Sized>(&self, key: &BK) -> Option<&V> where
BK: Ord,
K: Borrow<BK>,
Get the value for a key from a map.
Time: O(log n)
Examples
let map = ordmap!{123 => "lol"}; assert_eq!( map.get(&123), Some(&"lol") );
pub fn contains_key<BK: ?Sized>(&self, k: &BK) -> bool where
BK: Ord,
K: Borrow<BK>,
[src]
pub fn contains_key<BK: ?Sized>(&self, k: &BK) -> bool where
BK: Ord,
K: Borrow<BK>,
Test for the presence of a key in a map.
Time: O(log n)
Examples
let map = ordmap!{123 => "lol"}; assert!( map.contains_key(&123) ); assert!( !map.contains_key(&321) );
pub fn insert(&mut self, key: K, value: V) -> Option<V>
[src]
pub fn insert(&mut self, key: K, value: V) -> Option<V>
Insert a key/value mapping into a map.
This is a copy-on-write operation, so that the parts of the map's structure which are shared with other maps will be safely copied before mutating.
If the map already has a mapping for the given key, the previous value is overwritten.
Time: O(log n)
Examples
let mut map = ordmap!{}; map.insert(123, "123"); map.insert(456, "456"); assert_eq!( map, ordmap!{123 => "123", 456 => "456"} );
pub fn remove<BK: ?Sized>(&mut self, k: &BK) -> Option<V> where
BK: Ord,
K: Borrow<BK>,
[src]
pub fn remove<BK: ?Sized>(&mut self, k: &BK) -> Option<V> where
BK: Ord,
K: Borrow<BK>,
Remove a key/value mapping from a map if it exists.
Time: O(log n)
Examples
let mut map = ordmap!{123 => "123", 456 => "456"}; map.remove(&123); map.remove(&456); assert!(map.is_empty());
pub fn remove_with_key<BK: ?Sized>(&mut self, k: &BK) -> Option<(K, V)> where
BK: Ord,
K: Borrow<BK>,
[src]
pub fn remove_with_key<BK: ?Sized>(&mut self, k: &BK) -> Option<(K, V)> where
BK: Ord,
K: Borrow<BK>,
Remove a key/value pair from a map, if it exists, and return the removed key and value.
Time: O(log n)
pub fn update(&self, key: K, value: V) -> Self
[src]
pub fn update(&self, key: K, value: V) -> Self
Construct a new map by inserting a key/value mapping into a map.
If the map already has a mapping for the given key, the previous value is overwritten.
Time: O(log n)
Examples
let map = ordmap!{}; assert_eq!( map.update(123, "123"), ordmap!{123 => "123"} );
pub fn update_with<F>(self, k: K, v: V, f: F) -> Self where
F: FnOnce(V, V) -> V,
[src]
pub fn update_with<F>(self, k: K, v: V, f: F) -> Self where
F: FnOnce(V, V) -> V,
Construct a new map by inserting a key/value mapping into a map.
If the map already has a mapping for the given key, we call the provided function with the old value and the new value, and insert the result as the new value.
Time: O(log n)
pub fn update_with_key<F>(self, k: K, v: V, f: F) -> Self where
F: FnOnce(&K, V, V) -> V,
[src]
pub fn update_with_key<F>(self, k: K, v: V, f: F) -> Self where
F: FnOnce(&K, V, V) -> V,
Construct a new map by inserting a key/value mapping into a map.
If the map already has a mapping for the given key, we call the provided function with the key, the old value and the new value, and insert the result as the new value.
Time: O(log n)
pub fn update_lookup_with_key<F>(self, k: K, v: V, f: F) -> (Option<V>, Self) where
F: FnOnce(&K, &V, V) -> V,
[src]
pub fn update_lookup_with_key<F>(self, k: K, v: V, f: F) -> (Option<V>, Self) where
F: FnOnce(&K, &V, V) -> V,
Construct a new map by inserting a key/value mapping into a map, returning the old value for the key as well as the new map.
If the map already has a mapping for the given key, we call the provided function with the key, the old value and the new value, and insert the result as the new value.
Time: O(log n)
pub fn alter<F>(&self, f: F, k: K) -> Self where
F: FnOnce(Option<V>) -> Option<V>,
[src]
pub fn alter<F>(&self, f: F, k: K) -> Self where
F: FnOnce(Option<V>) -> Option<V>,
Update the value for a given key by calling a function with the current value and overwriting it with the function's return value.
The function gets an Option<V>
and
returns the same, so that it can decide to delete a mapping
instead of updating the value, and decide what to do if the
key isn't in the map.
Time: O(log n)
pub fn without<BK: ?Sized>(&self, k: &BK) -> Self where
BK: Ord,
K: Borrow<BK>,
[src]
pub fn without<BK: ?Sized>(&self, k: &BK) -> Self where
BK: Ord,
K: Borrow<BK>,
Remove a key/value pair from a map, if it exists.
Time: O(log n)
pub fn extract<BK: ?Sized>(&self, k: &BK) -> Option<(V, Self)> where
BK: Ord,
K: Borrow<BK>,
[src]
pub fn extract<BK: ?Sized>(&self, k: &BK) -> Option<(V, Self)> where
BK: Ord,
K: Borrow<BK>,
Remove a key/value pair from a map, if it exists, and return the removed value as well as the updated list.
Time: O(log n)
pub fn extract_with_key<BK: ?Sized>(&self, k: &BK) -> Option<(K, V, Self)> where
BK: Ord,
K: Borrow<BK>,
[src]
pub fn extract_with_key<BK: ?Sized>(&self, k: &BK) -> Option<(K, V, Self)> where
BK: Ord,
K: Borrow<BK>,
Remove a key/value pair from a map, if it exists, and return the removed key and value as well as the updated list.
Time: O(log n)
pub fn union(self, other: Self) -> Self
[src]
pub fn union(self, other: Self) -> Self
Construct the union of two maps, keeping the values in the current map when keys exist in both maps.
Time: O(n log n)
Examples
let map1 = ordmap!{1 => 1, 3 => 3}; let map2 = ordmap!{2 => 2, 3 => 4}; let expected = ordmap!{1 => 1, 2 => 2, 3 => 3}; assert_eq!(expected, map1.union(map2));
pub fn union_with<F>(self, other: Self, f: F) -> Self where
F: Fn(V, V) -> V,
[src]
pub fn union_with<F>(self, other: Self, f: F) -> Self where
F: Fn(V, V) -> V,
Construct the union of two maps, using a function to decide what to do with the value when a key is in both maps.
The function is called when a value exists in both maps, and receives the value from the current map as its first argument, and the value from the other map as the second. It should return the value to be inserted in the resulting map.
Time: O(n log n)
pub fn union_with_key<F>(self, other: Self, f: F) -> Self where
F: Fn(&K, V, V) -> V,
[src]
pub fn union_with_key<F>(self, other: Self, f: F) -> Self where
F: Fn(&K, V, V) -> V,
Construct the union of two maps, using a function to decide what to do with the value when a key is in both maps.
The function is called when a value exists in both maps, and receives a reference to the key as its first argument, the value from the current map as the second argument, and the value from the other map as the third argument. It should return the value to be inserted in the resulting map.
Time: O(n log n)
Examples
let map1 = ordmap!{1 => 1, 3 => 4}; let map2 = ordmap!{2 => 2, 3 => 5}; let expected = ordmap!{1 => 1, 2 => 2, 3 => 9}; assert_eq!(expected, map1.union_with_key( map2, |key, left, right| left + right ));
pub fn unions<I>(i: I) -> Self where
I: IntoIterator<Item = Self>,
[src]
pub fn unions<I>(i: I) -> Self where
I: IntoIterator<Item = Self>,
Construct the union of a sequence of maps, selecting the value of the leftmost when a key appears in more than one map.
Time: O(n log n)
Examples
let map1 = ordmap!{1 => 1, 3 => 3}; let map2 = ordmap!{2 => 2}; let expected = ordmap!{1 => 1, 2 => 2, 3 => 3}; assert_eq!(expected, OrdMap::unions(vec![map1, map2]));
pub fn unions_with<I, F>(i: I, f: F) -> Self where
I: IntoIterator<Item = Self>,
F: Fn(V, V) -> V,
[src]
pub fn unions_with<I, F>(i: I, f: F) -> Self where
I: IntoIterator<Item = Self>,
F: Fn(V, V) -> V,
Construct the union of a sequence of maps, using a function to decide what to do with the value when a key is in more than one map.
The function is called when a value exists in multiple maps, and receives the value from the current map as its first argument, and the value from the next map as the second. It should return the value to be inserted in the resulting map.
Time: O(n log n)
pub fn unions_with_key<I, F>(i: I, f: F) -> Self where
I: IntoIterator<Item = Self>,
F: Fn(&K, V, V) -> V,
[src]
pub fn unions_with_key<I, F>(i: I, f: F) -> Self where
I: IntoIterator<Item = Self>,
F: Fn(&K, V, V) -> V,
Construct the union of a sequence of maps, using a function to decide what to do with the value when a key is in more than one map.
The function is called when a value exists in multiple maps, and receives a reference to the key as its first argument, the value from the current map as the second argument, and the value from the next map as the third argument. It should return the value to be inserted in the resulting map.
Time: O(n log n)
pub fn difference(self, other: Self) -> Self
[src]
pub fn difference(self, other: Self) -> Self
Construct the difference between two maps by discarding keys which occur in both maps.
Time: O(n log n)
Examples
let map1 = ordmap!{1 => 1, 3 => 4}; let map2 = ordmap!{2 => 2, 3 => 5}; let expected = ordmap!{1 => 1, 2 => 2}; assert_eq!(expected, map1.difference(map2));
pub fn difference_with<F>(self, other: Self, f: F) -> Self where
F: Fn(V, V) -> Option<V>,
[src]
pub fn difference_with<F>(self, other: Self, f: F) -> Self where
F: Fn(V, V) -> Option<V>,
Construct the difference between two maps by using a function to decide what to do if a key occurs in both.
Time: O(n log n)
pub fn difference_with_key<F>(self, other: Self, f: F) -> Self where
F: Fn(&K, V, V) -> Option<V>,
[src]
pub fn difference_with_key<F>(self, other: Self, f: F) -> Self where
F: Fn(&K, V, V) -> Option<V>,
Construct the difference between two maps by using a function to decide what to do if a key occurs in both. The function receives the key as well as both values.
Time: O(n log n)
Examples
let map1 = ordmap!{1 => 1, 3 => 4}; let map2 = ordmap!{2 => 2, 3 => 5}; let expected = ordmap!{1 => 1, 2 => 2, 3 => 9}; assert_eq!(expected, map1.difference_with_key( map2, |key, left, right| Some(left + right) ));
pub fn intersection(self, other: Self) -> Self
[src]
pub fn intersection(self, other: Self) -> Self
Construct the intersection of two maps, keeping the values from the current map.
Time: O(n log n)
Examples
let map1 = ordmap!{1 => 1, 2 => 2}; let map2 = ordmap!{2 => 3, 3 => 4}; let expected = ordmap!{2 => 2}; assert_eq!(expected, map1.intersection(map2));
pub fn intersection_with<B, C, F>(
self,
other: OrdMap<K, B>,
f: F
) -> OrdMap<K, C> where
B: Clone,
C: Clone,
F: Fn(V, B) -> C,
[src]
pub fn intersection_with<B, C, F>(
self,
other: OrdMap<K, B>,
f: F
) -> OrdMap<K, C> where
B: Clone,
C: Clone,
F: Fn(V, B) -> C,
Construct the intersection of two maps, calling a function with both values for each key and using the result as the value for the key.
Time: O(n log n)
pub fn intersection_with_key<B, C, F>(
self,
other: OrdMap<K, B>,
f: F
) -> OrdMap<K, C> where
B: Clone,
C: Clone,
F: Fn(&K, V, B) -> C,
[src]
pub fn intersection_with_key<B, C, F>(
self,
other: OrdMap<K, B>,
f: F
) -> OrdMap<K, C> where
B: Clone,
C: Clone,
F: Fn(&K, V, B) -> C,
Construct the intersection of two maps, calling a function with the key and both values for each key and using the result as the value for the key.
Time: O(n log n)
Examples
let map1 = ordmap!{1 => 1, 2 => 2}; let map2 = ordmap!{2 => 3, 3 => 4}; let expected = ordmap!{2 => 5}; assert_eq!(expected, map1.intersection_with_key( map2, |key, left, right| left + right ));
pub fn is_submap_by<B, RM, F>(&self, other: RM, cmp: F) -> bool where
B: Clone,
F: Fn(&V, &B) -> bool,
RM: Borrow<OrdMap<K, B>>,
[src]
pub fn is_submap_by<B, RM, F>(&self, other: RM, cmp: F) -> bool where
B: Clone,
F: Fn(&V, &B) -> bool,
RM: Borrow<OrdMap<K, B>>,
Test whether a map is a submap of another map, meaning that all keys in our map must also be in the other map, with the same values.
Use the provided function to decide whether values are equal.
Time: O(n log n)
pub fn is_proper_submap_by<B, RM, F>(&self, other: RM, cmp: F) -> bool where
B: Clone,
F: Fn(&V, &B) -> bool,
RM: Borrow<OrdMap<K, B>>,
[src]
pub fn is_proper_submap_by<B, RM, F>(&self, other: RM, cmp: F) -> bool where
B: Clone,
F: Fn(&V, &B) -> bool,
RM: Borrow<OrdMap<K, B>>,
Test whether a map is a proper submap of another map, meaning that all keys in our map must also be in the other map, with the same values. To be a proper submap, ours must also contain fewer keys than the other map.
Use the provided function to decide whether values are equal.
Time: O(n log n)
pub fn is_submap<RM>(&self, other: RM) -> bool where
V: PartialEq,
RM: Borrow<Self>,
[src]
pub fn is_submap<RM>(&self, other: RM) -> bool where
V: PartialEq,
RM: Borrow<Self>,
Test whether a map is a submap of another map, meaning that all keys in our map must also be in the other map, with the same values.
Time: O(n log n)
Examples
let map1 = ordmap!{1 => 1, 2 => 2}; let map2 = ordmap!{1 => 1, 2 => 2, 3 => 3}; assert!(map1.is_submap(map2));
pub fn is_proper_submap<RM>(&self, other: RM) -> bool where
V: PartialEq,
RM: Borrow<Self>,
[src]
pub fn is_proper_submap<RM>(&self, other: RM) -> bool where
V: PartialEq,
RM: Borrow<Self>,
Test whether a map is a proper submap of another map, meaning that all keys in our map must also be in the other map, with the same values. To be a proper submap, ours must also contain fewer keys than the other map.
Time: O(n log n)
Examples
let map1 = ordmap!{1 => 1, 2 => 2}; let map2 = ordmap!{1 => 1, 2 => 2, 3 => 3}; assert!(map1.is_proper_submap(map2)); let map3 = ordmap!{1 => 1, 2 => 2}; let map4 = ordmap!{1 => 1, 2 => 2}; assert!(!map3.is_proper_submap(map4));
pub fn split<BK: ?Sized>(&self, split: &BK) -> (Self, Self) where
BK: Ord,
K: Borrow<BK>,
[src]
pub fn split<BK: ?Sized>(&self, split: &BK) -> (Self, Self) where
BK: Ord,
K: Borrow<BK>,
Split a map into two, with the left hand map containing keys
which are smaller than split
, and the right hand map
containing keys which are larger than split
.
The split
mapping is discarded.
pub fn split_lookup<BK: ?Sized>(&self, split: &BK) -> (Self, Option<V>, Self) where
BK: Ord,
K: Borrow<BK>,
[src]
pub fn split_lookup<BK: ?Sized>(&self, split: &BK) -> (Self, Option<V>, Self) where
BK: Ord,
K: Borrow<BK>,
Split a map into two, with the left hand map containing keys
which are smaller than split
, and the right hand map
containing keys which are larger than split
.
Returns both the two maps and the value of split
.
pub fn take(&self, n: usize) -> Self
[src]
pub fn take(&self, n: usize) -> Self
Construct a map with only the n
smallest keys from a given
map.
pub fn skip(&self, n: usize) -> Self
[src]
pub fn skip(&self, n: usize) -> Self
Construct a map with the n
smallest keys removed from a
given map.
pub fn without_min(&self) -> (Option<V>, Self)
[src]
pub fn without_min(&self) -> (Option<V>, Self)
Remove the smallest key from a map, and return its value as well as the updated map.
pub fn without_min_with_key(&self) -> (Option<(K, V)>, Self)
[src]
pub fn without_min_with_key(&self) -> (Option<(K, V)>, Self)
Remove the smallest key from a map, and return that key, its value as well as the updated map.
pub fn without_max(&self) -> (Option<V>, Self)
[src]
pub fn without_max(&self) -> (Option<V>, Self)
Remove the largest key from a map, and return its value as well as the updated map.
pub fn without_max_with_key(&self) -> (Option<(K, V)>, Self)
[src]
pub fn without_max_with_key(&self) -> (Option<(K, V)>, Self)
Remove the largest key from a map, and return that key, its value as well as the updated map.
pub fn entry(&mut self, key: K) -> Entry<K, V>
[src]
pub fn entry(&mut self, key: K) -> Entry<K, V>
Trait Implementations
impl<K, V> Clone for OrdMap<K, V>
[src]
impl<K, V> Clone for OrdMap<K, V>
fn clone(&self) -> Self
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<K, V> PartialEq for OrdMap<K, V> where
K: Ord + PartialEq + Clone,
V: PartialEq + Clone,
[src]
impl<K, V> PartialEq for OrdMap<K, V> where
K: Ord + PartialEq + Clone,
V: PartialEq + Clone,
fn eq(&self, other: &Self) -> bool
[src]
fn eq(&self, other: &Self) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<K: Ord + Clone + Eq, V: Clone + Eq> Eq for OrdMap<K, V>
[src]
impl<K: Ord + Clone + Eq, V: Clone + Eq> Eq for OrdMap<K, V>
impl<K, V> PartialOrd for OrdMap<K, V> where
K: Ord + Clone,
V: PartialOrd + Clone,
[src]
impl<K, V> PartialOrd for OrdMap<K, V> where
K: Ord + Clone,
V: PartialOrd + Clone,
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<K, V> Ord for OrdMap<K, V> where
K: Ord + Clone,
V: Ord + Clone,
[src]
impl<K, V> Ord for OrdMap<K, V> where
K: Ord + Clone,
V: Ord + Clone,
fn cmp(&self, other: &Self) -> Ordering
[src]
fn cmp(&self, other: &Self) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl<K, V> Hash for OrdMap<K, V> where
K: Ord + Clone + Hash,
V: Clone + Hash,
[src]
impl<K, V> Hash for OrdMap<K, V> where
K: Ord + Clone + Hash,
V: Clone + Hash,
fn hash<H>(&self, state: &mut H) where
H: Hasher,
[src]
fn hash<H>(&self, state: &mut H) where
H: Hasher,
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<K, V> Default for OrdMap<K, V>
[src]
impl<K, V> Default for OrdMap<K, V>
impl<'a, K, V> Add for &'a OrdMap<K, V> where
K: Ord + Clone,
V: Clone,
[src]
impl<'a, K, V> Add for &'a OrdMap<K, V> where
K: Ord + Clone,
V: Clone,
type Output = OrdMap<K, V>
The resulting type after applying the +
operator.
fn add(self, other: Self) -> Self::Output
[src]
fn add(self, other: Self) -> Self::Output
Performs the +
operation.
impl<K, V> Add for OrdMap<K, V> where
K: Ord + Clone,
V: Clone,
[src]
impl<K, V> Add for OrdMap<K, V> where
K: Ord + Clone,
V: Clone,
type Output = OrdMap<K, V>
The resulting type after applying the +
operator.
fn add(self, other: Self) -> Self::Output
[src]
fn add(self, other: Self) -> Self::Output
Performs the +
operation.
impl<K, V> Sum for OrdMap<K, V> where
K: Ord + Clone,
V: Clone,
[src]
impl<K, V> Sum for OrdMap<K, V> where
K: Ord + Clone,
V: Clone,
fn sum<I>(it: I) -> Self where
I: Iterator<Item = Self>,
[src]
fn sum<I>(it: I) -> Self where
I: Iterator<Item = Self>,
Method which takes an iterator and generates Self
from the elements by "summing up" the items. Read more
impl<K, V, RK, RV> Extend<(RK, RV)> for OrdMap<K, V> where
K: Ord + Clone + From<RK>,
V: Clone + From<RV>,
[src]
impl<K, V, RK, RV> Extend<(RK, RV)> for OrdMap<K, V> where
K: Ord + Clone + From<RK>,
V: Clone + From<RV>,
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = (RK, RV)>,
[src]
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = (RK, RV)>,
Extends a collection with the contents of an iterator. Read more
impl<'a, BK: ?Sized, K, V> Index<&'a BK> for OrdMap<K, V> where
BK: Ord,
K: Ord + Clone + Borrow<BK>,
V: Clone,
[src]
impl<'a, BK: ?Sized, K, V> Index<&'a BK> for OrdMap<K, V> where
BK: Ord,
K: Ord + Clone + Borrow<BK>,
V: Clone,
type Output = V
The returned type after indexing.
fn index(&self, key: &BK) -> &Self::Output
[src]
fn index(&self, key: &BK) -> &Self::Output
Performs the indexing (container[index]
) operation.
impl<'a, BK: ?Sized, K, V> IndexMut<&'a BK> for OrdMap<K, V> where
BK: Ord,
K: Ord + Clone + Borrow<BK>,
V: Clone,
[src]
impl<'a, BK: ?Sized, K, V> IndexMut<&'a BK> for OrdMap<K, V> where
BK: Ord,
K: Ord + Clone + Borrow<BK>,
V: Clone,
fn index_mut(&mut self, key: &BK) -> &mut Self::Output
[src]
fn index_mut(&mut self, key: &BK) -> &mut Self::Output
Performs the mutable indexing (container[index]
) operation.
impl<K, V> Debug for OrdMap<K, V> where
K: Ord + Clone + Debug,
V: Clone + Debug,
[src]
impl<K, V> Debug for OrdMap<K, V> where
K: Ord + Clone + Debug,
V: Clone + Debug,
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl<K, V, RK, RV> FromIterator<(RK, RV)> for OrdMap<K, V> where
K: Ord + Clone + From<RK>,
V: Clone + From<RV>,
[src]
impl<K, V, RK, RV> FromIterator<(RK, RV)> for OrdMap<K, V> where
K: Ord + Clone + From<RK>,
V: Clone + From<RV>,
fn from_iter<T>(i: T) -> Self where
T: IntoIterator<Item = (RK, RV)>,
[src]
fn from_iter<T>(i: T) -> Self where
T: IntoIterator<Item = (RK, RV)>,
Creates a value from an iterator. Read more
impl<'a, K, V> IntoIterator for &'a OrdMap<K, V> where
K: Ord + Clone,
V: Clone,
[src]
impl<'a, K, V> IntoIterator for &'a OrdMap<K, V> where
K: Ord + Clone,
V: Clone,
type Item = &'a (K, V)
The type of the elements being iterated over.
type IntoIter = Iter<'a, (K, V)>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<K, V> IntoIterator for OrdMap<K, V> where
K: Ord + Clone,
V: Clone,
[src]
impl<K, V> IntoIterator for OrdMap<K, V> where
K: Ord + Clone,
V: Clone,
type Item = (K, V)
The type of the elements being iterated over.
type IntoIter = ConsumingIter<(K, V)>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<K, V> AsRef<OrdMap<K, V>> for OrdMap<K, V>
[src]
impl<K, V> AsRef<OrdMap<K, V>> for OrdMap<K, V>
impl<'m, 'k, 'v, K: ?Sized, V: ?Sized, OK, OV> From<&'m OrdMap<&'k K, &'v V>> for OrdMap<OK, OV> where
K: Ord + ToOwned<Owned = OK>,
V: ToOwned<Owned = OV>,
OK: Ord + Clone + Borrow<K>,
OV: Clone + Borrow<V>,
[src]
impl<'m, 'k, 'v, K: ?Sized, V: ?Sized, OK, OV> From<&'m OrdMap<&'k K, &'v V>> for OrdMap<OK, OV> where
K: Ord + ToOwned<Owned = OK>,
V: ToOwned<Owned = OV>,
OK: Ord + Clone + Borrow<K>,
OV: Clone + Borrow<V>,
impl<'a, K, V, RK, RV, OK, OV> From<&'a [(RK, RV)]> for OrdMap<K, V> where
K: Ord + Clone + From<OK>,
V: Clone + From<OV>,
OK: Borrow<RK>,
OV: Borrow<RV>,
RK: ToOwned<Owned = OK>,
RV: ToOwned<Owned = OV>,
[src]
impl<'a, K, V, RK, RV, OK, OV> From<&'a [(RK, RV)]> for OrdMap<K, V> where
K: Ord + Clone + From<OK>,
V: Clone + From<OV>,
OK: Borrow<RK>,
OV: Borrow<RV>,
RK: ToOwned<Owned = OK>,
RV: ToOwned<Owned = OV>,
impl<K, V, RK, RV> From<Vec<(RK, RV)>> for OrdMap<K, V> where
K: Ord + Clone + From<RK>,
V: Clone + From<RV>,
[src]
impl<K, V, RK, RV> From<Vec<(RK, RV)>> for OrdMap<K, V> where
K: Ord + Clone + From<RK>,
V: Clone + From<RV>,
impl<'a, K: Ord, V, RK, RV, OK, OV> From<&'a Vec<(RK, RV)>> for OrdMap<K, V> where
K: Ord + Clone + From<OK>,
V: Clone + From<OV>,
OK: Borrow<RK>,
OV: Borrow<RV>,
RK: ToOwned<Owned = OK>,
RV: ToOwned<Owned = OV>,
[src]
impl<'a, K: Ord, V, RK, RV, OK, OV> From<&'a Vec<(RK, RV)>> for OrdMap<K, V> where
K: Ord + Clone + From<OK>,
V: Clone + From<OV>,
OK: Borrow<RK>,
OV: Borrow<RV>,
RK: ToOwned<Owned = OK>,
RV: ToOwned<Owned = OV>,
impl<K: Ord, V, RK: Eq + Hash, RV> From<HashMap<RK, RV>> for OrdMap<K, V> where
K: Ord + Clone + From<RK>,
V: Clone + From<RV>,
[src]
impl<K: Ord, V, RK: Eq + Hash, RV> From<HashMap<RK, RV>> for OrdMap<K, V> where
K: Ord + Clone + From<RK>,
V: Clone + From<RV>,
impl<'a, K, V, OK, OV, RK, RV> From<&'a HashMap<RK, RV>> for OrdMap<K, V> where
K: Ord + Clone + From<OK>,
V: Clone + From<OV>,
OK: Borrow<RK>,
OV: Borrow<RV>,
RK: Hash + Eq + ToOwned<Owned = OK>,
RV: ToOwned<Owned = OV>,
[src]
impl<'a, K, V, OK, OV, RK, RV> From<&'a HashMap<RK, RV>> for OrdMap<K, V> where
K: Ord + Clone + From<OK>,
V: Clone + From<OV>,
OK: Borrow<RK>,
OV: Borrow<RV>,
RK: Hash + Eq + ToOwned<Owned = OK>,
RV: ToOwned<Owned = OV>,
impl<K: Ord, V, RK, RV> From<BTreeMap<RK, RV>> for OrdMap<K, V> where
K: Ord + Clone + From<RK>,
V: Clone + From<RV>,
[src]
impl<K: Ord, V, RK, RV> From<BTreeMap<RK, RV>> for OrdMap<K, V> where
K: Ord + Clone + From<RK>,
V: Clone + From<RV>,
impl<'a, K: Ord, V, RK, RV, OK, OV> From<&'a BTreeMap<RK, RV>> for OrdMap<K, V> where
K: Ord + Clone + From<OK>,
V: Clone + From<OV>,
OK: Borrow<RK>,
OV: Borrow<RV>,
RK: Ord + ToOwned<Owned = OK>,
RV: ToOwned<Owned = OV>,
[src]
impl<'a, K: Ord, V, RK, RV, OK, OV> From<&'a BTreeMap<RK, RV>> for OrdMap<K, V> where
K: Ord + Clone + From<OK>,
V: Clone + From<OV>,
OK: Borrow<RK>,
OV: Borrow<RV>,
RK: Ord + ToOwned<Owned = OK>,
RV: ToOwned<Owned = OV>,
impl<K: Ord + Hash + Eq + Clone, V: Clone, S: BuildHasher> From<HashMap<K, V, S>> for OrdMap<K, V>
[src]
impl<K: Ord + Hash + Eq + Clone, V: Clone, S: BuildHasher> From<HashMap<K, V, S>> for OrdMap<K, V>
impl<'a, K: Ord + Hash + Eq + Clone, V: Clone, S: BuildHasher> From<&'a HashMap<K, V, S>> for OrdMap<K, V>
[src]
impl<'a, K: Ord + Hash + Eq + Clone, V: Clone, S: BuildHasher> From<&'a HashMap<K, V, S>> for OrdMap<K, V>