fix example

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
pull/309/head
Yoshua Wuyts 5 years ago
parent 064fdf020f
commit 483ded0e1c
No known key found for this signature in database
GPG Key ID: 24EA8164F96777ED

@ -351,14 +351,19 @@ extension_trait! {
# fn main() { async_std::task::block_on(async {
#
use async_std::prelude::*;
use async_std::future;
use async_std::stream;
use std::time::Duration;
let p1 = future::ready(1).delay(Duration::from_millis(200));
let p1 = future::ready(2).delay(Duration::from_millis(100));
let p1 = future::ready(3).delay(Duration::from_millis(300));
let a = stream::once(1).delay(Duration::from_millis(200));
let b = stream::once(2).delay(Duration::from_millis(100));
let c = stream::once(3).delay(Duration::from_millis(300));
let s = stream::join!(a, b, c);
assert_eq!(future::join!(p1, p2, p3).await, (1, 2, 3));
assert_eq!(stream.next().await, Some(1));
assert_eq!(stream.next().await, Some(2));
assert_eq!(stream.next().await, Some(3));
assert_eq!(stream.next().await, None);
#
# }) }
```

Loading…
Cancel
Save