Skip to content

Commit ba41755

Browse files
committed
improve container/iterator tutorial
1 parent 4517e39 commit ba41755

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

doc/tutorial-container.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,14 @@ impl Iterator<int> for ZeroStream {
108108
## Container iterators
109109
110110
Containers implement iteration over the contained elements by returning an
111-
iterator object. For example, vector slices have four iterators available:
111+
iterator object. For example, vector slices several iterators available:
112112
113-
* `vector.iter()`, for immutable references to the elements
114-
* `vector.mut_iter()`, for mutable references to the elements
115-
* `vector.rev_iter()`, for immutable references to the elements in reverse order
116-
* `vector.mut_rev_iter()`, for mutable references to the elements in reverse order
113+
* `iter()` and `rev_iter()`, for immutable references to the elements
114+
* `mut_iter()` and `mut_rev_iter()`, for mutable references to the elements
115+
* `consume_iter()` and `consume_rev_iter`, to move the elements out by-value
116+
117+
A typical mutable container will implement at least `iter()`, `mut_iter()` and
118+
`consume_iter()` along with the reverse variants if it maintains an order.
117119
118120
### Freezing
119121

0 commit comments

Comments
 (0)