pub struct IntoValues<K, V, A = Global>where
A: Allocator,{ /* private fields */ }Expand description
An owning iterator over the values of a HashMap in arbitrary order.
The iterator element type is V.
This struct is created by the into_values method on HashMap.
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 values = map.into_values();
let mut vec = vec![values.next(), values.next(), values.next()];
// The `IntoValues` iterator produces values in arbitrary order, so
// the values must be sorted to test them against a sorted array.
vec.sort_unstable();
assert_eq!(vec, [Some("a"), Some("b"), Some("c")]);
// It is fused iterator
assert_eq!(values.next(), None);
assert_eq!(values.next(), None);