Struct chan::Receiver [−][src]
pub struct Receiver<T>(_);
The receiving half of a channel.
Receivers can be cloned any number of times and sent to other threads.
Receivers also implement Sync
, which means they can be shared among
threads without cloning if the channels can be proven to outlive the
execution of the threads.
When all receiving halves of a channel are dropped, no special action is taken. If the buffer in the channel is full, all sends will block indefinitely.
Methods
impl<T> Receiver<T>
[src]
impl<T> Receiver<T>
pub fn recv(&self) -> Option<T>
[src]
pub fn recv(&self) -> Option<T>
Receive a value on this channel.
If this is an asnychronous channel, recv
only blocks when the
buffer is empty.
If this is a synchronous channel, recv
only blocks when the buffer
is empty.
If this is a rendezvous channel, recv
blocks until a corresponding
send
sends a value.
For all channels, if the channel is closed and the buffer is empty,
then recv
always and immediately returns None
. (If the buffer is
non-empty on a closed channel, then values from the buffer are
returned.)
Values are guaranteed to be received in the same order that they are sent.
This operation will never panic!
but it can deadlock if the channel
is never closed.
ⓘImportant traits for Iter<T>pub fn iter(&self) -> Iter<T>
[src]
pub fn iter(&self) -> Iter<T>
Return an iterator for receiving values on this channel.
This iterator yields values (blocking if necessary) until the channel is closed.
Trait Implementations
impl<T> IntoIterator for Receiver<T>
[src]
impl<T> IntoIterator for Receiver<T>
type Item = T
The type of the elements being iterated over.
type IntoIter = Iter<T>
Which kind of iterator are we turning this into?
ⓘImportant traits for Iter<T>fn into_iter(self) -> Iter<T>
[src]
fn into_iter(self) -> Iter<T>
Creates an iterator from a value. Read more
impl<'a, T> IntoIterator for &'a Receiver<T>
[src]
impl<'a, T> IntoIterator for &'a Receiver<T>
type Item = T
The type of the elements being iterated over.
type IntoIter = Iter<T>
Which kind of iterator are we turning this into?
ⓘImportant traits for Iter<T>fn into_iter(self) -> Iter<T>
[src]
fn into_iter(self) -> Iter<T>
Creates an iterator from a value. Read more
impl<T: Debug> Debug for Receiver<T>
[src]
impl<T: Debug> Debug for Receiver<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T> Clone for Receiver<T>
[src]
impl<T> Clone for Receiver<T>
fn clone(&self) -> Receiver<T>
[src]
fn clone(&self) -> Receiver<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T> Drop for Receiver<T>
[src]
impl<T> Drop for Receiver<T>
impl<T> Hash for Receiver<T>
[src]
impl<T> Hash for Receiver<T>
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash<H: Hasher>(&self, state: &mut H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T> PartialEq for Receiver<T>
[src]
impl<T> PartialEq for Receiver<T>
fn eq(&self, other: &Receiver<T>) -> bool
[src]
fn eq(&self, other: &Receiver<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<T> Eq for Receiver<T>
[src]
impl<T> Eq for Receiver<T>