Crate scopeguard [] [src]

A scope guard will run a given closure when it goes out of scope, even if the code between panics. (as long as panic doesn't abort)

Crate features:

  • use_std
    • Enabled by default. Enables the OnUnwind strategy.
    • Disable to use no_std.

Macros

defer

Macro to create a ScopeGuard (always run).

defer_on_unwind

Macro to create a ScopeGuard (run on unwinding from panic).

Structs

ScopeGuard

ScopeGuard is a scope guard that may own a protected value.

Enums

Always

Always run on scope exit.

OnUnwind

Run on scope exit through unwinding.

Traits

Strategy

Functions

guard

Create a new ScopeGuard owning v and with deferred closure dropfn.

guard_on_unwind

Create a new ScopeGuard owning v and with deferred closure dropfn.