Struct Map

Source
pub struct Map<K, V, C = Natural<K>>
where C: Compare<K>,
{ /* private fields */ }
Expand description

An ordered map based on a binary search tree.

The behavior of this map is undefined if a key’s ordering relative to any other key changes while the key is in the map. This is normally only possible through Cell, RefCell, or unsafe code.

Implementations§

Source§

impl<K, V> Map<K, V>
where K: Ord,

Source

pub fn new() -> Self

Creates an empty map ordered according to the natural order of its keys.

§Examples
let mut map = tree::Map::new();

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

let mut it = map.iter();
assert_eq!(it.next(), Some((&1, &"a")));
assert_eq!(it.next(), Some((&2, &"b")));
assert_eq!(it.next(), Some((&3, &"c")));
assert_eq!(it.next(), None);
Source§

impl<K, V, C> Map<K, V, C>
where C: Compare<K>,

Source

pub fn with_cmp(cmp: C) -> Self

Creates an empty map ordered according to the given comparator.

§Examples
use compare::{Compare, natural};

let mut map = tree::Map::with_cmp(natural().rev());

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

let mut it = map.iter();
assert_eq!(it.next(), Some((&3, &"c")));
assert_eq!(it.next(), Some((&2, &"b")));
assert_eq!(it.next(), Some((&1, &"a")));
assert_eq!(it.next(), None);
Source

pub fn is_empty(&self) -> bool

Checks if the map is empty.

§Examples
let mut map = tree::Map::new();
assert!(map.is_empty());

map.insert(2, "b");
assert!(!map.is_empty());
Source

pub fn len(&self) -> usize

Returns the number of entries in the map.

§Examples
let mut map = tree::Map::new();
assert_eq!(map.len(), 0);

map.insert(2, "b");
assert_eq!(map.len(), 1);
Source

pub fn cmp(&self) -> &C

Returns a reference to the map’s comparator.

§Examples
use compare::{Compare, natural};

let map: tree::Map<i32, &str> = tree::Map::new();
assert!(map.cmp().compares_lt(&1, &2));

let map: tree::Map<i32, &str, _> = tree::Map::with_cmp(natural().rev());
assert!(map.cmp().compares_gt(&1, &2));
Source

pub fn clear(&mut self)

Removes all entries from the map.

§Examples
let mut map = tree::Map::new();

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

assert_eq!(map.len(), 3);
assert_eq!(map.iter().next(), Some((&1, &"a")));

map.clear();

assert_eq!(map.len(), 0);
assert_eq!(map.iter().next(), None);
Source

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

Inserts an entry into the map, returning the previous value, if any, associated with the key.

§Examples
let mut map = tree::Map::new();
assert_eq!(map.insert(1, "a"), None);
assert_eq!(map.get(&1), Some(&"a"));
assert_eq!(map.insert(1, "b"), Some("a"));
assert_eq!(map.get(&1), Some(&"b"));
Source

pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<(K, V)>
where C: Compare<Q, K>,

Removes and returns the entry whose key is equal to the given key, returning None if the map does not contain the key.

§Examples
let mut map = tree::Map::new();

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

assert_eq!(map.len(), 3);
assert_eq!(map.get(&1), Some(&"a"));
assert_eq!(map.remove(&1), Some((1, "a")));

assert_eq!(map.len(), 2);
assert_eq!(map.get(&1), None);
assert_eq!(map.remove(&1), None);
Source

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

Returns the map’s entry corresponding to the given key.

§Examples
let mut counts = tree::Map::new();

for s in vec!["a", "b", "a", "c", "a", "b"] {
    *counts.entry(s).or_insert(0) += 1;
}

assert_eq!(counts[&"a"], 3);
assert_eq!(counts[&"b"], 2);
assert_eq!(counts[&"c"], 1);
Source

pub fn contains_key<Q: ?Sized>(&self, key: &Q) -> bool
where C: Compare<Q, K>,

Checks if the map contains the given key.

§Examples
let mut map = tree::Map::new();
assert!(!map.contains_key(&1));
map.insert(1, "a");
assert!(map.contains_key(&1));
Source

pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&V>
where C: Compare<Q, K>,

Returns a reference to the value associated with the given key, or None if the map does not contain the key.

§Examples
let mut map = tree::Map::new();
assert_eq!(map.get(&1), None);
map.insert(1, "a");
assert_eq!(map.get(&1), Some(&"a"));
Source

pub fn get_mut<Q: ?Sized>(&mut self, key: &Q) -> Option<&mut V>
where C: Compare<Q, K>,

Returns a mutable reference to the value associated with the given key, or None if the map does not contain the key.

§Examples
let mut map = tree::Map::new();
assert_eq!(map.get(&1), None);
map.insert(1, "a");

{
    let value = map.get_mut(&1).unwrap();
    assert_eq!(*value, "a");
    *value = "b";
}

assert_eq!(map.get(&1), Some(&"b"));
Source

pub fn max(&self) -> Option<(&K, &V)>

Returns a reference to the map’s maximum key and a reference to its associated value, or None if the map is empty.

§Examples
let mut map = tree::Map::new();
assert_eq!(map.max(), None);

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

assert_eq!(map.max(), Some((&3, &"c")));
Source

pub fn max_mut(&mut self) -> Option<(&K, &mut V)>

Returns a reference to the map’s maximum key and a mutable reference to its associated value, or None if the map is empty.

§Examples
let mut map = tree::Map::new();
assert_eq!(map.max(), None);

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

{
    let max = map.max_mut().unwrap();
    assert_eq!(max, (&3, &mut "c"));
    *max.1 = "cc";
}

assert_eq!(map.max(), Some((&3, &"cc")));
Source

pub fn remove_max(&mut self) -> Option<(K, V)>

Removes the map’s maximum key and returns it and its associated value, or None if the map is empty.

§Examples
let mut map = tree::Map::new();
assert_eq!(map.remove_max(), None);

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

assert_eq!(map.remove_max(), Some((3, "c")));
Source

pub fn max_entry(&mut self) -> Option<OccupiedEntry<'_, K, V>>

Returns the map’s entry corresponding to its maximum key.

§Examples
let mut map = tree::Map::new();
assert!(map.max_entry().is_none());

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

{
    let mut e = map.max_entry().unwrap();
    assert_eq!(*e.key(), 3);
    assert_eq!(e.insert("cc"), "c");
}

assert_eq!(map[&3], "cc");
Source

pub fn min(&self) -> Option<(&K, &V)>

Returns a reference to the map’s minimum key and a reference to its associated value, or None if the map is empty.

§Examples
let mut map = tree::Map::new();
assert_eq!(map.min(), None);

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

assert_eq!(map.min(), Some((&1, &"a")));
Source

pub fn min_mut(&mut self) -> Option<(&K, &mut V)>

Returns a reference to the map’s minimum key and a mutable reference to its associated value, or None if the map is empty.

§Examples
let mut map = tree::Map::new();
assert_eq!(map.min(), None);

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

{
    let min = map.min_mut().unwrap();
    assert_eq!(min, (&1, &mut "a"));
    *min.1 = "aa";
}

assert_eq!(map.min(), Some((&1, &"aa")));
Source

pub fn remove_min(&mut self) -> Option<(K, V)>

Removes the map’s minimum key and returns it and its associated value, or None if the map is empty.

§Examples
let mut map = tree::Map::new();
assert_eq!(map.remove_min(), None);

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

assert_eq!(map.remove_min(), Some((1, "a")));
Source

pub fn min_entry(&mut self) -> Option<OccupiedEntry<'_, K, V>>

Returns the map’s entry corresponding to its minimum key.

§Examples
let mut map = tree::Map::new();
assert!(map.min_entry().is_none());

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

{
    let mut e = map.min_entry().unwrap();
    assert_eq!(*e.key(), 1);
    assert_eq!(e.insert("aa"), "a");
}

assert_eq!(map[&1], "aa");
Source

pub fn pred<Q: ?Sized>(&self, key: &Q, inclusive: bool) -> Option<(&K, &V)>
where C: Compare<Q, K>,

Returns a reference to the predecessor of the given key and a reference to its associated value, or None if no such key is present in the map.

If inclusive is false, this method finds the greatest key that is strictly less than the given key. If inclusive is true, this method finds the greatest key that is less than or equal to the given key.

The given key need not itself be present in the map.

§Examples
let mut map = tree::Map::new();

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

assert_eq!(map.pred(&0, false), None);
assert_eq!(map.pred(&1, false), None);
assert_eq!(map.pred(&2, false), Some((&1, &"a")));
assert_eq!(map.pred(&3, false), Some((&2, &"b")));
assert_eq!(map.pred(&4, false), Some((&3, &"c")));

assert_eq!(map.pred(&0, true), None);
assert_eq!(map.pred(&1, true), Some((&1, &"a")));
assert_eq!(map.pred(&2, true), Some((&2, &"b")));
assert_eq!(map.pred(&3, true), Some((&3, &"c")));
assert_eq!(map.pred(&4, true), Some((&3, &"c")));
Source

pub fn pred_mut<Q: ?Sized>( &mut self, key: &Q, inclusive: bool, ) -> Option<(&K, &mut V)>
where C: Compare<Q, K>,

Returns a reference to the predecessor of the given key and a mutable reference to its associated value, or None if no such key is present in the map.

If inclusive is false, this method finds the greatest key that is strictly less than the given key. If inclusive is true, this method finds the greatest key that is less than or equal to the given key.

The given key need not itself be present in the map.

§Examples
let mut map = tree::Map::new();

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

{
    let pred = map.pred_mut(&2, false).unwrap();
    assert_eq!(pred, (&1, &mut "a"));
    *pred.1 = "aa";
}

assert_eq!(map.pred(&2, false), Some((&1, &"aa")));

{
    let pred_or_eq = map.pred_mut(&1, true).unwrap();
    assert_eq!(pred_or_eq, (&1, &mut "aa"));
    *pred_or_eq.1 = "aaa";
}

{
    let pred_or_eq = map.pred_mut(&4, true).unwrap();
    assert_eq!(pred_or_eq, (&3, &mut "c"));
    *pred_or_eq.1 = "cc";
}

assert_eq!(map.pred(&1, true), Some((&1, &"aaa")));
assert_eq!(map.pred(&4, true), Some((&3, &"cc")));
Source

pub fn remove_pred<Q: ?Sized>( &mut self, key: &Q, inclusive: bool, ) -> Option<(K, V)>
where C: Compare<Q, K>,

Removes the predecessor of the given key from the map and returns it and its associated value, or None if no such key is present in the map.

If inclusive is false, this method removes the greatest key that is strictly less than the given key. If inclusive is true, this method removes the greatest key that is less than or equal to the given key.

The given key need not itself be present in the map.

§Examples
let mut map = tree::Map::new();

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

assert_eq!(map.remove_pred(&1, false), None);
assert!(map.contains_key(&1));

assert_eq!(map.remove_pred(&2, false), Some((1, "a")));
assert!(!map.contains_key(&1));

assert_eq!(map.remove_pred(&2, true), Some((2, "b")));
assert!(!map.contains_key(&2));
Source

pub fn pred_entry<Q: ?Sized>( &mut self, key: &Q, inclusive: bool, ) -> Option<OccupiedEntry<'_, K, V>>
where C: Compare<Q, K>,

Returns the entry corresponding to the predecessor of the given key.

If inclusive is false, this method returns the entry corresponding to the greatest key that is strictly less than the given key. If inclusive is true, this method returns the entry corresponding to the greatest key that is less than or equal to the given key.

The given key need not itself be present in the map.

§Examples
let mut map = tree::Map::new();

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

assert!(map.pred_entry(&1, false).is_none());

{
    let mut e = map.pred_entry(&4, true).unwrap();
    assert_eq!(*e.key(), 3);
    assert_eq!(e.insert("cc"), "c");
}

assert_eq!(map[&3], "cc");

{
    let e = map.pred_entry(&3, false).unwrap();
    assert_eq!(e.remove(), (2, "b"));
}

assert!(!map.contains_key(&2));
Source

pub fn succ<Q: ?Sized>(&self, key: &Q, inclusive: bool) -> Option<(&K, &V)>
where C: Compare<Q, K>,

Returns a reference to the successor of the given key and a reference to its associated value, or None if no such key is present in the map.

If inclusive is false, this method finds the smallest key that is strictly greater than the given key. If inclusive is true, this method finds the smallest key that is greater than or equal to the given key.

The given key need not itself be present in the map.

§Examples
let mut map = tree::Map::new();

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

