Created
          July 3, 2015 23:56 
        
      - 
      
 - 
        
Save anonymous/8fdc8b4f969fc402657c 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 mut teams = [ | |
| [ ("Jack", 20), ("Jane", 23), ("Jill", 18), ("John", 19), ], | |
| [ ("Bill", 17), ("Brenda", 16), ("Brad", 18), ("Barbara", 17), ] | |
| ]; | |
| let teams_in_score_order = teams | |
| .iter_mut() | |
| .map(|team| { | |
| team.sort_by(|&a, &b| a.1.cmp(&b.1)); | |
| team | |
| }) | |
| .collect::<Vec<_>>(); | |
| println!("Teams: {:?}", teams_in_score_order); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment