Skip to content

Commit 5c498ce

Browse files
committed
---
yaml --- r: 80784 b: refs/heads/try c: 9357f8f h: refs/heads/master v: v3
1 parent 2b5e242 commit 5c498ce

File tree

3 files changed

+41
-12
lines changed

3 files changed

+41
-12
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: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cbd1eefbd350797b783df119fed7956d7e1c74ad
5-
refs/heads/try: 561f1b006321501dfe5a059444fc8f560010c2ba
5+
refs/heads/try: 9357f8f4cdc6d3a7c454d0b2e3ffbaad997f315e
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libstd/comm.rs

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,6 @@ pub fn stream<T: Send>() -> (Port<T>, Chan<T>) {
6666
(Port { x: p }, Chan { x: c })
6767
}
6868

69-
pub struct SharedChan<T> { x: rtcomm::SharedChan<T> }
70-
71-
impl<T: Send> SharedChan<T> {
72-
pub fn new(c: Chan<T>) -> SharedChan<T> {
73-
let Chan { x: c } = c;
74-
SharedChan { x: rtcomm::SharedChan::new(c) }
75-
}
76-
}
77-
7869
impl<T: Send> ChanOne<T> {
7970
pub fn send(self, val: T) {
8071
let ChanOne { x: c } = self;
@@ -161,6 +152,16 @@ impl<T: Send> Peekable<T> for Port<T> {
161152
}
162153
}
163154

155+
156+
pub struct SharedChan<T> { x: rtcomm::SharedChan<T> }
157+
158+
impl<T: Send> SharedChan<T> {
159+
pub fn new(c: Chan<T>) -> SharedChan<T> {
160+
let Chan { x: c } = c;
161+
SharedChan { x: rtcomm::SharedChan::new(c) }
162+
}
163+
}
164+
164165
impl<T: Send> GenericChan<T> for SharedChan<T> {
165166
fn send(&self, val: T) {
166167
let &SharedChan { x: ref c } = self;
@@ -193,3 +194,31 @@ impl<T> Clone for SharedChan<T> {
193194
SharedChan { x: c.clone() }
194195
}
195196
}
197+
198+
pub struct SharedPort<T> { x: rtcomm::SharedPort<T> }
199+
200+
impl<T: Send> SharedPort<T> {
201+
pub fn new(p: Port<T>) -> SharedPort<T> {
202+
let Port { x: p } = p;
203+
SharedPort { x: rtcomm::SharedPort::new(p) }
204+
}
205+
}
206+
207+
impl<T: Send> GenericPort<T> for SharedPort<T> {
208+
fn recv(&self) -> T {
209+
let &SharedPort { x: ref p } = self;
210+
p.recv()
211+
}
212+
213+
fn try_recv(&self) -> Option<T> {
214+
let &SharedPort { x: ref p } = self;
215+
p.try_recv()
216+
}
217+
}
218+
219+
impl<T> Clone for SharedPort<T> {
220+
fn clone(&self) -> SharedPort<T> {
221+
let &SharedPort { x: ref p } = self;
222+
SharedPort { x: p.clone() }
223+
}
224+
}

branches/try/src/libstd/iter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,7 @@ pub fn count<A>(start: A, step: A) -> Counter<A> {
17191719
Counter{state: start, step: step}
17201720
}
17211721

1722-
/// An iterator over the range [start, stop)
1722+
/// A range of numbers from [0, N)
17231723
#[deriving(Clone, DeepClone)]
17241724
pub struct Range<A> {
17251725
priv state: A,
@@ -1765,7 +1765,7 @@ impl<A: Sub<A, A> + Integer + Ord + Clone> DoubleEndedIterator<A> for Range<A> {
17651765
}
17661766
}
17671767

1768-
/// An iterator over the range [start, stop]
1768+
/// A range of numbers from [0, N]
17691769
#[deriving(Clone, DeepClone)]
17701770
pub struct RangeInclusive<A> {
17711771
priv range: Range<A>,

0 commit comments

Comments
 (0)