Add a runnable reducer composition example and performance guide
- Lenguaje dominante
- Rust
- Estrellas
- 9
- Forks
- 1
- Merge medio
- 11 h 46 min
- PR fusionados (30 d)
- 62
Descripción
## Summary
Add a runnable example and user guide for the reducer composition API introduced in 0.11.0.
The runtime and composition contract already exist: `Reducer`, `Program`, `scope`, `for_each`, `presented`, `into_program`, `Keyed`, `Slot`, `ProgramRuntime`, automatic scope application, and removal teardown are implemented by RFC 0014. What is missing is a production-facing path that shows how those pieces fit together in an application.
## Scope
- Build one runnable application with sibling features, a keyed collection, and optional presentation state.
- Close the reducer stack with `into_program` and run it with `ProgramRuntime`.
- Show child message routing and aggregation of child commands and subscriptions.
- Demonstrate that users do not manually apply scope metadata or teardown removed children.
- Add a test that drives the same composition through `TestDriver`.
- Document the cost of routing high-frequency messages through deep reducer stacks, including `Command::map` boxing, source-side coalescing, and `without_redraw()`.
This is documentation and example work. It should not redesign the runtime or reopen RFC 0014.
## Acceptance criteria
- [x] A runnable example covers `scope`, `for_each`, `presented`, and `into_program` in one coherent application.
- [x] The example includes child command and subscription output.
- [x] Removal of a `Keyed` row and dismissal/replacement of a `Slot` demonstrate automatic teardown.
- [x] A deterministic test uses `TestDriver` against the same composition.
- [x] User documentation explains when to keep a simple `Application` and when to move to composed reducers.
- [ ] Performance guidance covers high-frequency input and deep mapping chains.
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.