[][src]Struct suspend::Iter

#[must_use = "Iter must be awaited"]pub struct Iter<'s, T> { /* fields omitted */ }

A stream which may be polled asynchronously, or by using blocking operations with an optional timeout.

Implementations

impl<'s, T> Iter<'s, T>[src]

pub fn from_poll_next<F>(f: F) -> Self where
    F: FnMut(&mut Context) -> Poll<Option<T>> + Send + 's, 
[src]

Create a new Iter from a function returning Poll<Option<T>>. If the function is already boxed, then it would be more efficent to use Iter::from.

pub fn from_iterator<I>(iter: I) -> Self where
    I: IntoIterator<Item = T> + 's,
    <I as IntoIterator>::IntoIter: Send
[src]

Create a new Iter from a Stream<T>. If the stream is already boxed, then it would be more efficent to use Iter::from.

pub fn from_stream<S>(s: S) -> Self where
    S: Stream<Item = T> + Send + 's, 
[src]

Create a new Iter from a Stream<T>. If the stream is already boxed, then it would be more efficent to use Iter::from.

pub fn map<'m, F, R>(self, f: F) -> Iter<'m, R>

Important traits for Iter<'s, T>

impl<'s, T> Iterator for Iter<'s, T> type Item = T;
where
    F: Fn(T) -> R + Send + 'm,
    T: 'm,
    's: 'm, 
[src]

Map the items of the Iter using a transformation function.

pub fn next(&mut self) -> Next<'_, 's, T>

Important traits for Next<'n, 's, T>

impl<'n, 's, T> Future for Next<'n, 's, T> type Output = Option<T>;
[src]

Create a new future which resolves to the next item in the stream.

pub fn wait_next(&mut self) -> Option<T>[src]

Resolve the next item in the Iter stream, parking the current thread until the result is available.

pub fn wait_next_deadline(
    &mut self,
    expire: Instant
) -> Result<Option<T>, TimeoutError>
[src]

Resolve the next item in the Iter stream, parking the current thread until the result is available or the deadline is reached. If a timeout occurs then Err(TimeoutError) is returned.

pub fn wait_next_timeout(
    &mut self,
    timeout: Duration
) -> Result<Option<T>, TimeoutError>
[src]

Resolve the next item in the Iter stream, parking the current thread until the result is available or the timeout expires. If a timeout does occur then Err(TimeoutError) is returned.

impl<'t, T, E> Iter<'t, Result<T, E>>[src]

pub fn map_ok<'m, F, R>(self, f: F) -> Iter<'m, Result<R, E>>

Important traits for Iter<'s, T>

impl<'s, T> Iterator for Iter<'s, T> type Item = T;
where
    F: Fn(T) -> R + Send + 'm,
    T: 'm,
    E: 'm,
    't: 'm, 
[src]

A helper method to map the Ok(T) item of the Iter<Result<T, E>> using a transformation function.

pub fn map_err<'m, F, R>(self, f: F) -> Iter<'m, Result<T, R>>

Important traits for Iter<'s, T>

impl<'s, T> Iterator for Iter<'s, T> type Item = T;
where
    F: Fn(E) -> R + Send + 'm,
    T: 'm,
    E: 'm,
    't: 'm, 
[src]

A helper method to map the Err(E) item of the Iter<Result<T, E>> using a transformation function.

Trait Implementations

impl<T, '_> Debug for Iter<'_, T>[src]

impl<T, '_> Eq for Iter<'_, T>[src]

impl<'s, T> From<Box<dyn FnMut(&mut Context) + 's + Send>> for Iter<'s, T>[src]

impl<'s, T> From<Pin<Box<dyn Stream<Item = T> + 's + Send>>> for Iter<'s, T>[src]

impl<'s, T> Iterator for Iter<'s, T>[src]

type Item = T

The type of the elements being iterated over.

impl<T, '_> PartialEq<Iter<'_, T>> for Iter<'_, T>[src]

impl<'s, T> Stream for Iter<'s, T>[src]

type Item = T

Values yielded by the stream.

Auto Trait Implementations

impl<'s, T> !RefUnwindSafe for Iter<'s, T>

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

impl<'s, T> !Sync for Iter<'s, T>

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

impl<'s, T> !UnwindSafe for Iter<'s, 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.

impl<S, T, E> TryStream for S where
    S: Stream<Item = Result<T, E>> + ?Sized
[src]

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future