Struct bchannel::Sender [] [src]

pub struct Sender<T: Send, E: Send> {
    // some fields omitted
}

The sending end of the channel.

Methods

impl<T, E> Sender<T, E> where T: Send + 'static, E: Send + 'static

fn from_old(v: Sender<CommMsg<T, E>>) -> Sender<T, E>

Converts an old-stype Sender to a bchannel Sender.

fn into_inner(self) -> Sender<CommMsg<T, E>>

Returns the old-style Sender that is containd inside this Sender.

fn send(&self, t: T) -> Result<(), T>

Sends a message through the channel. Returns Ok(()) if the sending might succeed, and returns an Err with the message that you tried to send in the event that the sending surely failed.

fn send_all<I: Iterator<Item=T>>(&self, i: I) -> Result<(), (T, I)>

Tries to send all of the messages in an iterator. Returns Ok(()) if the sending might succeed and returns Err with a tuple containing the message that failed to send, and the remaining iterator.

fn close(self)

Closes the sending end of the channel.

fn error(self, e: E) -> Result<(), E>

Closes the sending end of the channel with an error.

fn is_closed(&self) -> bool

Returns true if any message has failed to send.

Trait Implementations

impl<T, E> Clone for Sender<T, E> where T: Send + 'static, E: Send + 'static

fn clone(&self) -> Sender<T, E>

fn clone_from(&mut self, source: &Self)

impl<T: Send, E: Send> Send for Sender<T, E>