Created
July 3, 2015 23:58
-
-
Save anonymous/d14ace962e2e72b5d801 to your computer and use it in GitHub Desktop.
Shared via Rust Playground
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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