assert_eq!(map.succ(&0, false), Some((&1, &"a")));
assert_eq!(map.succ(&1, false), Some((&2, &"b")));
assert_eq!(map.succ(&2, false), Some((&3, &"c")));
assert_eq!(map.succ(&3, false), None);
assert_eq!(map.succ(&4, false), None);

assert_eq!(map.succ(&0, true), Some((&1, &"a")));
assert_eq!(map.succ(&1, true), Some((&1, &"a")));
assert_eq!(map.succ(&2, true), Some((&2, &"b")));
assert_eq!(map.succ(&3, true), Some((&3, &"c")));
assert_eq!(map.succ(&4, true), None);
Source

pub fn succ_mut<Q: ?Sized>( &mut self, key: &Q, inclusive: bool, ) -> Option<(&K, &mut V)>
where C: Compare<Q, K>,

Returns a reference to the successor of the given key and a mutable reference to its associated value, or None if no such key is present in the map.

If inclusive is false, this method finds the smallest key that is strictly greater than the given key. If inclusive is true, this method finds the smallest key that is greater than or equal to the given key.

The given key need not itself be present in the map.

§Examples
let mut map = tree::Map::new();

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

{
    let succ = map.succ_mut(&2, false).unwrap();
    assert_eq!(succ, (&3, &mut "c"));
    *succ.1 = "cc";
}

assert_eq!(map.succ(&2, false), Some((&3, &"cc")));

{
    let succ_or_eq = map.succ_mut(&0, true).unwrap();
    assert_eq!(succ_or_eq, (&1, &mut "a"));
    *succ_or_eq.1 = "aa";
}

{
    let succ_or_eq = map.succ_mut(&3, true).unwrap();
    assert_eq!(succ_or_eq, (&3, &mut "cc"));
    *succ_or_eq.1 = "ccc";
}

assert_eq!(map.succ(&0, true), Some((&1, &"aa")));
assert_eq!(map.succ(&3, true), Some((&3, &"ccc")));
Source

pub fn remove_succ<Q: ?Sized>( &mut self, key: &Q, inclusive: bool, ) -> Option<(K, V)>
where C: Compare<Q, K>,

Removes the successor of the given key from the map and returns it and its associated value, or None if no such key is present in the map.

If inclusive is false, this method removes the smallest key that is strictly greater than the given key. If inclusive is true, this method removes the smallest key that is greater than or equal to the given key.

The given key need not itself be present in the map.

§Examples
let mut map = tree::Map::new();

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

assert_eq!(map.remove_succ(&3, false), None);
assert!(map.contains_key(&3));

assert_eq!(map.remove_succ(&2, false), Some((3, "c")));
assert!(!map.contains_key(&3));

assert_eq!(map.remove_succ(&2, true), Some((2, "b")));
assert!(!map.contains_key(&2));
Source

pub fn succ_entry<Q: ?Sized>( &mut self, key: &Q, inclusive: bool, ) -> Option<OccupiedEntry<'_, K, V>>
where C: Compare<Q, K>,

Returns the entry corresponding to the successor of the given key.

If inclusive is false, this method returns the entry corresponding to the smallest key that is strictly greater than the given key. If inclusive is true, this method returns the entry corresponding to the smallest key that is greater than or equal to the given key.

The given key need not itself be present in the map.

§Examples
let mut map = tree::Map::new();

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

assert!(map.succ_entry(&3, false).is_none());

{
    let mut e = map.succ_entry(&0, true).unwrap();
    assert_eq!(*e.key(), 1);
    assert_eq!(e.insert("aa"), "a");
}

assert_eq!(map[&1], "aa");

{
    let e = map.succ_entry(&1, false).unwrap();
    assert_eq!(e.remove(), (2, "b"));
}

assert!(!map.contains_key(&2));
Source

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

Returns an iterator over the map’s entries with immutable references to the values.

The iterator yields the entries in ascending order according to the map’s comparator.

§Examples
let mut map = tree::Map::new();

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

let mut it = map.iter();
assert_eq!(it.next(), Some((&1, &"a")));
assert_eq!(it.next(), Some((&2, &"b")));
assert_eq!(it.next(), Some((&3, &"c")));
assert_eq!(it.next(), None);
Source

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

Returns an iterator over the map’s entries with mutable references to the values.

The iterator yields the entries in ascending order according to the map’s comparator.

