diff options
| author | Diego Ongaro <ongaro@cs.stanford.edu> | 2013-11-15 16:34:28 -0800 |
|---|---|---|
| committer | Diego Ongaro <ongaro@cs.stanford.edu> | 2013-11-18 17:29:42 -0800 |
| commit | 7304326ff91b6ad2d43e9a6fc4cc4a2c5ecf94c0 (patch) | |
| tree | 1bd81123668d57b995c165d91557d8f90423831b /src/libstd/comm.rs | |
| parent | 9062988610dc28201c552854a2363157fc297fa5 (diff) | |
| download | rust-7304326ff91b6ad2d43e9a6fc4cc4a2c5ecf94c0.tar.gz rust-7304326ff91b6ad2d43e9a6fc4cc4a2c5ecf94c0.zip | |
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.
Diffstat (limited to 'src/libstd/comm.rs')
| -rw-r--r-- | src/libstd/comm.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libstd/comm.rs b/src/libstd/comm.rs index 038598a29b8..3a7b640aabe 100644 --- a/src/libstd/comm.rs +++ b/src/libstd/comm.rs @@ -55,16 +55,17 @@ pub trait Peekable<T> { fn peek(&self) -> bool; } -pub struct PortOne<T> { priv x: rtcomm::PortOne<T> } -pub struct ChanOne<T> { priv x: rtcomm::ChanOne<T> } +/* priv is disabled to allow users to get at traits like Select. */ +pub struct PortOne<T> { /* priv */ x: rtcomm::PortOne<T> } +pub struct ChanOne<T> { /* priv */ x: rtcomm::ChanOne<T> } pub fn oneshot<T: Send>() -> (PortOne<T>, ChanOne<T>) { let (p, c) = rtcomm::oneshot(); (PortOne { x: p }, ChanOne { x: c }) } -pub struct Port<T> { priv x: rtcomm::Port<T> } -pub struct Chan<T> { priv x: rtcomm::Chan<T> } +pub struct Port<T> { /* priv */ x: rtcomm::Port<T> } +pub struct Chan<T> { /* priv */ x: rtcomm::Chan<T> } pub fn stream<T: Send>() -> (Port<T>, Chan<T>) { let (p, c) = rtcomm::stream(); @@ -158,7 +159,7 @@ impl<T: Send> Peekable<T> for Port<T> { } -pub struct SharedChan<T> { priv x: rtcomm::SharedChan<T> } +pub struct SharedChan<T> { /* priv */ x: rtcomm::SharedChan<T> } impl<T: Send> SharedChan<T> { pub fn new(c: Chan<T>) -> SharedChan<T> { @@ -200,7 +201,7 @@ impl<T: Send> Clone for SharedChan<T> { } } -pub struct SharedPort<T> { priv x: rtcomm::SharedPort<T> } +pub struct SharedPort<T> { /* priv */ x: rtcomm::SharedPort<T> } impl<T: Send> SharedPort<T> { pub fn new(p: Port<T>) -> SharedPort<T> { |
