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.
This module provides a unified ConsumerOnce trait and one concrete implementation:
BoxConsumerOnce<T>: Box-based single ownership implementation
§Why No Arc/Rc Variants?
Unlike Consumer and ReadonlyConsumer, this module does not provide ArcConsumerOnce
or RcConsumerOnce implementations. This is a design decision based on the fact that
FnOnce semantics are fundamentally incompatible with shared ownership. See design docs for details.
§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.
§Author
Hu Haixing
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