Suggest mut_iter and move_iter when iterating over vectors, as well as iter.

Chris Morgan
2013-12-10 21:06:06 -08:00
parent a035f9a851
commit 5a08688764
+3 -1
@@ -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.