Expand description
§Consumer Types
Provides implementations of readonly consumer interfaces for executing operations that neither modify their own state nor modify input values.
It is similar to the Fn(&T) trait in the standard library.
This module provides a unified Consumer trait and three concrete
implementations based on different ownership models:
BoxConsumer<T>: Box-based single ownership implementationArcConsumer<T>: Arc-based thread-safe shared ownership implementationRcConsumer<T>: Rc-based single-threaded shared ownership implementation
§Design Philosophy
Consumer uses Fn(&T) semantics, neither modifying its own state nor
modifying input values.
Suitable for pure observation, logging, notification and other scenarios. Compared to Consumer, Consumer does not require interior mutability (Mutex/RefCell), making it more efficient and easier to share.
§Author
Haixing Hu
Structs§
- ArcConditional
Consumer - ArcConditionalConsumer struct
- ArcConsumer
- ArcConsumer struct
- BoxConditional
Consumer - BoxConditionalConsumer struct
- BoxConsumer
- BoxConsumer struct
- RcConditional
Consumer - RcConditionalConsumer struct
- RcConsumer
- RcConsumer struct
Traits§
- Consumer
- Consumer trait - Unified readonly consumer interface
- FnConsumer
Ops - Extension trait providing readonly consumer composition methods for closures