Expand description
§ConsumerOnce Types
Provides implementations of one-time consumer interfaces for executing one-time operations that accept a single input parameter but return no result.
It is similar to the FnOnce(&T) trait in the standard library.
This module provides a unified ConsumerOnce trait and one concrete implementation:
BoxConsumerOnce<T>: Box-based single ownership implementation
§Why No Arc/Rc Variants?
Unlike reusable Consumer implementations,
this module does not provide ArcConsumerOnce or RcConsumerOnce
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
ConsumerOnce uses FnOnce(&T) semantics for truly one-time consumption operations.
Unlike Consumer, ConsumerOnce consumes itself on first call. Suitable for initialization callbacks, cleanup callbacks, and similar scenarios.
Structs§
- BoxConditional
Consumer Once - BoxConditionalConsumerOnce struct
- BoxConsumer
Once - BoxConsumerOnce struct
Traits§
- Consumer
Once - ConsumerOnce trait - Unified one-time consumer interface
- FnConsumer
Once Ops - Extension trait providing one-time consumer composition methods for closures