unique_by
Removes elements whose key was already seen, keeping the first of each key in order.
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 deduplicate. |
key | impl FnMut(&T) -> K | Returns the key that decides which elements are duplicates. |
Returns
Section titled “Returns”Vec<T>
