diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2014-08-27 21:46:52 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2014-08-27 21:46:52 -0400 |
| commit | 1b487a890695e7d6dfbfe5dcd7d4fa0e8ca8003f (patch) | |
| tree | 552fabade603ab0d148a49ae3cf1abd3f399740a /src/libsync/comm | |
| parent | 3ee047ae1ffab454270bc1859b3beef3556ef8f9 (diff) | |
| download | rust-1b487a890695e7d6dfbfe5dcd7d4fa0e8ca8003f.tar.gz rust-1b487a890695e7d6dfbfe5dcd7d4fa0e8ca8003f.zip | |
Implement generalized object and type parameter bounds (Fixes #16462)
Diffstat (limited to 'src/libsync/comm')
| -rw-r--r-- | src/libsync/comm/mod.rs | 8 | ||||
| -rw-r--r-- | src/libsync/comm/select.rs | 20 |
2 files changed, 27 insertions, 1 deletions
diff --git a/src/libsync/comm/mod.rs b/src/libsync/comm/mod.rs index 16bcdd9bbb6..16f6eea6144 100644 --- a/src/libsync/comm/mod.rs +++ b/src/libsync/comm/mod.rs @@ -386,6 +386,14 @@ pub struct Receiver<T> { /// whenever `next` is called, waiting for a new message, and `None` will be /// returned when the corresponding channel has hung up. #[unstable] +#[cfg(not(stage0))] +pub struct Messages<'a, T:'a> { + rx: &'a Receiver<T> +} + +/// Stage0 only +#[cfg(stage0)] +#[unstable] pub struct Messages<'a, T> { rx: &'a Receiver<T> } diff --git a/src/libsync/comm/select.rs b/src/libsync/comm/select.rs index 737a4bfe299..dc9891dd1ee 100644 --- a/src/libsync/comm/select.rs +++ b/src/libsync/comm/select.rs @@ -76,6 +76,24 @@ pub struct Select { /// A handle to a receiver which is currently a member of a `Select` set of /// receivers. This handle is used to keep the receiver in the set as well as /// interact with the underlying receiver. +#[cfg(not(stage0))] +pub struct Handle<'rx, T:'rx> { + /// The ID of this handle, used to compare against the return value of + /// `Select::wait()` + id: uint, + selector: &'rx Select, + next: *mut Handle<'static, ()>, + prev: *mut Handle<'static, ()>, + added: bool, + packet: &'rx Packet+'rx, + + // due to our fun transmutes, we be sure to place this at the end. (nothing + // previous relies on T) + rx: &'rx Receiver<T>, +} + +/// Stage0 only +#[cfg(stage0)] pub struct Handle<'rx, T> { /// The ID of this handle, used to compare against the return value of /// `Select::wait()` @@ -84,7 +102,7 @@ pub struct Handle<'rx, T> { next: *mut Handle<'static, ()>, prev: *mut Handle<'static, ()>, added: bool, - packet: &'rx Packet, + packet: &'rx Packet+'rx, // due to our fun transmutes, we be sure to place this at the end. (nothing // previous relies on T) |
