Module bi_consumer

Module bi_consumer 

Source
Expand description

§BiConsumer Types

Provides readonly bi-consumer interface implementations for operations that accept two input parameters without modifying their own state or the input values.

It is similar to the Fn(&T, &U) trait in the standard library.

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

  • BoxBiConsumer<T, U>: Box-based single ownership
  • ArcBiConsumer<T, U>: Arc-based thread-safe shared ownership
  • RcBiConsumer<T, U>: Rc-based single-threaded shared ownership

§Design Philosophy

BiConsumer uses Fn(&T, &U) semantics: neither modifies its own state nor the input values.

Suitable for pure observation, logging, and notification scenarios with two parameters. Compared to BiConsumer, BiConsumer does not require interior mutability (Mutex/RefCell), thus more efficient and easier to share.

§Author

Haixing Hu

Structs§

ArcBiConsumer
ArcBiConsumer struct
ArcConditionalBiConsumer
ArcConditionalBiConsumer struct
BoxBiConsumer
BoxBiConsumer struct
BoxConditionalBiConsumer
BoxConditionalBiConsumer struct
RcBiConsumer
RcBiConsumer struct
RcConditionalBiConsumer
RcConditionalBiConsumer struct

Traits§

BiConsumer
BiConsumer trait - Unified readonly bi-consumer interface
FnBiConsumerOps
Extension trait providing readonly bi-consumer composition methods for closures