group_by
Groups the elements of items by the key returned by key.
Within each group, elements keep their original order. The order of the groups themselves is
unspecified (HashMap).
Import
Section titled “Import”Cargo feature array (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
items | &[T] | The elements to group. |
key | impl FnMut(&T) -> K | Returns the key to group each element under. |
Returns
Section titled “Returns”HashMap<K, Vec<T>>
