|
rstd 0.1.0
|
A scope guard that invokes a callable on the inner value when dropped. More...
Public Member Functions | |
| constexpr auto | as_ptr () const noexcept |
| Returns a const pointer to the guarded value. | |
| constexpr auto | as_mut_ptr () noexcept |
| Returns a mutable pointer to the guarded value. | |
Static Public Member Functions | |
| static auto | make (T &&inner, F &&f) -> Self |
Creates a DropGuard wrapping the value and drop function. | |
A scope guard that invokes a callable on the inner value when dropped.
On destruction, the inner value is moved out and passed to the stored callable F. Useful for ensuring cleanup logic runs even when leaving scope via an exception.
| T | The guarded value type. |
| F | A callable type invoked as f(T*) on drop. |
|
inlinestatic |