diff options
| author | Christoph Burgdorf <christoph.burgdorf@bvsn.org> | 2014-05-31 23:33:03 +0200 |
|---|---|---|
| committer | Christoph Burgdorf <christoph.burgdorf@bvsn.org> | 2014-05-31 23:33:03 +0200 |
| commit | b657af8946cb0f1512965b0c3fa61b0984dcf7ed (patch) | |
| tree | 7bcab2cc8dd565a79647b3fea3fc531dbc4e1c2b /src/doc/tutorial.md | |
| parent | 60b4a97de70b9b40550a576b11c5670899be00c4 (diff) | |
| download | rust-b657af8946cb0f1512965b0c3fa61b0984dcf7ed.tar.gz rust-b657af8946cb0f1512965b0c3fa61b0984dcf7ed.zip | |
Rename variable in tutorial
Renamed `owned_box` to `on_the_heap` to use a consistent naming across the tutorial and the life time guide. Also it makes the example easier to grasp.
Diffstat (limited to 'src/doc/tutorial.md')
| -rw-r--r-- | src/doc/tutorial.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md index 98cb3cd86fb..d75071b76ed 100644 --- a/src/doc/tutorial.md +++ b/src/doc/tutorial.md @@ -1429,7 +1429,7 @@ contains a point, but allocated in a different location: ~~~ # struct Point { x: f64, y: f64 } let on_the_stack : Point = Point { x: 3.0, y: 4.0 }; -let owned_box : Box<Point> = box Point { x: 7.0, y: 9.0 }; +let on_the_heap : Box<Point> = box Point { x: 7.0, y: 9.0 }; ~~~ Suppose we want to write a procedure that computes the distance @@ -1454,9 +1454,9 @@ Now we can call `compute_distance()` in various ways: ~~~ # struct Point{ x: f64, y: f64 }; # let on_the_stack : Point = Point { x: 3.0, y: 4.0 }; -# let owned_box : Box<Point> = box Point { x: 7.0, y: 9.0 }; +# let on_the_heap : Box<Point> = box Point { x: 7.0, y: 9.0 }; # fn compute_distance(p1: &Point, p2: &Point) -> f64 { 0.0 } -compute_distance(&on_the_stack, owned_box); +compute_distance(&on_the_stack, on_the_heap); ~~~ Here the `&` operator is used to take the address of the variable |
