pub struct IntoIter<K, V, A = Global>where
A: Allocator,{ /* private fields */ }Expand description
An owning iterator over the entries of a HashMap in arbitrary order.
The iterator element type is (K, V).
This struct is created by the into_iter method on HashMap
(provided by the IntoIterator trait). See its documentation for more.
The map cannot be used after calling that method.
§Examples
use rune::alloc::HashMap;
let map: HashMap<_, _> = [(1, "a"), (2, "b"), (3, "c")].try_into()?;
let mut iter = map.into_iter();
let mut vec = vec![iter.next(), iter.next(), iter.next()];
// The `IntoIter` iterator produces items in arbitrary order, so the
// items must be sorted to test them against a sorted array.
vec.sort_unstable();
assert_eq!(vec, [Some((1, "a")), Some((2, "b")), Some((3, "c"))]);
// It is fused iterator
assert_eq!(iter.next(), None);
assert_eq!(iter.next(), None);Auto Trait Implementations§
impl<K, V, A> Freeze for IntoIter<K, V, A>where
A: Freeze,
impl<K, V, A> RefUnwindSafe for IntoIter<K, V, A>
impl<K, V, A> Send for IntoIter<K, V, A>
impl<K, V, A> Sync for IntoIter<K, V, A>
impl<K, V, A> Unpin for IntoIter<K, V, A>
impl<K, V, A> UnwindSafe for IntoIter<K, V, A>
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