Crate rdefer

Source
Expand description

A Rust crate providing defer functionality for both synchronous and asynchronous code.

This crate provides a defer functionality which is similar to Go’s defer statement. Furthermore it also allows for asynchronous defers. This is done by using a counter which is decremented every time a defer is executed. When the counter reaches 0, the provided function is executed.

Macros§

defer
A macro for creating a Defer instance. This macro takes a block of code to be deferred.

Structs§

Defer
The Defer struct provides defer functionality for synchronous code. It takes a function which is run when the Defer struct is dropped.