Update iterator.md

pull/903/head
allrightsreserved 3 years ago committed by GitHub
parent a9f92a5f55
commit 1b7b2969fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -408,7 +408,7 @@ assert_eq!(18, sum);
- `zip` 把两个迭代器合并成一个迭代器,新迭代器中,每个元素都是一个元组,由之前两个迭代器的元素组成。例如将**形如** `[1, 2, 3, 4, 5]``[2, 3, 4, 5]` 的迭代器合并后,新的迭代器形如 `[(1, 2),(2, 3),(3, 4),(4, 5)]`
- `map` 是将迭代器中的值经过映射后,转换成新的值[2, 6, 12, 20]
- `filter` 对迭代器中的元素进行过滤,若闭包返回 `true` 则保留元素,反之剔除[6, 12]
- `filter` 对迭代器中的元素进行过滤,若闭包返回 `true` 则保留元素[6, 12],反之剔除
`sum` 是消费者适配器,对迭代器中的所有元素求和,最终返回一个 `u32``18`

Loading…
Cancel
Save