pub trait StreamLast: Sized + Stream + StreamExt {
    fn last(self) -> Last<Self, <Self as Stream>::Item>Notable traits for Last<St, I>impl<St, I> Future for Last<St, I> where
    St: Sized + Stream<Item = I> + StreamExt
type Output = Option<I>;
{ ... } }
Expand description

Extension trait for streams. Provides a future that resolves to the last item in the stream.

Provided Methods

Consume this stream, return a future that resolves to the last item. This future resolves to the most recently yielded item when the stream yields None.

If the stream is empty, this will resolve to None. Otherwise it will resolve to Some(last).

Note: this future relies on correct implementation of the Stream trait. If the stream never terminates (by yielding None), the future will never resolve.

Implementors