method iter.flatMap
A lazy sequence of all elements of the sequences f(x) returns, in order.
Example:
fn main() io {
print("{[1, 2, 3].iter().flatMap(x => [x, x * 10].iter()).collect()}")
}Вывод
[1, 10, 2, 20, 3, 30]
pub(api) move fn flatMap<U, effect F>(f: fn(T) -> iter<U> F escaping) -> iter<U> FСложность. O(1) to build; `f` is called once per source element.
С версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
f | fn(T) -> iter<U> F escaping |
Возвращает
iter<U> F
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/core/iter.oxl:167