pub struct IterMut<'a, K, V> { /* private fields */ }Expand description
A mutable iterator over the entries of a HashMap in arbitrary order.
The iterator element type is (&'a K, &'a mut V).
This struct is created by the iter_mut method on HashMap. See its
documentation for more.
§Examples
use rune::alloc::HashMap;
let mut map: HashMap<_, _> = [(1, "One".to_owned()), (2, "Two".into())].try_into()?;
let mut iter = map.iter_mut();
iter.next().map(|(_, v)| v.push_str(" Mississippi"));
iter.next().map(|(_, v)| v.push_str(" Mississippi"));
// It is fused iterator
assert_eq!(iter.next(), None);
assert_eq!(iter.next(), None);
assert_eq!(map.get(&1).unwrap(), &"One Mississippi".to_owned());
assert_eq!(map.get(&2).unwrap(), &"Two Mississippi".to_owned());Auto Trait Implementations§
impl<'a, K, V> Freeze for IterMut<'a, K, V>
impl<'a, K, V> RefUnwindSafe for IterMut<'a, K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<'a, K, V> Sync for IterMut<'a, K, V>
impl<'a, K, V> Unpin for IterMut<'a, K, V>
impl<'a, K, V> !UnwindSafe for IterMut<'a, K, V>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<I> IntoIterator for Iwhere
I: Iterator,
impl<I> IntoIterator for Iwhere
I: Iterator,
Source§impl<I> IteratorExt for Iwhere
I: Iterator,
impl<I> IteratorExt for Iwhere
I: Iterator,
Source§fn try_collect<B>(self) -> Result<B, Error>
fn try_collect<B>(self) -> Result<B, Error>
Transforms an iterator into a collection using fallible allocations.
Source§fn try_collect_in<B, A>(self, alloc: A) -> Result<B, Error>
fn try_collect_in<B, A>(self, alloc: A) -> Result<B, Error>
Transforms an iterator into a collection using fallible allocations.
Source§fn try_join_in<J, S, A>(self, sep: S, alloc: A) -> Result<J, Error>
fn try_join_in<J, S, A>(self, sep: S, alloc: A) -> Result<J, Error>
Try to join the given value.
Source§impl<I> IteratorRandom for Iwhere
I: Iterator,
impl<I> IteratorRandom for Iwhere
I: Iterator,
Source§fn choose_stable<R>(self, rng: &mut R) -> Option<Self::Item>
fn choose_stable<R>(self, rng: &mut R) -> Option<Self::Item>
Uniformly sample one element (stable) Read more