<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/elegant-and-safe-concurrency-in-rust-with-async-combinators-zzflfhveh" -->

---
title: Elegant and safe concurrency in Rust with async combinators
description: Rust's `futures` crate exposes `FutureExt` and `StreamExt` traits that add async combinators to `Future` and `Stream` types. These combinators — including...
canonical: https://daily.dev/posts/elegant-and-safe-concurrency-in-rust-with-async-combinators-zzflfhveh
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Elegant and safe concurrency in Rust with async combinators | daily.dev
og:description: Rust's `futures` crate exposes `FutureExt` and `StreamExt` traits that add async combinators to `Future` and `Stream` types. These combinators — including...
og:url: https://daily.dev/posts/elegant-and-safe-concurrency-in-rust-with-async-combinators-zzflfhveh
og:image: https://api.daily.dev/og/posts/zzFLfhvEH.png
og:image:alt: Elegant and safe concurrency in Rust with async combinators
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Elegant and safe concurrency in Rust with async combinators

**[Sylvain Kerkour](https://daily.dev/sources/kerkour)** · 5 min read · 0 upvotes · 0 comments

## Summary

Rust's `futures` crate exposes `FutureExt` and `StreamExt` traits that add async combinators to `Future` and `Stream` types. These combinators — including `then`, `map`, `flatten`, `for_each_concurrent`, and `buffer_unordered` — enable concurrent and parallel data processing without manually managing thread pools. The post explains why worker pools are an anti-pattern in async Rust and demonstrates three idiomatic alternatives for collecting concurrent results: using `buffer_unordered` + `collect`, using `Arc<Mutex<T>>`, and using channels with `for_each_concurrent`. A key warning: always set an upper bound on concurrent tasks to avoid resource exhaustion.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://kerkour.com/rust-async-combinators-concurrency>

## Questions this post answers

### What is the difference between buffer_unordered and for_each_concurrent in Rust's futures crate?

`buffer_unordered` produces a new Stream that must be consumed (e.g., with `.collect().await`), while `for_each_concurrent` directly consumes the Stream by applying a closure to each element. Both execute elements concurrently up to a specified limit. Use `buffer_unordered` when you need to collect results into a collection; use `for_each_concurrent` when you want side effects or need to push results through a channel.

_Rust developers choosing between these two patterns find the trade-offs discussed regularly on daily.dev._

### Why are worker pools considered an anti-pattern in async Rust?

Worker pools are an anti-pattern in async Rust because their APIs encourage imperative programming and mutable shared state (e.g., accumulating results via locks), which introduces subtle bugs. Rust's `Stream` combinators like `buffer_unordered` and `for_each_concurrent` replace worker pools with a functional, declarative approach that preserves Rust's multithreading safety guarantees without manual thread pool management.

_Teams migrating from thread-pool patterns to async Rust streams track this kind of architectural shift on daily.dev._

### How do I process a list of jobs concurrently in Rust using streams and collect the results into a Vec?

Use `stream::iter` to turn your job list into a stream, `.map` to convert each item into a Future, `.buffer_unordered(N)` to execute up to N futures concurrently, and `.collect().await` to gather results into a `Vec`. Always set a concrete concurrency limit (the `N` argument) to avoid exhausting system resources under load.

_Developers building concurrent Rust pipelines share patterns like this one on daily.dev._

## Similar posts on daily.dev

- [Async Programming in Rust: Understanding Futures and Tokio](https://daily.dev/posts/async-programming-in-rust-understanding-futures-and-tokio-kmsp7jgjw) · The New Stack · 1 upvotes · 0 comments
- [Concurrent Servers: Part 7](https://daily.dev/posts/concurrent-servers-part-7-p5cowxjcu) · Eli Bendersky · 4 upvotes · 0 comments
- [The Tokio Runtime For Rust: Part III, WebSocket Draining.](https://daily.dev/posts/the-tokio-runtime-for-rust-part-iii-websocket-draining--zv6u4fvub) · Medium · 0 upvotes · 0 comments

---

Tags: [#rust](https://daily.dev/tags/rust)

[View this post on daily.dev](https://daily.dev/posts/elegant-and-safe-concurrency-in-rust-with-async-combinators-zzflfhveh)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Elegant and safe concurrency in Rust with async combinators","url":"https://daily.dev/posts/elegant-and-safe-concurrency-in-rust-with-async-combinators-zzflfhveh","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/elegant-and-safe-concurrency-in-rust-with-async-combinators-zzflfhveh"},"datePublished":"2026-08-11T08:53:53.889Z","dateModified":"2026-08-11T09:15:52.697Z","description":"Rust's `futures` crate exposes `FutureExt` and `StreamExt` traits that add async combinators to `Future` and `Stream` types. These combinators — including...","image":"https://media.daily.dev/image/upload/s--ZrL_HSsR--/f_auto/v1722860399/public/Placeholder%2006","thumbnailUrl":"https://media.daily.dev/image/upload/s--ZrL_HSsR--/f_auto/v1722860399/public/Placeholder%2006","isAccessibleForFree":true,"articleSection":"Sylvain Kerkour","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Sylvain Kerkour","logo":"https://media.daily.dev/image/upload/s--3ngWt4Yp--/f_auto,q_auto/v1786438308/logos/kerkour?_a=BAMAMicg0","url":"https://daily.dev/sources/kerkour"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/elegant-and-safe-concurrency-in-rust-with-async-combinators-zzflfhveh","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"rust","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Sylvain Kerkour","item":"https://daily.dev/sources/kerkour"},{"@type":"ListItem","position":3,"name":"Elegant and safe concurrency in Rust with async combinators"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/elegant-and-safe-concurrency-in-rust-with-async-combinators-zzflfhveh#faq","mainEntity":[{"@type":"Question","name":"What is the difference between buffer_unordered and for_each_concurrent in Rust's futures crate?","acceptedAnswer":{"@type":"Answer","text":"`buffer_unordered` produces a new Stream that must be consumed (e.g., with `.collect().await`), while `for_each_concurrent` directly consumes the Stream by applying a closure to each element. Both execute elements concurrently up to a specified limit. Use `buffer_unordered` when you need to collect results into a collection; use `for_each_concurrent` when you want side effects or need to push results through a channel. Rust developers choosing between these two patterns find the trade-offs discussed regularly on daily.dev."}},{"@type":"Question","name":"Why are worker pools considered an anti-pattern in async Rust?","acceptedAnswer":{"@type":"Answer","text":"Worker pools are an anti-pattern in async Rust because their APIs encourage imperative programming and mutable shared state (e.g., accumulating results via locks), which introduces subtle bugs. Rust's `Stream` combinators like `buffer_unordered` and `for_each_concurrent` replace worker pools with a functional, declarative approach that preserves Rust's multithreading safety guarantees without manual thread pool management. Teams migrating from thread-pool patterns to async Rust streams track this kind of architectural shift on daily.dev."}},{"@type":"Question","name":"How do I process a list of jobs concurrently in Rust using streams and collect the results into a Vec?","acceptedAnswer":{"@type":"Answer","text":"Use `stream::iter` to turn your job list into a stream, `.map` to convert each item into a Future, `.buffer_unordered(N)` to execute up to N futures concurrently, and `.collect().await` to gather results into a `Vec`. Always set a concrete concurrency limit (the `N` argument) to avoid exhausting system resources under load. Developers building concurrent Rust pipelines share patterns like this one on daily.dev."}}]}
```

