Update iterator.md

将advance/functional-programing/iterator.md中的消费性适配器笔误改成消费者适配器
pull/1536/head
eclouder 1 week ago committed by GitHub
parent 57b7b637e5
commit c0174ec5f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -223,7 +223,7 @@ fn main() {
#### 消费者适配器
只要迭代器上的某个方法 `A` 在其内部调用了 `next` 方法,那么 `A` 就被称为**消费适配器**:因为 `next` 方法会消耗掉迭代器上的元素,所以方法 `A` 的调用也会消耗掉迭代器上的元素。
只要迭代器上的某个方法 `A` 在其内部调用了 `next` 方法,那么 `A` 就被称为**消费适配器**:因为 `next` 方法会消耗掉迭代器上的元素,所以方法 `A` 的调用也会消耗掉迭代器上的元素。
其中一个例子是 `sum` 方法,它会拿走迭代器的所有权,然后通过不断调用 `next` 方法对里面的元素进行求和:

Loading…
Cancel
Save