From 5a08688764676ecf4ddef757e93c737cc64d6bd1 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Tue, 10 Dec 2013 21:06:06 -0800 Subject: [PATCH] Suggest mut_iter and move_iter when iterating over vectors, as well as iter. --- Doc-FAQ-Cheatsheet.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Doc-FAQ-Cheatsheet.md b/Doc-FAQ-Cheatsheet.md index 783ae54..a68055d 100644 --- a/Doc-FAQ-Cheatsheet.md +++ b/Doc-FAQ-Cheatsheet.md @@ -71,11 +71,13 @@ Use the [`iter`](http://static.rust-lang.org/doc/master/std/vec/trait.ImmutableV ```rust let values: ~[int] = ~[1, 2, 3, 4, 5]; -for value in values.iter() { +for value in values.iter() { // value: &int println(value.to_str()); } ``` +(See also [`mut_iter`](http://static.rust-lang.org/doc/master/std/vec/trait.MutableVector.html#tymethod.mut_iter) which yields `&mut int` and [`move_iter`](http://static.rust-lang.org/doc/master/std/vec/trait.OwnedVector.html#tymethod.move_iter) which yields `int` while consuming the `values` vector.) + # Contributing to this page For small examples, have full type annotations, as much as is reasonable, to keep it clear what, exactly, everything is doing. Try to link to the API docs, as well.