Skip to content

Instantly share code, notes, and snippets.

@pzol
Created February 4, 2014 07:33
Show Gist options
  • Save pzol/8799497 to your computer and use it in GitHub Desktop.
Save pzol/8799497 to your computer and use it in GitHub Desktop.
#[test]
fn test_iter(){
let mut map = HashMap::<~str, uint>::new();
map.insert(~"foo", 1);
map.insert(~"bar", 2);
let mut numbers = ~[];
for (_k,v) in map.iter() {
numbers.push(v.clone());
}
assert_eq!(numbers, ~[2, 1]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment