Expand description
Concurrent execution of streams
§Examples
Concurrently process items in a collection
use futures_concurrency::prelude::*;
let v: Vec<_> = vec!["chashu", "nori"]
.into_co_stream()
.map(|msg| async move { format!("hello {msg}") })
.collect()
.await;
assert_eq!(v, &["hello chashu", "hello nori"]);
Concurrently process items in a stream
use futures_concurrency::prelude::*;
use futures_lite::stream;
let v: Vec<_> = stream::repeat("chashu")
.co()
.take(2)
.map(|msg| async move { format!("hello {msg}") })
.collect()
.await;
assert_eq!(v, &["hello chashu", "hello chashu"]);
Structs§
- A concurrent iterator that yields the current count and the element during iteration.
- A concurrent for each implementation from a
Stream
- A concurrent iterator that limits the amount of concurrency applied.
- Convert items from one type into another
- A concurrent iterator that only iterates over the first
n
iterations ofiter
.
Enums§
- The state of the consumer, used to communicate back to the source.
Traits§
- Concurrently operate over items in a stream
- Describes a type which can receive data.
- Conversion from a
ConcurrentStream
- Conversion into a
ConcurrentStream