File: stream_pending.rs

package info (click to toggle)
rust-tokio-stream 0.1.17-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 432 kB
  • sloc: makefile: 2
file content (14 lines) | stat: -rw-r--r-- 369 bytes parent folder | download | duplicates (28)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use tokio_stream::{self as stream, Stream, StreamExt};
use tokio_test::{assert_pending, task};

#[tokio::test]
async fn basic_usage() {
    let mut stream = stream::pending::<i32>();

    for _ in 0..2 {
        assert_eq!(stream.size_hint(), (0, None));

        let mut next = task::spawn(async { stream.next().await });
        assert_pending!(next.poll());
    }
}