std-method
BTreeMap::into_values
Consume the map and yield owned values in key order, not value order. Use values() instead when ownership should remain with the map. Expected stdout (not executed): ["zeta", "alpha"] Common mistake: Assuming the values themselves are sorted.
Formal Syntax & Structure
rust syntaxrust
fn into_values(self) -> IntoValues<K, V>Working Example
Example Snippetrust
fn main() { use std::collections::BTreeMap; let jobs = BTreeMap::from([(8, "alpha"), (2, "zeta")]); println!("{:?}", jobs.into_values().collect::<Vec<_>>());}