Skip to content

Commit 220cb6e

Browse files
Implement feedback from review
Co-Authored-By: Consoli <[email protected]>
1 parent 47c965e commit 220cb6e

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

src/concurrent_stream/mod.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,40 @@
11
//! Concurrent execution of streams
2+
//!
3+
//! # Examples
4+
//!
5+
//! **Concurrently process items in a collection**
6+
//!
7+
//! ```rust
8+
//! use futures_concurrency::prelude::*;
9+
//!
10+
//! # futures::executor::block_on(async {
11+
//! let v: Vec<_> = vec!["chashu", "nori"]
12+
//! .into_co_stream()
13+
//! .map(|msg| async move { format!("hello {msg}") })
14+
//! .collect()
15+
//! .await;
16+
//!
17+
//! assert_eq!(v, &["hello chashu", "hello nori"]);
18+
//! # });
19+
//! ```
20+
//!
21+
//! **Concurrently process items in a stream**
22+
//!
23+
//! ```rust
24+
//! use futures_concurrency::prelude::*;
25+
//! use futures_lite::stream;
26+
//!
27+
//! # futures::executor::block_on(async {
28+
//! let v: Vec<_> = stream::repeat("chashu")
29+
//! .co()
30+
//! .take(2)
31+
//! .map(|msg| async move { format!("hello {msg}") })
32+
//! .collect()
33+
//! .await;
34+
//!
35+
//! assert_eq!(v, &["hello chashu", "hello chashu"]);
36+
//! # });
37+
//! ```
238
339
mod enumerate;
440
mod for_each;

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
//! # });
2323
//! ```
2424
//!
25-
//! **Concurrently process items in a stream**
25+
//! **Concurrently process items in a collection**
2626
//!
2727
//! ```rust
2828
//! use futures_concurrency::prelude::*;
@@ -110,7 +110,7 @@
110110
//! The following streams implementations are provided by `futures-concurrency`:
111111
//!
112112
//! - [`StreamGroup`][stream::StreamGroup]: A growable group of streams which operate as a single unit.
113-
//! - [`ConcurrentStream`][concurrent_stream::ConcurrentStream]: An asynchronous stream which can concurrently process items.
113+
//! - [`ConcurrentStream`][concurrent_stream::ConcurrentStream]: A trait for asynchronous streams which can concurrently process items.
114114
//! - `tuple`: [`chain`][stream::Chain#impl-Chain-for-(A,+B)], [`merge`][stream::Merge#impl-Merge-for-(A,+B)], [`zip`][stream::Zip#impl-Zip-for-(A,+B)]
115115
//! - `array`: [`chain`][stream::Chain#impl-Chain-for-\[Fut;+N\]], [`merge`][stream::Merge#impl-Merge-for-\[Fut;+N\]], [`zip`][stream::Zip#impl-Zip-for-\[Fut;+N\]]
116116
//! - `Vec`: [`chain`][stream::Chain#impl-Chain-for-Vec<Fut>], [`merge`][stream::Merge#impl-Merge-for-Vec<Fut>], [`zip`][stream::Zip#impl-Zip-for-Vec<Fut>]

0 commit comments

Comments
 (0)