method iter.find
First element satisfying p; stops there.
Example:
fn main() io {
print("{[1, 4, 9].iter().find(x => x > 3)}")
}Output
4
pub(api) move fn find<effect F>(p: fn(T) -> bool F) -> T? FComplexity. O(n) at worst.
Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
p | fn(T) -> bool F |
Returns
T? F
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/iter.oxl:723