§Examples
let mut map = tree::Map::new();

map.insert("b", 2);
map.insert("a", 1);
map.insert("c", 3);

let mut i = 1;

for (_, value) in map.iter_mut() {
    assert_eq!(i, *value);
    *value *= 2;
    i += 1;
}

assert_eq!(map[&"a"], 2);
assert_eq!(map[&"b"], 4);
assert_eq!(map[&"c"], 6);

Trait Implementations§

Source§

impl<K, V, C> Arbitrary for Map<K, V, C>
where K: Arbitrary, V: Arbitrary, C: 'static + Clone + Compare<K> + Default + Send,

Source§

fn arbitrary<G: Gen>(gen: &mut G) -> Self

Source§

fn shrink(&self) -> Box<dyn Iterator<Item = Self>>

Source§

impl<K: Clone, V: Clone, C> Clone for Map<K, V, C>
where C: Compare<K> + Clone,

Source§

fn clone(&self) -> Map<K, V, C>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<K, V, C> Debug for Map<K, V, C>
where K: Debug, V: Debug, C: Compare<K>,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<K, V, C> Default for Map<K, V, C>
where C: Compare<K> + Default,

Source§

fn default() -> Self

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

impl<K, V, C> Extend<(K, V)> for Map<K, V, C>
where C: Compare<K>,

Source§

fn extend<I: IntoIterator<Item = (K, V)>>(&mut self, it: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<K, V, C> FromIterator<(K, V)> for Map<K, V, C>
where C: Compare<K> + Default,

Source§

fn from_iter<I: IntoIterator<Item = (K, V)>>(it: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<K, V, C> Hash for Map<K, V, C>
where K: Hash, V: Hash, C: Compare<K>,

Source§

fn hash<H: Hasher>(&self, h: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a, K, V, C, Q: ?Sized> Index<&'a Q> for Map<K, V, C>
where C: Compare<K> + Compare<Q, K>,

Source§

type Output = V

The returned type after indexing.
Source§

fn index(&self, key: &Q) -> &V

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a, K, V, C> IntoIterator for &'a Map<K, V, C>
where C: Compare<K>,

Source§

type Item = (&'a K, &'a V)

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, K, V>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Iter<'a, K, V>

Creates an iterator from a value. Read more
Source§

impl<'a, K, V, C> IntoIterator for &'a mut Map<K, V, C>
where C: Compare<K>,

Source§

type Item = (&'a K, &'a mut V)

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'a, K, V>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> IterMut<'a, K, V>

Creates an iterator from a value. Read more
Source§

impl<K, V, C> IntoIterator for Map<K, V, C>
where C: Compare<K>,

Source§

fn into_iter(self) -> IntoIter<K, V>

Returns an iterator that consumes the map.

The iterator yields the entries in ascending order according to the map’s comparator.

§Examples
let mut map = tree::Map::new();

map.insert(2, "b");
map.insert(1, "a");
map.insert(3, "c");

let mut it = map.into_iter();
assert_eq!(it.next(), Some((1, "a")));
assert_eq!(it.next(), Some((2, "b")));
assert_eq!(it.next(), Some((3, "c")));
assert_eq!(it.next(), None);
Source§

type Item = (K, V)

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<K, V>

Which kind of iterator are we turning this into?
Source§

impl<K, V, C> Ord for Map<K, V, C>
where V: Ord, C: Compare<K>,

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<K, V, C> PartialEq for Map<K, V, C>
where V: PartialEq, C: Compare<K>,

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<K, V, C> PartialOrd for Map<K, V, C>
where V: PartialOrd, C: Compare<K>,

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<K, V, C> Eq for Map<K, V, C>
where V: Eq, C: Compare<K>,

Auto Trait Implementations§

§

impl<K, V, C> Freeze for Map<K, V, C>
where C: Freeze,

§

impl<K, V, C> RefUnwindSafe for Map<K, V, C>

§

impl<K, V, C> Send for Map<K, V, C>
where C: Send, K: Send, V: Send,

§

impl<K, V, C> Sync for Map<K, V, C>
where C: Sync, K: Sync, V: Sync,

§

impl<K, V, C> Unpin for Map<K, V, C>
where C: Unpin,

§

impl<K, V, C> UnwindSafe for Map<K, V, C>
where C: UnwindSafe, K: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.