Skip to content

Commit

Permalink
auto merge of #10140 : brson/rust/comm, r=alexcrichton
Browse files Browse the repository at this point in the history
Just putting this public trait into the correct module.
  • Loading branch information
bors committed Oct 29, 2013
2 parents 67d7be0 + e6fa2d0 commit 886819c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 6 additions & 1 deletion src/libstd/comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Message passing
use clone::Clone;
use kinds::Send;
use option::Option;
pub use rt::comm::SendDeferred;
use rtcomm = rt::comm;

/// A trait for things that can send multiple messages.
Expand All @@ -33,6 +32,12 @@ pub trait GenericSmartChan<T> {
fn try_send(&self, x: T) -> bool;
}

/// Trait for non-rescheduling send operations, similar to `send_deferred` on ChanOne.
pub trait SendDeferred<T> {
fn send_deferred(&self, val: T);
fn try_send_deferred(&self, val: T) -> bool;
}

/// A trait for things that can receive multiple messages.
pub trait GenericPort<T> {
/// Receives a message, or fails if the connection closes.
Expand Down
8 changes: 1 addition & 7 deletions src/libstd/rt/comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use select::{Select, SelectPort};
use unstable::atomics::{AtomicUint, AtomicOption, Acquire, Relaxed, SeqCst};
use unstable::sync::UnsafeArc;
use util::Void;
use comm::{GenericChan, GenericSmartChan, GenericPort, Peekable};
use comm::{GenericChan, GenericSmartChan, GenericPort, Peekable, SendDeferred};
use cell::Cell;
use clone::Clone;
use tuple::ImmutableTuple;
Expand Down Expand Up @@ -421,12 +421,6 @@ impl<T> Drop for PortOne<T> {
}
}

/// Trait for non-rescheduling send operations, similar to `send_deferred` on ChanOne.
pub trait SendDeferred<T> {
fn send_deferred(&self, val: T);
fn try_send_deferred(&self, val: T) -> bool;
}

struct StreamPayload<T> {
val: T,
next: PortOne<StreamPayload<T>>
Expand Down

0 comments on commit 886819c

Please sign in to comment.