auto merge of #10140 : brson/rust/comm, r=alexcrichton

Just putting this public trait into the correct module.
This commit is contained in:
bors 2013-10-29 13:37:08 -07:00
commit 886819cca1
2 changed files with 7 additions and 8 deletions

View File

@ -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.
@ -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.

View File

@ -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;
@ -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>>