pub struct FlatMap<K, V> { /* private fields */ }
Implementations§
source§impl<K, V> FlatMap<K, V>
impl<K, V> FlatMap<K, V>
pub fn new() -> FlatMap<K, V>
pub fn with_capacity(capacity: usize) -> FlatMap<K, V>
sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of elements the VecMap
can hold without
reallocating.
Examples
use flat_map::FlatMap;
let map: FlatMap<String, String> = FlatMap::with_capacity(10);
assert!(map.capacity() >= 10);
pub fn reserve(&mut self, additional: usize)
pub fn reserve_exact(&mut self, additional: usize)
pub fn shrink_to_fit(&mut self)
pub fn len(&self) -> usize
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Return true if the map contains no elements.
Examples
use flat_map::FlatMap;
let mut a = FlatMap::new();
assert!(a.is_empty());
a.insert("1", "a");
assert!(!a.is_empty());
pub fn iter<'r>(&'r self) -> Iter<'r, K, V> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_, K, V> ⓘ
pub fn values_mut(&mut self) -> ValuesMut<'_, K, V> ⓘ
pub fn keys<'a>(&'a self) -> Keys<'a, K, V> ⓘ
pub fn values<'a>(&'a self) -> Values<'a, K, V> ⓘ
pub fn clear(&mut self)
pub fn into_inner(self) -> Vec<(K, V)>
source§impl<K: Ord, V> FlatMap<K, V>
impl<K: Ord, V> FlatMap<K, V>
pub fn insert(&mut self, key: K, v: V) -> Option<V>
pub fn append(&mut self, other: &mut Self)
pub fn split_off(&mut self, key: &K) -> Self
pub fn get<Q>(&self, q: &Q) -> Option<&V>where
K: Borrow<Q>,
Q: Ord + ?Sized,
pub fn contains_key<Q>(&self, k: &Q) -> boolwhere
K: Borrow<Q>,
Q: Ord + ?Sized,
sourcepub fn get_mut<Q>(&mut self, q: &Q) -> Option<&mut V>where
K: Borrow<Q>,
Q: Ord + ?Sized,
pub fn get_mut<Q>(&mut self, q: &Q) -> Option<&mut V>where
K: Borrow<Q>,
Q: Ord + ?Sized,
Return Option<&mut V>.
Example
use flat_map::FlatMap;
let mut m = FlatMap::new();
m.insert(1, "foo".to_string());
m.get_mut(&1).unwrap().push_str("bar");
assert_eq!("foobar", m.get_mut(&1).unwrap());
pub fn entry(&mut self, key: K) -> Entry<'_, K, V>
pub fn remove<Q>(&mut self, q: &Q) -> Option<V>where
K: Borrow<Q>,
Q: Ord + ?Sized,
Trait Implementations§
source§impl<'a, K: Ord + Copy, V: Copy> Extend<(&'a K, &'a V)> for FlatMap<K, V>
impl<'a, K: Ord + Copy, V: Copy> Extend<(&'a K, &'a V)> for FlatMap<K, V>
source§fn extend<I: IntoIterator<Item = (&'a K, &'a V)>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = (&'a K, &'a V)>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
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)
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: Ord, V> Extend<(K, V)> for FlatMap<K, V>
impl<K: Ord, V> Extend<(K, V)> for FlatMap<K, V>
source§fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
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)
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<'a, K, V> IntoIterator for &'a FlatMap<K, V>
impl<'a, K, V> IntoIterator for &'a FlatMap<K, V>
source§impl<'a, K, V> IntoIterator for &'a mut FlatMap<K, V>
impl<'a, K, V> IntoIterator for &'a mut FlatMap<K, V>
source§impl<K, V> IntoIterator for FlatMap<K, V>
impl<K, V> IntoIterator for FlatMap<K, V>
source§impl<K: Ord, V: Ord> Ord for FlatMap<K, V>
impl<K: Ord, V: Ord> Ord for FlatMap<K, V>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<K: PartialEq, V: PartialEq> PartialEq<FlatMap<K, V>> for FlatMap<K, V>
impl<K: PartialEq, V: PartialEq> PartialEq<FlatMap<K, V>> for FlatMap<K, V>
source§impl<K: PartialOrd, V: PartialOrd> PartialOrd<FlatMap<K, V>> for FlatMap<K, V>
impl<K: PartialOrd, V: PartialOrd> PartialOrd<FlatMap<K, V>> for FlatMap<K, V>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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