Skip to main content

Module bi_consumer_once

Module bi_consumer_once 

Source
Expand description

§BiConsumerOnce Types

Provides one-time bi-consumer interface implementations for operations accepting two input parameters without returning a result.

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

This module provides a unified BiConsumerOnce trait and one concrete implementation:

  • BoxBiConsumerOnce<T, U>: Box-based single ownership implementation

§Why No Arc/Rc Variants?

Unlike reusable BiConsumer implementations, this module does not provide ArcBiConsumerOnce or RcBiConsumerOnce implementations. This is a design decision based on the fact that FnOnce semantics require single ownership at the call site, while Arc and Rc are meant to preserve shared ownership across clones.

§Design Philosophy

BiConsumerOnce uses FnOnce(&T, &U) semantics: for truly one-time consumption operations.

Unlike BiConsumer, BiConsumerOnce consumes itself on first call. Suitable for initialization callbacks, cleanup callbacks, etc.

Structs§

BoxBiConsumerOnce
BoxBiConsumerOnce struct
BoxConditionalBiConsumerOnce
BoxConditionalBiConsumerOnce struct

Traits§

BiConsumerOnce
BiConsumerOnce trait - Unified one-time bi-consumer interface
FnBiConsumerOnceOps
Extension trait providing one-time bi-consumer composition methods for closures