Module closure_once_trait

Module closure_once_trait 

Source
Expand description

§Closure Once Trait Implementation Macro

This module provides the impl_closure_once_trait! macro for implementing common conversion methods for closure-based once traits.

§Overview

The macro generates standard conversion methods (into_box, into_fn) for traits that are implemented by closures with once semantics. It automatically infers all necessary information from the function signature and trait name.

§Generated Methods

  • into_box(): Converts the closure into a boxed wrapper type
  • into_fn(): Returns the closure as a generic FnOnce implementation
  • Core method: Direct delegation to the underlying closure

§Usage

The macro is typically used in trait definitions to provide consistent conversion methods across different once trait implementations.

§Author

Haixing Hu