Skip to content

Commit e80e444

Browse files
committed
fix doctests
1 parent 616ced3 commit e80e444

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
//! use futures_concurrency::prelude::*;
1313
//! use std::future;
1414
//!
15+
//! # futures::executor::block_on(async {
1516
//! let a = future::ready(1u8);
1617
//! let b = future::ready("hello");
1718
//! let c = future::ready(3u16);
1819
//! assert_eq!((a, b, c).join().await, (1, "hello", 3));
20+
//! # });
1921
//! ```
2022
//!
2123
//! **Concurrently process items in a stream**
@@ -24,13 +26,15 @@
2426
//! use futures_concurrency::prelude::*;
2527
//! use futures_lite::stream;
2628
//!
29+
//! # futures::executor::block_on(async {
2730
//! let v: Vec<_> = vec!["chashu", "nori"]
2831
//! .into_co_stream()
2932
//! .map(|msg| async move { format!("hello {msg}") })
3033
//! .collect()
3134
//! .await;
3235
//!
3336
//! assert_eq!(v, &["hello chashu", "hello nori"]);
37+
//! # });
3438
//! ```
3539
//!
3640
//! **Access stack data outside the futures' scope**
@@ -40,6 +44,7 @@
4044
//! ```rust
4145
//! use futures_concurrency::prelude::*;
4246
//!
47+
//! # futures::executor::block_on(async {
4348
//! let mut container = vec![1, 2, 3];
4449
//! let mut num = 0;
4550
//!
@@ -56,7 +61,8 @@
5661
//! println!("hello from the main future");
5762
//! let _ = (a, b).join().await;
5863
//! container.push(4);
59-
//! assert_eq!(x, container.len());
64+
//! assert_eq!(num, container.len());
65+
//! # });
6066
//! ```
6167
//!
6268
//! ## Operations

0 commit comments

Comments
 (0)