{
"url": "https://context7.com/powersemmi/ruststream",
"public_key": "pk_uUlur6QCUlrZ8v1BsB2Wn",
"rules": [
"Import `ruststream::prelude::*` in a service, or the broker crate's own prelude, which re-exports it; the broker and the codec stay explicit choices.",
"Declare a handler as an `async fn` under `#[subscriber(..)]` whose first parameter is `&T` for one message or `&[T]` for a batch; mount it with `b.include(handler)` inside `with_broker`, and a batch handler with `.batch(n)`.",
"A reply type derives `Outgoing`: `#[outgoing(name = \"..\")]` fixes its destination and the subscriber writes the bare `publish`; a type without a name takes `publish(\"dest\")` at the mount site, never both.",
"Publish from inside a handler through an `Out(out): Out<impl Publisher>` parameter bound at the mount site with `.out(marker, policy).build()`; a handler signature never names a broker's publisher type.",
"The codec is chosen at the mount site (`with_broker_codec`, `Router::with_codec`, `.out_reply(policy).codec(..)`), never per message type; a type that is its own encoding derives `Serialized` or `Deserialized` and needs no codec.",
"Cap redeliveries at the mount site with `.max_attempts(n)` and `.dead_letter(name)` right after `include`; `.out_retry(policy)` only replaces the publisher the retry copy leaves through.",
"Test a service with `ruststream::testing::TestApp` (feature `testing`) against the broker's in-process transport; do not mock the broker traits.",
"Generate `main` with `#[ruststream::app]` and run the service with `cargo run -- run`; use `start()` only when the service runs beside another server such as an HTTP framework.",
"Broker-specific settings live on the broker crate's subscription descriptor and publish policy, in that crate's vocabulary; the core exposes none.",
"Misuse is rejected at compile time by design: read the compiler error, it names the missing derive, the unbound slot or the wrong position; do not work around it with runtime checks."
]
}