File: stream_close.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 (11 lines) | stat: -rw-r--r-- 367 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
use tokio_stream::{StreamExt, StreamNotifyClose};

#[tokio::test]
async fn basic_usage() {
    let mut stream = StreamNotifyClose::new(tokio_stream::iter(vec![0, 1]));

    assert_eq!(stream.next().await, Some(Some(0)));
    assert_eq!(stream.next().await, Some(Some(1)));
    assert_eq!(stream.next().await, Some(None));
    assert_eq!(stream.next().await, None);
}