6 releases
Uses new Rust 2024
| new 0.2.1 | Feb 1, 2026 |
|---|---|
| 0.2.0 | Jan 24, 2026 |
| 0.1.2 | Jan 24, 2026 |
| 0.0.1 | Jan 19, 2026 |
#46 in #rx-core-operator
Used in 2 crates
(via rx_core)
165KB
4.5K
SLoC
operator_reduce
Fold values and emit only the final accumulator on completion.
See Also
- ScanOperator - Accumulate state and emit every intermediate result.
Example
cargo run -p rx_core --example operator_reduce_example
let _subscription = (0..=10)
.into_observable()
.reduce(|acc, next| acc + next, 0)
.subscribe(PrintObserver::new("reduce_operator"));
Output:
reduce_operator - next: 55
reduce_operator - completed
reduce_operator - unsubscribed
Dependencies
~275–750KB
~18K SLoC