Module stateful_consumer

Module stateful_consumer 

Source
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 scenarios
  • ArcStatefulConsumer<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§

ArcConditionalStatefulConsumer
ArcConditionalStatefulConsumer struct
ArcStatefulConsumer
ArcStatefulConsumer struct
BoxConditionalStatefulConsumer
BoxConditionalStatefulConsumer struct
BoxStatefulConsumer
BoxStatefulConsumer struct
RcConditionalStatefulConsumer
RcConditionalStatefulConsumer struct
RcStatefulConsumer
RcStatefulConsumer struct

Traits§

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