first_duplicate
Returns the first item of iter that has already appeared earlier in it, or None when
every item is unique.
Unlike array::duplicates, this stops at the first repeat, so it
works on an infinite or otherwise unbounded iterator instead of requiring an already-collected
slice.
Import
Section titled “Import”Cargo feature iter (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
iter | impl IntoIterator<Item = T> | The items to scan, in order. |
Returns
Section titled “Returns”Option<T> — The first repeated item, or None when there is none.
