From ba41755069998bcaa5fbb3817cc98e97e83240d4 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Wed, 24 Jul 2013 18:36:23 -0400 Subject: [PATCH] improve container/iterator tutorial --- doc/tutorial-container.md | 12 +++++++----- 1 file 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 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