Skip to content

Commit 7304326

Browse files
committed
Disable priv in std::comm::Port, etc
It's useful to allow users to get at the internal std::rc::comm::Port, and other such fields, since they implement important traits like Select.
1 parent 9062988 commit 7304326

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/libstd/comm.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,17 @@ pub trait Peekable<T> {
5555
fn peek(&self) -> bool;
5656
}
5757

58-
pub struct PortOne<T> { priv x: rtcomm::PortOne<T> }
59-
pub struct ChanOne<T> { priv x: rtcomm::ChanOne<T> }
58+
/* priv is disabled to allow users to get at traits like Select. */
59+
pub struct PortOne<T> { /* priv */ x: rtcomm::PortOne<T> }
60+
pub struct ChanOne<T> { /* priv */ x: rtcomm::ChanOne<T> }
6061

6162
pub fn oneshot<T: Send>() -> (PortOne<T>, ChanOne<T>) {
6263
let (p, c) = rtcomm::oneshot();
6364
(PortOne { x: p }, ChanOne { x: c })
6465
}
6566

66-
pub struct Port<T> { priv x: rtcomm::Port<T> }
67-
pub struct Chan<T> { priv x: rtcomm::Chan<T> }
67+
pub struct Port<T> { /* priv */ x: rtcomm::Port<T> }
68+
pub struct Chan<T> { /* priv */ x: rtcomm::Chan<T> }
6869

6970
pub fn stream<T: Send>() -> (Port<T>, Chan<T>) {
7071
let (p, c) = rtcomm::stream();
@@ -158,7 +159,7 @@ impl<T: Send> Peekable<T> for Port<T> {
158159
}
159160

160161

161-
pub struct SharedChan<T> { priv x: rtcomm::SharedChan<T> }
162+
pub struct SharedChan<T> { /* priv */ x: rtcomm::SharedChan<T> }
162163

163164
impl<T: Send> SharedChan<T> {
164165
pub fn new(c: Chan<T>) -> SharedChan<T> {
@@ -200,7 +201,7 @@ impl<T: Send> Clone for SharedChan<T> {
200201
}
201202
}
202203

203-
pub struct SharedPort<T> { priv x: rtcomm::SharedPort<T> }
204+
pub struct SharedPort<T> { /* priv */ x: rtcomm::SharedPort<T> }
204205

205206
impl<T: Send> SharedPort<T> {
206207
pub fn new(p: Port<T>) -> SharedPort<T> {

0 commit comments

Comments
 (0)