You must be signed in to star a gist
A small example of grouping-by crate.
This file contains 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
|// This returns for each year, the contract with the most days.|
||contract| contract.date.year(), // Key of HashMap|
||contract1, contract2| contract1.days.cmp(&contract2.days), // Comparator to get the max|
|) // Returns `HashMap<i32, Contract>`|