Элементарный код.
use std::collections::HashMap;
fn main() {
let mut test = HashMap::new();
test.insert(1, "first line");
test.insert(2, "second line");
test.insert(3, "third line");
test.insert(4, "fourth line");
for (key, value) in &test {
println!("{}: {}", key, value);
}
}
Почему-то на выходе:
2: second line
1: first line
4: fourth line
3: third line