diff options
Diffstat (limited to 'src/libextra/future.rs')
| -rw-r--r-- | src/libextra/future.rs | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/src/libextra/future.rs b/src/libextra/future.rs index 640ced24bad..8d365c5a520 100644 --- a/src/libextra/future.rs +++ b/src/libextra/future.rs @@ -27,7 +27,6 @@ use std::cell::Cell; use std::comm::{PortOne, oneshot}; -use std::task; use std::util::replace; /// A type encapsulating the result of a computation which may not be complete @@ -130,29 +129,12 @@ impl<A:Send> Future<A> { let (port, chan) = oneshot(); - do task::spawn_with(chan) |chan| { + do spawn { chan.send(blk()); } Future::from_port(port) } - - pub fn spawn_with<B: Send>(v: B, blk: proc(B) -> A) -> Future<A> { - /*! - * Create a future from a unique closure taking one argument. - * - * The closure and its argument will be moved into a new task. The - * closure will be run and its result used as the value of the future. - */ - - let (port, chan) = oneshot(); - - do task::spawn_with((v, chan)) |(v, chan)| { - chan.send(blk(v)); - } - - Future::from_port(port) - } } #[cfg(test)] @@ -208,12 +190,6 @@ mod test { } #[test] - fn test_spawn_with() { - let mut f = Future::spawn_with(~"gale", |s| { s }); - assert_eq!(f.get(), ~"gale"); - } - - #[test] #[should_fail] fn test_futurefail() { let mut f = Future::spawn(|| fail!()); |
