Skip to content

Commit 3cb0fcb

Browse files
committed
De-export core::comm
1 parent 0c82c00 commit 3cb0fcb

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

src/libcore/comm.rs

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@
3030
use either::Either;
3131
use libc::size_t;
3232

33-
export Port;
34-
export Chan;
35-
export send;
36-
export recv;
37-
export peek;
38-
export recv_chan;
39-
export select2;
40-
export methods;
41-
export listen;
4233

4334

4435
/**
@@ -48,7 +39,7 @@ export listen;
4839
* transmitted. If a port value is copied, both copies refer to the same
4940
* port. Ports may be associated with multiple `chan`s.
5041
*/
51-
enum Port<T: Send> {
42+
pub enum Port<T: Send> {
5243
Port_(@PortPtr<T>)
5344
}
5445

@@ -64,12 +55,12 @@ enum Port<T: Send> {
6455
* data will be silently dropped. Channels may be duplicated and
6556
* themselves transmitted over other channels.
6657
*/
67-
enum Chan<T: Send> {
58+
pub enum Chan<T: Send> {
6859
Chan_(port_id)
6960
}
7061

7162
/// Constructs a port
72-
fn Port<T: Send>() -> Port<T> {
63+
pub fn Port<T: Send>() -> Port<T> {
7364
Port_(@PortPtr(rustrt::new_port(sys::size_of::<T>() as size_t)))
7465
}
7566

@@ -92,7 +83,7 @@ impl<T: Send> Chan<T> {
9283
}
9384

9485
/// Open a new receiving channel for the duration of a function
95-
fn listen<T: Send, U>(f: fn(Chan<T>) -> U) -> U {
86+
pub fn listen<T: Send, U>(f: fn(Chan<T>) -> U) -> U {
9687
let po = Port();
9788
f(po.chan())
9889
}
@@ -167,15 +158,15 @@ fn as_raw_port<T: Send, U>(ch: comm::Chan<T>, f: fn(*rust_port) -> U) -> U {
167158
* Constructs a channel. The channel is bound to the port used to
168159
* construct it.
169160
*/
170-
fn Chan<T: Send>(p: Port<T>) -> Chan<T> {
161+
pub fn Chan<T: Send>(p: Port<T>) -> Chan<T> {
171162
Chan_(rustrt::get_port_id((**p).po))
172163
}
173164

174165
/**
175166
* Sends data over a channel. The sent data is moved into the channel,
176167
* whereupon the caller loses access to it.
177168
*/
178-
fn send<T: Send>(ch: Chan<T>, +data: T) {
169+
pub fn send<T: Send>(ch: Chan<T>, +data: T) {
179170
let Chan_(p) = ch;
180171
let data_ptr = ptr::addr_of(data) as *();
181172
let res = rustrt::rust_port_id_send(p, data_ptr);
@@ -190,13 +181,13 @@ fn send<T: Send>(ch: Chan<T>, +data: T) {
190181
* Receive from a port. If no data is available on the port then the
191182
* task will block until data becomes available.
192183
*/
193-
fn recv<T: Send>(p: Port<T>) -> T { recv_((**p).po) }
184+
pub fn recv<T: Send>(p: Port<T>) -> T { recv_((**p).po) }
194185

195186
/// Returns true if there are messages available
196-
fn peek<T: Send>(p: Port<T>) -> bool { peek_((**p).po) }
187+
pub fn peek<T: Send>(p: Port<T>) -> bool { peek_((**p).po) }
197188

198189
#[doc(hidden)]
199-
fn recv_chan<T: Send>(ch: comm::Chan<T>) -> T {
190+
pub fn recv_chan<T: Send>(ch: comm::Chan<T>) -> T {
200191
as_raw_port(ch, |x|recv_(x))
201192
}
202193

@@ -231,7 +222,7 @@ fn peek_(p: *rust_port) -> bool {
231222
}
232223

233224
/// Receive on one of two ports
234-
fn select2<A: Send, B: Send>(p_a: Port<A>, p_b: Port<B>)
225+
pub fn select2<A: Send, B: Send>(p_a: Port<A>, p_b: Port<B>)
235226
-> Either<A, B> {
236227
let ports = ~[(**p_a).po, (**p_b).po];
237228
let yield = 0, yieldp = ptr::addr_of(yield);

0 commit comments

Comments
 (0)