|
1 |
| -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT |
| 1 | +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT |
2 | 2 | // file at the top-level directory of this distribution and at
|
3 | 3 | // http://rust-lang.org/COPYRIGHT.
|
4 | 4 | //
|
|
15 | 15 | * # Example
|
16 | 16 | *
|
17 | 17 | * ~~~
|
18 |
| - * let delayed_fib = future::spawn {|| fib(5000) }; |
| 18 | + * # fn fib(n: uint) -> uint {42}; |
| 19 | + * # fn make_a_sandwich() {}; |
| 20 | + * let mut delayed_fib = std::future::spawn (|| fib(5000) ); |
19 | 21 | * make_a_sandwich();
|
20 |
| - * io::println(fmt!("fib(5000) = %?", delayed_fib.get())) |
| 22 | + * println(fmt!("fib(5000) = %?", delayed_fib.get())) |
21 | 23 | * ~~~
|
22 | 24 | */
|
23 | 25 |
|
@@ -51,7 +53,7 @@ priv enum FutureState<A> {
|
51 | 53 | /// Methods on the `future` type
|
52 | 54 | pub impl<A:Copy> Future<A> {
|
53 | 55 | fn get(&mut self) -> A {
|
54 |
| - //! Get the value of the future |
| 56 | + //! Get the value of the future. |
55 | 57 | *(self.get_ref())
|
56 | 58 | }
|
57 | 59 | }
|
@@ -87,7 +89,7 @@ pub impl<A> Future<A> {
|
87 | 89 |
|
88 | 90 | pub fn from_value<A>(val: A) -> Future<A> {
|
89 | 91 | /*!
|
90 |
| - * Create a future from a value |
| 92 | + * Create a future from a value. |
91 | 93 | *
|
92 | 94 | * The value is immediately available and calling `get` later will
|
93 | 95 | * not block.
|
@@ -117,7 +119,7 @@ pub fn from_fn<A>(f: ~fn() -> A) -> Future<A> {
|
117 | 119 | /*!
|
118 | 120 | * Create a future from a function.
|
119 | 121 | *
|
120 |
| - * The first time that the value is requested it will be retreived by |
| 122 | + * The first time that the value is requested it will be retrieved by |
121 | 123 | * calling the function. Note that this function is a local
|
122 | 124 | * function. It is not spawned into another task.
|
123 | 125 | */
|
|
0 commit comments