diff options
| author | bors <bors@rust-lang.org> | 2013-05-18 04:07:27 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-05-18 04:07:27 -0700 |
| commit | 3a323c1b2d755b86b1987bba3454bb2f0f92b1c8 (patch) | |
| tree | f40a70ca983986a7333a3764dd95887e208fef11 /src/libstd | |
| parent | eb0e2f45ec5eb84ac3b30e7ce92fb70415d232d3 (diff) | |
| parent | 4b13895c2f43024b2b0986d4c2ddcb742926c3c6 (diff) | |
| download | rust-3a323c1b2d755b86b1987bba3454bb2f0f92b1c8.tar.gz rust-3a323c1b2d755b86b1987bba3454bb2f0f92b1c8.zip | |
auto merge of #6565 : osaut/rust/futures, r=thestinger
* The example given in future.rs was corrected. * I have added a small section describing futures in tutorial on tasks. It is far from being complete as I am stil learning ! (This is an updated version of PR 6537).
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/future.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/libstd/future.rs b/src/libstd/future.rs index be33c0f4663..ef9318e8d3d 100644 --- a/src/libstd/future.rs +++ b/src/libstd/future.rs @@ -1,4 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -15,9 +15,11 @@ * # Example * * ~~~ - * let delayed_fib = future::spawn {|| fib(5000) }; + * # fn fib(n: uint) -> uint {42}; + * # fn make_a_sandwich() {}; + * let mut delayed_fib = std::future::spawn (|| fib(5000) ); * make_a_sandwich(); - * io::println(fmt!("fib(5000) = %?", delayed_fib.get())) + * println(fmt!("fib(5000) = %?", delayed_fib.get())) * ~~~ */ @@ -51,7 +53,7 @@ priv enum FutureState<A> { /// Methods on the `future` type pub impl<A:Copy> Future<A> { fn get(&mut self) -> A { - //! Get the value of the future + //! Get the value of the future. *(self.get_ref()) } } @@ -87,7 +89,7 @@ pub impl<A> Future<A> { pub fn from_value<A>(val: A) -> Future<A> { /*! - * Create a future from a value + * Create a future from a value. * * The value is immediately available and calling `get` later will * not block. @@ -117,7 +119,7 @@ pub fn from_fn<A>(f: ~fn() -> A) -> Future<A> { /*! * Create a future from a function. * - * The first time that the value is requested it will be retreived by + * The first time that the value is requested it will be retrieved by * calling the function. Note that this function is a local * function. It is not spawned into another task. */ |
