Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
9bf73d2
Explained the difference between ownership iteration and reference it…
srinivasreddy Mar 2, 2016
a3c9afa
addressed review comments - grammar corrections, space additions
srinivasreddy Mar 2, 2016
2dc723d
made print message similar across two loops
srinivasreddy Mar 2, 2016
d3ae29d
Ignore a rustdoc test that does not work on beta
brson Mar 3, 2016
48fd993
std: Stabilize `into_*` ASCII methods
alexcrichton Mar 3, 2016
311ff03
Responsive layout correction.
Mar 3, 2016
d2df551
added ignore
srinivasreddy Mar 3, 2016
4da9e9f
mk: Distribute fewer TARGET_CRATES
alexcrichton Mar 2, 2016
ddd2e99
[rustbuild] fix cross compilation of std for mips(el)-linux-musl
Mar 3, 2016
cf29344
truncate i8-s to i1-s when loading constants
arielb1 Mar 3, 2016
633cd84
`usize` is now a proper ctype, so fix cmp_slice
ubsan Mar 4, 2016
75c14e1
Rollup merge of #32002 - srinivasreddy:vector_doc, r=Manishearth
Manishearth Mar 4, 2016
e3a0ae8
Rollup merge of #32009 - alexcrichton:trim-fulldeps, r=brson
Manishearth Mar 4, 2016
d5b66f7
Rollup merge of #32017 - brson:ignoretest, r=nikomatsakis
Manishearth Mar 4, 2016
a8a42c3
Rollup merge of #32020 - alexcrichton:stabilize-into-ascii, r=brson
Manishearth Mar 4, 2016
5d9c6c1
Rollup merge of #32022 - gohyda:master, r=alexcrichton
Manishearth Mar 4, 2016
a022de6
Rollup merge of #32027 - japaric:rustbuild-mips, r=alexcrichton
Manishearth Mar 4, 2016
714301a
Rollup merge of #32032 - arielb1:load-const, r=eddyb
Manishearth Mar 4, 2016
860e1fd
Rollup merge of #32035 - ubsan:master, r=bluss
Manishearth Mar 4, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
addressed review comments - grammar corrections, space additions
  • Loading branch information
srinivasreddy committed Mar 2, 2016
commit a3c9afa841aba127edac2bb60e2f2a720a51d8ac
17 changes: 12 additions & 5 deletions src/doc/book/vectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,30 +114,37 @@ for i in v {
println!("Take ownership of the vector and its element {}", i);
}
```
Note: You cannot use the vector again once you have iterated with ownership of the vector.
You can iterate the vector multiple times with reference iteration. For example, the following
code does not compile.

Note: You cannot use the vector again once you have iterated by taking ownership of the vector.
You can iterate the vector multiple times by taking a reference to the vector whilst iterating.
For example, the following code does not compile.

```rust
let mut v = vec![1, 2, 3, 4, 5];

for i in v {
println!("Take ownership of the vector and its element {}", i);
}

for i in v {
println!("Take ownership of the vector and its element {}", i);
}
```

Whereas the following works perfectly,

```rust
let mut v = vec![1, 2, 3, 4, 5];

for i in &v {
println!("A mutable reference to {}", i);
println!("This is a reference to {}", i);
}

for i in &v {
println!("A mutable reference to {}", i);
println!("This is a reference {}", i);
}
```

Vectors have many more useful methods, which you can read about in [their
API documentation][vec].

Expand Down