Skip to content

Commit ca09b4f

Browse files
committed
---
yaml --- r: 152166 b: refs/heads/try2 c: 1959925 h: refs/heads/master v: v3
1 parent d1fbac8 commit ca09b4f

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
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 66ee71a51732f3d36cd6efe14ca1e02031d26fb3
8+
refs/heads/try2: 1959925e514d9ecd5149435a3530dbdf0191f117
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/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)