Skip to content

std: Move the SendDeferred trait to std::comm #10140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 29, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -427,12 +427,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