| Crates.io | futures-concurrency-dynamic |
| lib.rs | futures-concurrency-dynamic |
| version | 0.2.2 |
| created_at | 2025-10-29 15:27:13.43552+00 |
| updated_at | 2025-11-14 11:23:12.044228+00 |
| description | A dynamic extension of the futures-concurrency |
| homepage | |
| repository | https://github.com/drindr/futures-concurrency-dynamic |
| max_upload_size | |
| id | 1906816 |
| size | 35,432 |
A thin wrapper around futures_util::stream::SelectAll with ergonomic improvements.
DynamicMerge<T> is essentially a type alias for SelectAll<Pin<Box<dyn Stream<Item = T> + Send>>> with convenience methods that handle the boxing internally. If you're familiar with SelectAll, you already know how to use this.
When you need separate mutable access:
use futures_concurrency_dynamic::dynamic_merge_with_handle;
use futures_util::stream::{self, StreamExt};
#[tokio::main]
async fn main() {
let (mut stream, mut handle) = dynamic_merge_with_handle::<i32>();
// Producer task
tokio::spawn(async move {
handle.push(stream::iter(vec![1, 2, 3]));
handle.push(stream::iter(vec![4, 5, 6]));
});
// Consumer
while let Some(item) = stream.next().await {
println!("Got: {}", item);
}
}
DynamicMerge::new() - Create a new mergepush(stream) - Add a streamlen() / is_empty() - Query active streamsclear() - Remove all streamsdynamic_merge_with_handle() - Get separate handle and streamMIT OR Apache-2.0