Skip to main content

Map

Struct Map 

Source
pub struct Map<K, V>(/* private fields */);
Expand description

A map in which the presence of an entry is tied to the lifetime of a RAII handle returned by the insertion.

Implementations§

Source§

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

Source

pub fn new() -> Self

Creates a new, empty map.

Source

pub fn len(&self) -> usize

Gets the number of items in the map.

Source

pub fn is_empty(&self) -> bool

Checks if the map is empty.

Source

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

Gets an iterator over the contents of the map.

Source

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

Gets a mutable iterator over the contents of the map.

Source

pub fn keys(&self) -> Keys<'_, K, V>

Gets an iterator over the keys of the map.

Source

pub fn values(&self) -> Values<'_, K, V>

Gets an iterator over the values of the map.

Source

pub fn values_mut(&mut self) -> ValuesMut<'_, K, V>

Gets a mutable iterator over the values of the map.

Trait Implementations§

Source§

impl<K: Debug, V: Debug> Debug for Map<K, V>

Source§

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

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

impl<K: Ord, V> Default for Map<K, V>

Source§

fn default() -> Self

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

impl<K: Eq, V: Eq> Eq for Map<K, V>

Source§

impl<K: Ord, V> IntoIterator for Map<K, V>

Source§

type Item = (K, V)

The type of the elements being iterated over.
Source§

type IntoIter = <BTreeMap<K, V> as IntoIterator>::IntoIter

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

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, K: Ord, V> IntoIterator for &'a Map<K, V>

Source§

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

The type of the elements being iterated over.
Source§

type IntoIter = <&'a BTreeMap<K, V> as IntoIterator>::IntoIter

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

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, K: Ord, V> IntoIterator for &'a mut Map<K, V>

Source§

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

The type of the elements being iterated over.
Source§

type IntoIter = <&'a mut BTreeMap<K, V> as IntoIterator>::IntoIter

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

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<K: PartialEq, V: PartialEq> PartialEq for Map<K, V>

Source§

fn eq(&self, other: &Map<K, V>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<K: PartialEq, V: PartialEq> StructuralPartialEq for Map<K, V>

Auto Trait Implementations§

§

impl<K, V> Freeze for Map<K, V>

§

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

§

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

§

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

§

impl<K, V> Unpin for Map<K, V>

§

impl<K, V> UnsafeUnpin for Map<K, V>

§

impl<K, V> UnwindSafe for Map<K, V>

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> 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, 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.