[−][src]Trait futures_test::stream::StreamTestExt
Additional combinators for testing streams.
Provided methods
fn interleave_pending(self) -> InterleavePending<Self> where
Self: Sized,
Self: Sized,
Introduces an extra Poll::Pending
in between each item of the stream.
Examples
#![feature(async_await)] use futures::task::Poll; use futures::stream::{self, Stream}; use futures_test::task::noop_context; use futures_test::stream::StreamTestExt; use pin_utils::pin_mut; let stream = stream::iter(vec![1, 2]).interleave_pending(); pin_mut!(stream); let mut cx = noop_context(); assert_eq!(stream.as_mut().poll_next(&mut cx), Poll::Pending); assert_eq!(stream.as_mut().poll_next(&mut cx), Poll::Ready(Some(1))); assert_eq!(stream.as_mut().poll_next(&mut cx), Poll::Pending); assert_eq!(stream.as_mut().poll_next(&mut cx), Poll::Ready(Some(2))); assert_eq!(stream.as_mut().poll_next(&mut cx), Poll::Pending); assert_eq!(stream.as_mut().poll_next(&mut cx), Poll::Ready(None));
Implementors
impl<St> StreamTestExt for St where
St: Stream,
[src]
St: Stream,
fn interleave_pending(self) -> InterleavePending<Self> where
Self: Sized,
[src]
Self: Sized,