Skip to content

Installation

RustStream ships as a single crate, ruststream, whose surface is gated behind additive cargo features. Add it to your Cargo.toml:

[dependencies]
ruststream = { version = "0.4", features = ["macros", "memory", "json"] }
serde = { version = "1", features = ["derive"] }

serde is a direct dependency of your service because your message types derive Deserialize / Serialize.

Edition and MSRV

RustStream targets edition 2024 and a minimum supported Rust version of 1.85 (native async fn in trait). Set edition = "2024" in your Cargo.toml. CI builds the crate on every stable toolchain from 1.85 up to current stable, so any floor in that range works. Broker crates may require a newer toolchain than the core when their underlying clients do; check the broker crate's own rust-version.

Features

The core traits, the RustStream application object, the Router, middleware, and dispatch are always compiled. Everything else is an additive, opt-in feature.

Feature Pulls in What it gives you
json (default) serde_json JsonCodec
msgpack rmp-serde MsgpackCodec
cbor ciborium CborCodec
memory - MemoryBroker, the in-memory reference broker
macros ruststream-macros #[subscriber], #[ruststream::app], #[derive(Message)]
asyncapi schemars, serde_norway AsyncAPI generation and the HTML viewer
metrics prometheus Prometheus middleware and exporter
logging tracing-subscriber ruststream::logging, a colored console logger (Logging)
conformance - the broker-author conformance harness
cli clap, anyhow the ruststream binary

Codec features are mutually compatible; enable as many as you need (see Codecs). To drop the bundled JSON codec (for a broker crate that only needs the trait surface and runtime), disable defaults:

[dependencies]
ruststream = { version = "0.4", default-features = false }

The CLI

The ruststream binary ships with the crate behind the cli feature. Install it to scaffold projects and drive cargo with the framework's subcommands:

cargo install ruststream --features cli

See the CLI guide, or jump straight to the quick start.

Concrete brokers

The memory broker is for local development and tests. For production, depend on a broker crate, which re-exports what it needs from ruststream. Each broker is versioned and released independently, so its own documentation carries the exact dependency line (including the current version and the testing feature for handler tests) alongside its Config and capabilities.

The available brokers are listed under Brokers; follow the link there to each broker's documentation for installation. To write one yourself, see Broker authors.