Skip to content

Commit 5535313

Browse files
committed
auto merge of #10562 : ongardie/rust/master, r=brson
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. See [rust-dev] "select on std::comm::Port and different types" at https://mail.mozilla.org/pipermail/rust-dev/2013-November/006735.html for background.
2 parents ad6f6cb + 7304326 commit 5535313

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
@@ -81,16 +81,17 @@ pub trait Peekable<T> {
8181
fn peek(&self) -> bool;
8282
}
8383

84-
pub struct PortOne<T> { priv x: rtcomm::PortOne<T> }
85-
pub struct ChanOne<T> { priv x: rtcomm::ChanOne<T> }
84+
/* priv is disabled to allow users to get at traits like Select. */
85+
pub struct PortOne<T> { /* priv */ x: rtcomm::PortOne<T> }
86+
pub struct ChanOne<T> { /* priv */ x: rtcomm::ChanOne<T> }
8687

8788
pub fn oneshot<T: Send>() -> (PortOne<T>, ChanOne<T>) {
8889
let (p, c) = rtcomm::oneshot();
8990
(PortOne { x: p }, ChanOne { x: c })
9091
}
9192

92-
pub struct Port<T> { priv x: rtcomm::Port<T> }
93-
pub struct Chan<T> { priv x: rtcomm::Chan<T> }
93+
pub struct Port<T> { /* priv */ x: rtcomm::Port<T> }
94+
pub struct Chan<T> { /* priv */ x: rtcomm::Chan<T> }
9495

9596
pub fn stream<T: Send>() -> (Port<T>, Chan<T>) {
9697
let (p, c) = rtcomm::stream();
@@ -184,7 +185,7 @@ impl<T: Send> Peekable<T> for Port<T> {
184185
}
185186

186187

187-
pub struct SharedChan<T> { priv x: rtcomm::SharedChan<T> }
188+
pub struct SharedChan<T> { /* priv */ x: rtcomm::SharedChan<T> }
188189

189190
impl<T: Send> SharedChan<T> {
190191
pub fn new(c: Chan<T>) -> SharedChan<T> {
@@ -226,7 +227,7 @@ impl<T: Send> Clone for SharedChan<T> {
226227
}
227228
}
228229

229-
pub struct SharedPort<T> { priv x: rtcomm::SharedPort<T> }
230+
pub struct SharedPort<T> { /* priv */ x: rtcomm::SharedPort<T> }
230231

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

0 commit comments

Comments
 (0)