key_by
Indexes the elements of items by the key returned by key.
When several elements share a key, the last one wins. Use group_by to keep
them all.
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 index. |
key | impl FnMut(&T) -> K | Returns the key to index each element under. |
Returns
Section titled “Returns”HashMap<K, T>
