infinite-stream 0.1.0

Streams (asynchronous iterators) that always keep yielding items (or panic, or become pending forever)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::internal_prelude::*;

macro_rules! unwrap {
    ($t:ty) => {
        impl InfiniteStream for $t {
            type Item = <Self as Stream>::Item;

            fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Item> {
                <Self as Stream>::poll_next(self, cx).map(Option::unwrap)
            }
        }
    };
}

unwrap!(tokio_stream::wrappers::IntervalStream);