Expand description
§ReadonlyConsumer Types
Provides implementations of readonly consumer interfaces for executing operations that neither modify their own state nor modify input values.
This module provides a unified ReadonlyConsumer trait and three concrete
implementations based on different ownership models:
BoxReadonlyConsumer<T>: Box-based single ownership implementationArcReadonlyConsumer<T>: Arc-based thread-safe shared ownership implementationRcReadonlyConsumer<T>: Rc-based single-threaded shared ownership implementation
§Design Philosophy
ReadonlyConsumer 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, ReadonlyConsumer does not require interior mutability
(Mutex/RefCell), making it more efficient and easier to share.
§Author
Hu Haixing
Structs§
- ArcReadonly
Consumer - ArcReadonlyConsumer struct
- BoxReadonly
Consumer - BoxReadonlyConsumer struct
- RcReadonly
Consumer - RcReadonlyConsumer struct
Traits§
- FnReadonly
Consumer Ops - Extension trait providing readonly consumer composition methods for closures
- Readonly
Consumer - ReadonlyConsumer trait - Unified readonly consumer interface