Skip to content

Commit 2758a78

Browse files
committed
---
yaml --- r: 37366 b: refs/heads/try c: 84c8549 h: refs/heads/master v: v3
1 parent 2bbff31 commit 2758a78

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 09bb07bed9166105ea961a42b5fff7739ae0d2e9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
5-
refs/heads/try: 50f9925fabbc738f7be0df8148c99fae3e975bb1
5+
refs/heads/try: 84c85496227e1b31f763dfd7e9a82c9b5da52407
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/src/libcore/future.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818

1919
use either::Either;
20-
use pipes::recv;
20+
use pipes::{recv, oneshot, ChanOne, PortOne, send_one, recv_one};
2121
use cast::copy_lifetime;
2222

2323
#[doc = "The future type"]
@@ -67,7 +67,7 @@ pub fn from_value<A>(val: A) -> Future<A> {
6767
Future {state: Forced(~(move val))}
6868
}
6969

70-
pub fn from_port<A:Send>(port: future_pipe::server::waiting<A>) ->
70+
pub fn from_port<A:Send>(port: PortOne<A>) ->
7171
Future<A> {
7272
/*!
7373
* Create a future from a port
@@ -82,7 +82,7 @@ pub fn from_port<A:Send>(port: future_pipe::server::waiting<A>) ->
8282
port_ <-> *port;
8383
let port = option::unwrap(move port_);
8484
match recv(move port) {
85-
future_pipe::completed(move data) => move data
85+
oneshot::send(move data) => move data
8686
}
8787
}
8888
}
@@ -107,12 +107,12 @@ pub fn spawn<A:Send>(blk: fn~() -> A) -> Future<A> {
107107
* value of the future.
108108
*/
109109

110-
let (chan, port) = future_pipe::init();
110+
let (chan, port) = oneshot::init();
111111

112112
let chan = ~mut Some(move chan);
113113
do task::spawn |move blk, move chan| {
114114
let chan = option::swap_unwrap(&mut *chan);
115-
future_pipe::client::completed(move chan, blk());
115+
send_one(move chan, blk());
116116
}
117117

118118
return from_port(move port);
@@ -168,12 +168,6 @@ pub fn with<A,B>(future: &Future<A>, blk: fn((&A)) -> B) -> B {
168168
blk(get_ref(future))
169169
}
170170

171-
proto! future_pipe (
172-
waiting:send<T:Send> {
173-
completed(T) -> !
174-
}
175-
)
176-
177171
#[allow(non_implicitly_copyable_typarams)]
178172
pub mod test {
179173
#[test]
@@ -184,8 +178,8 @@ pub mod test {
184178

185179
#[test]
186180
pub fn test_from_port() {
187-
let (ch, po) = future_pipe::init();
188-
future_pipe::client::completed(move ch, ~"whale");
181+
let (ch, po) = oneshot::init();
182+
send_one(move ch, ~"whale");
189183
let f = from_port(move po);
190184
assert get(&f) == ~"whale";
191185
}

0 commit comments

Comments
 (0)