Struct crossbeam_channel::IntoIter[][src]

pub struct IntoIter<T> { /* fields omitted */ }

A blocking iterator over messages in a channel.

Each call to next blocks waiting for the next message and then returns it. However, if the channel becomes empty and disconnected, it returns None without blocking.

Examples

use std::thread;
use crossbeam_channel::unbounded;

let (s, r) = unbounded();

thread::spawn(move || {
    s.send(1).unwrap();
    s.send(2).unwrap();
    s.send(3).unwrap();
    drop(s); // Disconnect the channel.
});

// Collect all messages from the channel.
// Note that the call to `collect` blocks until the sender is dropped.
let v: Vec<_> = r.into_iter().collect();

assert_eq!(v, [1, 2, 3]);

Trait Implementations

impl<T> Debug for IntoIter<T>[src]

impl<T> FusedIterator for IntoIter<T>[src]

impl<T> Iterator for IntoIter<T>[src]

type Item = T

The type of the elements being iterated over.

Auto Trait Implementations

impl<T> RefUnwindSafe for IntoIter<T>

impl<T> Send for IntoIter<T> where
    T: Send

impl<T> Sync for IntoIter<T> where
    T: Send

impl<T> Unpin for IntoIter<T> where
    T: Unpin

impl<T> UnwindSafe for IntoIter<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.