Expand description
This crate provides little utilities to declare callbacks inside a scope, that get executed on success, failure, or exit on that scope.
This is different than the ScopeGuard crate does, because here it’s dependent on the scope’s outcome which callbacks should run.
Structs
A guard is a handle to schedule closures on.
Scheduling a closure takes a closure with 1 parameter,
and the parameter it is going to be called with.
It returns a
Handle
to the parameter, so it’s still usable within the scope.
A Handle
implements Deref and DerefMut, to access the parameter.
To cancel a callback, Handle::cancel
should be called.A handle is a handle back to the value a deferred closure is going to be called with.
In order to cancel the closure, and get back the value, use
Handle::cancel
.Traits
A trait to annotate whether a type is
success
or failure
.Functions
Executes the scope
scope
.
A scope is a closure, in which access to a guard is granted.
A guard is used to schedule callbacks to run on a scope’s success, failure, or exit, using
Guard::on_scope_success
, Guard::on_scope_failure
, Guard::on_scope_exit
.