Skip to main content

dtor

Attribute Macro dtor 

Source
#[dtor]
Expand description

Marks a function as a library/executable destructor. This uses OS-specific linker sections to call a specific function at termination time.

Multiple shutdown functions are supported, but the invocation order is not guaranteed.

The dtor crate assumes it is available as a direct dependency. If you re-export dtor items as part of your crate, you can use the crate_path parameter to redirect the macro’s output to the correct crate, or use the declarative::dtor form.


#[dtor(unsafe)]
fn shutdown() {
  /* ... */
}