Struct Iter

struct Iter<'a, T: 'a> { ... }

An iterator over messages on a Receiver, created by iter.

This iterator will block whenever next is called, waiting for a new message, and None will be returned when the corresponding channel has hung up.

Examples

use std::sync::mpsc::channel;
use std::thread;

let (send, recv) = channel();

thread::spawn(move || {
    send.send(1u8).unwrap();
    send.send(2u8).unwrap();
    send.send(3u8).unwrap();
});

for x in recv.iter() {
    println!("Got: {x}");
}

Implementations

impl<'a, T> Freeze for Iter<'a, T>

impl<'a, T> Iterator for Iter<'a, T>

fn next(self: &mut Self) -> Option<T>

impl<'a, T> RefUnwindSafe for Iter<'a, T>

impl<'a, T> Send for Iter<'a, T>

impl<'a, T> Sync for Iter<'a, T>

impl<'a, T> Unpin for Iter<'a, T>

impl<'a, T> UnwindSafe for Iter<'a, T>

impl<'a, T: $crate::fmt::Debug + 'a> Debug for Iter<'a, T>

fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result

impl<I> IntoIterator for Iter<'a, T>

fn into_iter(self: Self) -> I

impl<T> Any for Iter<'a, T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Iter<'a, T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Iter<'a, T>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for Iter<'a, T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Iter<'a, T>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Iter<'a, T>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Iter<'a, T>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>