Expand description
§Consumer Types
Provides implementations of consumer interfaces for executing operations that accept a single input parameter but return no result.
It is similar to the FnMut(&T) trait in the standard library.
This module provides a unified Consumer trait and three concrete
implementations based on different ownership models:
BoxStatefulConsumer<T>: Box-based single ownership implementation for one-time use scenariosArcStatefulConsumer<T>: Thread-safe shared ownership implementation based on Arc<Mutex<>>RcStatefulConsumer<T>: Single-threaded shared ownership implementation based on Rc<RefCell<>>
§Design Philosophy
Consumer uses FnMut(&T) semantics, allowing modification of its own state
but not the input value.
Suitable for statistics, accumulation, event handling, and other scenarios.
§Author
Haixing Hu
Structs§
- ArcConditional
Stateful Consumer - ArcConditionalStatefulConsumer struct
- ArcStateful
Consumer - ArcStatefulConsumer struct
- BoxConditional
Stateful Consumer - BoxConditionalStatefulConsumer struct
- BoxStateful
Consumer - BoxStatefulConsumer struct
- RcConditional
Stateful Consumer - RcConditionalStatefulConsumer struct
- RcStateful
Consumer - RcStatefulConsumer struct
Traits§
- FnStateful
Consumer Ops - Extension trait providing consumer composition methods for closures
- Stateful
Consumer - Consumer trait - Unified consumer interface