async-stream

Build asynchronous streams in Rust using async/await notation instead of hand-written state machines

Library
Cargo
v0.3.6
780 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
56 /100 Fair
Development Activity 40
Maintenance 32
Community 64
Maturity 60
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
81 /100 Excellent
Architecture 85
Code Quality 82
Innovation 80
Learning Curve 78

async-stream is a Tokio-project crate that provides stream! and try_stream! procedural macros, letting Rust code write asynchronous streams using ordinary async/await and yield syntax instead of manually implementing the Stream trait’s poll_next state machine by hand.

The macros expand into an anonymous type implementing futures_core::Stream (Item = T for stream!, Item = Result<T, Error> for try_stream!, which additionally supports ? for early-return error propagation), and the crate works entirely on stable Rust with no unstable-feature requirements.

What You Get

  • The stream! macro for defining a Stream<Item = T> using async/await and yield syntax
  • The try_stream! macro for fallible streams (Item = Result<T, Error>) with ?-operator error propagation
  • Full compatibility with the futures ecosystem (futures_core::Stream, combinators from futures_util)
  • Zero unstable-feature requirements — works on stable Rust as of edition 2021, rust-version 1.65+
  • A companion async-stream-impl proc-macro crate that does the actual macro expansion

Common Use Cases

  • Implementing a custom async iterator/stream over a paginated API response without writing a manual poll_next state machine
  • Building a streaming parser or line-by-line async reader that yields items incrementally as data arrives
  • Wrapping a channel or event source (WebSocket messages, database rows) as a Stream consumable by futures/tokio-stream combinators
  • Writing test fixtures that need to emit a scripted sequence of async values over time

Under The Hood

Architecture — The repo is a small Cargo workspace with two crates: async-stream (the public-facing crate, src/lib.rs, async_stream.rs, next.rs, yielder.rs) and async-stream-impl (the actual proc-macro crate that parses the macro body and rewrites yield expressions into calls against a hidden coroutine-like driver). The macro-generated code builds a state machine under the hood using a generator built from an async block plus a side-channel Yielder that captures each yielded value, which next.rs/yielder.rs then thread back through poll_next. Tech Stack — Pure Rust (edition 2021, MSRV 1.65), depending only on futures-core (for the Stream trait) and pin-project-lite (for safe pinning), with futures-util, tokio, tokio-test, rustversion, and trybuild as dev-dependencies for testing macro-expansion errors and stream behavior. Code Quality — The test suite includes 12+ integration test files under async-stream/tests/, including trybuild-based compile-fail tests that assert the macro produces sensible error messages for misuse (e.g. yield outside a stream block); the crate has been stable and essentially feature-complete for a couple of years with no active development but no open correctness issues either. API Design — The macro’s design goal is to make an async stream read like ordinary imperative Rust (a for loop with yield inside stream! { }) rather than requiring Pin/Poll/Context boilerplate, which is a significant developer-experience win for anyone who already understands async fn — the main friction is that pin_mut! (or Box::pin) is still required at the call site since the returned stream is !Unpin.

Used by 18 apps in this directory

TypeScript
63%
Apache 2.0

Laminar

AI Development · Monitoring

3,434

Open-source observability platform purpose-built for AI agents — trace, evaluate, debug, and monitor at scale with SQL access and real-time replay.

View details
86
Repo Health
76
Technical
65
Dependency
Built with
TypeScript 63%
Rust 35%
Updated 5 days ago
Rust
85%
AGPL 3.0

ParadeDB

Analytics · Databases · Search

9,436

Born out of Y Combinator's S2023 batch, ParadeDB is a Postgres extension that delivers Elasticsearch-quality BM25 search and real-time analytics without a separate search cluster to manage.

View details
89
Repo Health
87
Technical
68
Dependency
Built with
Rust 85%
PLpgSQL 15%
Updated 5 days ago
Java
93%
Apache 2.0

QuestDB

Analytics · Databases

17,466

A high-performance, open-source time-series database built for financial market data, IoT telemetry, and real-time analytics, combining a zero-GC Java/C++ core with SIMD-accelerated SQL and a WAL-to-Parquet storage engine.

View details
91
Repo Health
86
Technical
67
Dependency
Built with
Java 93%
Updated 5 days ago
Rust
79%
AGPL 3.0

Spacedrive

Collaboration · File Storage

39,292

One file manager for all your devices and clouds — powered by a Virtual Distributed File System built in Rust.

View details
84
Repo Health
84
Technical
63
Dependency
Built with
Rust 79%
TypeScript 18%
Updated 2 weeks ago
Rust
98%

Stalwart

Collaboration

15,268

All-in-one secure mail and collaboration server covering IMAP, JMAP, SMTP, CalDAV, CardDAV, and WebDAV in a single memory-safe Rust binary.

View details
88
Repo Health
81
Technical
65
Dependency
Built with
Rust 98%
Updated 1 weeks ago
Rust
93%
Other

Tabby

AI Code Assistants

33,924

Self-hosted AI coding assistant — run GitHub Copilot-grade code completion on your own hardware with no cloud dependency.

View details
55
Repo Health
78
Technical
61
Dependency
Built with
Rust 93%
Updated 4 months ago
Rust
66%
Apache 2.0

Temps

Analytics · Devops · Monitoring

865

A self-hosted Rust PaaS that replaces Vercel, Sentry, PostHog, Pingdom, Resend, and E2B with one binary — plus 440+ CLI operations agents like Claude Code can drive directly.

View details
81
Repo Health
86
Technical
66
Dependency
Built with
Rust 66%
TypeScript 33%
Updated 6 days ago
Rust
50%
Apache 2.0

Vibe Kanban

AI Agents · AI Code Assistants · Project Management

28,441

A kanban board for planning work and dispatching Claude Code, Codex, Gemini CLI, and eight other coding agents into isolated git worktrees, then reviewing and merging their diffs from one UI.

View details
72
Repo Health
75
Technical
63
Dependency
Built with
Rust 50%
TypeScript 46%
Updated 1 months ago
Rust
97%
Apache 2.0

Volga

Data Engineering

161

A Rust-based real-time data processing engine for AI/ML feature computation, built on Apache DataFusion and Arrow — positioned as an alternative to Flink, Spark, Chronon, and OpenMLDB with unified streaming, batch, and request-time execution.

View details
61
Repo Health
67
Technical
72
Dependency
Built with
Rust 97%
Updated 1 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers