Module consumer

Module consumer 

Source
Expand description

§Consumer Types

Provides implementations of consumer interfaces for executing operations that accept a single input parameter but return no result.

This module provides a unified Consumer trait and three concrete implementations based on different ownership models:

  • BoxConsumer<T>: Box-based single ownership implementation for one-time use scenarios
  • ArcConsumer<T>: Thread-safe shared ownership implementation based on Arc<Mutex<>>
  • RcConsumer<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

Hu Haixing

Structs§

ArcConditionalConsumer
ArcConditionalConsumer struct
ArcConsumer
ArcConsumer struct
BoxConditionalConsumer
BoxConditionalConsumer struct
BoxConsumer
BoxConsumer struct
RcConditionalConsumer
RcConditionalConsumer struct
RcConsumer
RcConsumer struct

Traits§

Consumer
Consumer trait - Unified consumer interface
FnConsumerOps
Extension trait providing consumer composition methods for closures