1 | use tokio_stream::{StreamExt, StreamNotifyClose}; |
---|---|
2 | |
3 | #[tokio::test] |
4 | async fn basic_usage() { |
5 | let mut stream = StreamNotifyClose::new(tokio_stream::iter(vec![0, 1])); |
6 | |
7 | assert_eq!(stream.next().await, Some(Some(0))); |
8 | assert_eq!(stream.next().await, Some(Some(1))); |
9 | assert_eq!(stream.next().await, Some(None)); |
10 | assert_eq!(stream.next().await, None); |
11 | } |
12 |