Skip to content

Commit a908e39

Browse files
committed
---
yaml --- r: 120815 b: refs/heads/dist-snap c: 1959925 h: refs/heads/master i: 120813: cc19c78 120811: d4fae84 120807: b4dfa15 120799: 67c2943 v: v3
1 parent 0bd908b commit a908e39

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 1813e5aa1a03b0596b8de7abd1af31edf5d6098f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 66ee71a51732f3d36cd6efe14ca1e02031d26fb3
9+
refs/heads/dist-snap: 1959925e514d9ecd5149435a3530dbdf0191f117
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/doc/tutorial.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,7 +2062,7 @@ extern crate collections;
20622062
type Set<T> = collections::HashMap<T, ()>;
20632063
20642064
struct Stack<T> {
2065-
elements: ~[T]
2065+
elements: Vec<T>
20662066
}
20672067
20682068
enum Option<T> {
@@ -2320,7 +2320,7 @@ trait Seq<T> {
23202320
fn length(&self) -> uint;
23212321
}
23222322
2323-
impl<T> Seq<T> for ~[T] {
2323+
impl<T> Seq<T> for Vec<T> {
23242324
fn length(&self) -> uint { self.len() }
23252325
}
23262326
~~~~
@@ -2392,7 +2392,7 @@ generic types.
23922392

23932393
~~~~
23942394
# trait Printable { fn print(&self); }
2395-
fn print_all<T: Printable>(printable_things: ~[T]) {
2395+
fn print_all<T: Printable>(printable_things: Vec<T>) {
23962396
for thing in printable_things.iter() {
23972397
thing.print();
23982398
}
@@ -2410,10 +2410,10 @@ as in this version of `print_all` that copies elements.
24102410

24112411
~~~
24122412
# trait Printable { fn print(&self); }
2413-
fn print_all<T: Printable + Clone>(printable_things: ~[T]) {
2413+
fn print_all<T: Printable + Clone>(printable_things: Vec<T>) {
24142414
let mut i = 0;
24152415
while i < printable_things.len() {
2416-
let copy_of_thing = printable_things[i].clone();
2416+
let copy_of_thing = printable_things.get(i).clone();
24172417
copy_of_thing.print();
24182418
i += 1;
24192419
}
@@ -2438,11 +2438,11 @@ However, consider this function:
24382438
# fn new_circle() -> int { 1 }
24392439
trait Drawable { fn draw(&self); }
24402440
2441-
fn draw_all<T: Drawable>(shapes: ~[T]) {
2441+
fn draw_all<T: Drawable>(shapes: Vec<T>) {
24422442
for shape in shapes.iter() { shape.draw(); }
24432443
}
24442444
# let c: Circle = new_circle();
2445-
# draw_all(~[c]);
2445+
# draw_all(vec![c]);
24462446
~~~~
24472447

24482448
You can call that on a vector of circles, or a vector of rectangles
@@ -2742,9 +2742,9 @@ mod farm {
27422742
# pub type Chicken = int;
27432743
# struct Human(int);
27442744
# impl Human { pub fn rest(&self) { } }
2745-
# pub fn make_me_a_farm() -> Farm { Farm { chickens: ~[], farmer: Human(0) } }
2745+
# pub fn make_me_a_farm() -> Farm { Farm { chickens: vec![], farmer: Human(0) } }
27462746
pub struct Farm {
2747-
chickens: ~[Chicken],
2747+
chickens: Vec<Chicken>,
27482748
pub farmer: Human
27492749
}
27502750

0 commit comments

Comments
 (0)