diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-07-24 18:36:23 -0400 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-07-24 18:44:16 -0400 |
| commit | ba41755069998bcaa5fbb3817cc98e97e83240d4 (patch) | |
| tree | 8458a610bb32dee06957f1d455642067e5c70523 | |
| parent | 4517e3912581a0709d5862101e19896e57afc22c (diff) | |
| download | rust-ba41755069998bcaa5fbb3817cc98e97e83240d4.tar.gz rust-ba41755069998bcaa5fbb3817cc98e97e83240d4.zip | |
improve container/iterator tutorial
| -rw-r--r-- | doc/tutorial-container.md | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/doc/tutorial-container.md b/doc/tutorial-container.md index 1b195e99979..148afb4bda9 100644 --- a/doc/tutorial-container.md +++ b/doc/tutorial-container.md @@ -108,12 +108,14 @@ impl Iterator<int> for ZeroStream { ## Container iterators Containers implement iteration over the contained elements by returning an -iterator object. For example, vector slices have four iterators available: +iterator object. For example, vector slices several iterators available: -* `vector.iter()`, for immutable references to the elements -* `vector.mut_iter()`, for mutable references to the elements -* `vector.rev_iter()`, for immutable references to the elements in reverse order -* `vector.mut_rev_iter()`, for mutable references to the elements in reverse order +* `iter()` and `rev_iter()`, for immutable references to the elements +* `mut_iter()` and `mut_rev_iter()`, for mutable references to the elements +* `consume_iter()` and `consume_rev_iter`, to move the elements out by-value + +A typical mutable container will implement at least `iter()`, `mut_iter()` and +`consume_iter()` along with the reverse variants if it maintains an order. ### Freezing |
