async-stream

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

Library
Cargo
v0.3.6
768stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
43/100Fair
Development Activity0
Maintenance20
Community64
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
81/100Excellent
Architecture85
Code Quality82
Innovation80
Learning Curve78

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 17 apps in this directory

Dart
74%
AGPL 3.0

AppFlowy

Productivity · Project Management · Collaboration

75,729

The open-source AI workspace that puts your data, your rules — with local LLMs, CRDT collaboration, and full self-hosting built in.

View details
66
Repo Health
81
Technical
66
Dependency
Built with
Dart74%
Rust24%
Updated 1 weeks ago
Rust
86%
Other

Arroyo

Data Engineering · Analytics

5,005

A distributed stream processing engine written in Rust that lets you write SQL to run stateful, real-time computations over data streams with subsecond results.

View details
86
Repo Health
74
Technical
62
Dependency
Built with
Rust86%
Updated 1 weeks ago
Rust
54%
Other

Cameleer

AI Agents

23

A local-first desktop workspace for managing AI agents in an enterprise-style workflow — agent directory, Kanban task tracking, workspace chat, and a full runtime/audit log of agent actions and tool approvals.

View details
48
Repo Health
65
Technical
76
Dependency
Built with
Rust54%
JavaScript24%
TypeScript15%
Updated 4 weeks ago
TypeScript
55%
Other

Cap

Team Chat · Video Conferencing

20,986

Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.

View details
89
Repo Health
81
Technical
65
Dependency
Built with
TypeScript55%
Rust40%
Updated yesterday
Rust
66%
Other

DefGuard

Security · Networking · Authentication

2,805

Self-hosted secure remote access that unifies WireGuard VPN, identity management, and connection-level MFA in one open-source platform.

View details
85
Repo Health
82
Technical
77
Dependency
Built with
Rust66%
TypeScript32%
Updated today
Rust
87%
MIT

fabro

Developer Tools · Devops

1,516

Define AI agent workflows as code graphs, route tasks across any LLM, and intervene only where it matters.

View details
81
Repo Health
83
Technical
70
Dependency
Built with
Rust87%
TypeScript11%
Updated yesterday
Rust
100%
Other

Fluree DB

Databases

445

A temporal, verifiable graph database with git-like branching, integrated vector/text/geo search, and RDF/SPARQL/JSON-LD/openCypher support — benchmarked at 10.4x faster than the next database on the full Wikidata dump.

View details
86
Repo Health
74
Technical
65
Dependency
Built with
Rust100%
Updated yesterday
TypeScript
61%
EPL-2.0

Huly Platform

Project Management · Team Chat · Collaboration

27,384

Open-source all-in-one workspace that replaces Linear, Jira, Slack, and Notion for product and engineering teams.

View details
90
Repo Health
86
Technical
64
Dependency
Built with
TypeScript61%
Svelte34%
Updated 1 weeks ago
Rust
47%
MIT

Kuku

Note Taking

204

A local-first, open-source Markdown knowledge workspace for macOS — plain files, personal wiki and Second Brain workflows, AI-assisted diffs, and encrypted sync, built as an Obsidian alternative.

View details
73
Repo Health
67
Technical
68
Dependency
Built with
Rust47%
TypeScript40%
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

Search