Struct TryIter
pub struct TryIter<'a, T> { /* private fields */ }
A non-blocking iterator over messages in a channel.
Each call to next returns a message if there is one ready to be received. The iterator
never blocks waiting for the next message.
Examples
use thread;
use Duration;
use unbounded;
let = ;
spawn;
sleep;
// Collect all messages from the channel without blocking.
// The third message hasn't been sent yet so we'll collect only the first two.
let v: = r.try_iter.collect;
assert_eq!;
Trait Implementations
impl<T> Debug for TryIter<'_, T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<T> Iterator for TryIter<'_, T>
type Item = T;fn next(&mut self) -> Option<Self::Item>
Auto Trait Implementations
impl<'a, T> Freeze for TryIter<'a, T>
where
&'a Receiver<T>: Freeze,
impl<'a, T> RefUnwindSafe for TryIter<'a, T>
where
&'a Receiver<T>: RefUnwindSafe,
impl<'a, T> Send for TryIter<'a, T>
where
&'a Receiver<T>: Send,
impl<'a, T> Sync for TryIter<'a, T>
where
&'a Receiver<T>: Sync,
impl<'a, T> Unpin for TryIter<'a, T>
where
&'a Receiver<T>: Unpin,
impl<'a, T> UnsafeUnpin for TryIter<'a, T>
where
&'a Receiver<T>: UnsafeUnpin,
impl<'a, T> UnwindSafe for TryIter<'a, T>
where
&'a Receiver<T>: UnwindSafe,
Blanket Implementations
impl<I> IntoIterator for TryIter<'a, T>
where
I: Iterator,
type Item = <I as Iterator>::Item;type IntoIter = I;fn into_iter(self) -> I
impl<T> Any for TryIter<'a, T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for TryIter<'a, T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for TryIter<'a, T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for TryIter<'a, T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for TryIter<'a, T>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for TryIter<'a, T>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for TryIter<'a, T>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>