Skip to content

Instantly share code, notes, and snippets.

Created July 3, 2015 23:58
Show Gist options
  • Save anonymous/d14ace962e2e72b5d801 to your computer and use it in GitHub Desktop.
Save anonymous/d14ace962e2e72b5d801 to your computer and use it in GitHub Desktop.
Shared via Rust Playground
fn main() {
let player_scores = [
("Jack", 20), ("Jane", 23), ("Jill", 18), ("John", 19),
];
let players = player_scores
.iter()
.map(|&(player, _score)| {
player
})
.collect::<Vec<_>>();
assert_eq!(players, ["Jack", "Jane", "Jill", "John"]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment