Struct IntoIter

pub struct IntoIter<K, V, A: Allocator = Global> { /* private fields */ }

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 hashbrown::HashMap;

let map: HashMap<_, _> = [(1, "a"), (2, "b"), (3, "c")].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);

Trait Implementations

impl<K, V, A: Allocator> Default for IntoIter<K, V, A>

fn default() -> Self

impl<K, V, A: Allocator> ExactSizeIterator for IntoIter<K, V, A>

fn len(&self) -> usize

impl<K, V, A: Allocator> FusedIterator for IntoIter<K, V, A>

impl<K, V, A: Allocator> Iterator for IntoIter<K, V, A>

type Item = (K, V);
fn next(&mut self) -> Option<(K, V)>
fn size_hint(&self) -> (usize, Option<usize>)
fn fold<B, F>(self, init: B, f: F) -> B
where
    Self: Sized,
    F: FnMut(B, Self::Item) -> B,

impl<K: Debug, V: Debug, A: Allocator> Debug for IntoIter<K, V, A>

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

Auto Trait Implementations

impl<K, V, A> Freeze for IntoIter<K, V, A> where RawIntoIter<(K, V), A>: Freeze,

impl<K, V, A> RefUnwindSafe for IntoIter<K, V, A> where RawIntoIter<(K, V), A>: RefUnwindSafe,

impl<K, V, A> Send for IntoIter<K, V, A> where RawIntoIter<(K, V), A>: Send,

impl<K, V, A> Sync for IntoIter<K, V, A> where RawIntoIter<(K, V), A>: Sync,

impl<K, V, A> Unpin for IntoIter<K, V, A> where RawIntoIter<(K, V), A>: Unpin,

impl<K, V, A> UnsafeUnpin for IntoIter<K, V, A> where RawIntoIter<(K, V), A>: UnsafeUnpin,

impl<K, V, A> UnwindSafe for IntoIter<K, V, A> where RawIntoIter<(K, V), A>: UnwindSafe,

Blanket Implementations

impl<I> IntoIterator for IntoIter<K, V, A> where I: Iterator,

type Item = <I as Iterator>::Item;
type IntoIter = I;
fn into_iter(self) -> I

impl<T> Any for IntoIter<K, V, A> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for IntoIter<K, V, A> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for IntoIter<K, V, A> where T: ?Sized,

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

impl<T> From<T> for IntoIter<K, V, A>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for IntoIter<K, V, A> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom<U> for IntoIter<K, V, A> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for IntoIter<K, V, A> where U: TryFrom<T>,

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