method iter.map
A lazy sequence of f(x) for every element x.
Example:
fn main() io {
print("{[1, 2, 3].iter().map(x => x * x).collect()}")
}Output
[1, 4, 9]
pub(api) move fn map<U, effect F>(f: fn(T) -> U F escaping) -> iter<U> FComplexity. O(1) to build; `f` is called once per pulled element.
Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
f | fn(T) -> U F escaping |
Returns
iter<U> F
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/iter.oxl:123