ruststream 0.7.4

Async messaging framework for Rust: broker-agnostic traits, router, codecs, and a conformance harness for broker authors.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
---
description: "Layers wrap handlers and publishes: app-wide, per router or per registration."
---

# Middleware

Layers wrap handlers and publishes: app-wide, per router or per registration.

A [layer](./layer.md) wraps a handler: it runs code of its own around each delivery, with the delivery's context.
A [publish layer](./publish-layer.md) wraps a publish: it runs around each message a handler sends.
Both are static: the chain is one type built when the code compiles, and a layer costs only its own code.
A chain chosen when the app starts, from configuration, goes into a dynamic stack, which boxes each step.