Skip to main content

OnDropCallback

Trait OnDropCallback 

Source
pub trait OnDropCallback: Send + 'static {
    // Required method
    fn on_drop(self);
}
Available on crate feature on-early-drop only.
Expand description

Callback fired exactly once when an early-drop event is observed.

FnOnce() + Send + 'static closures implement this via a blanket impl.

§Panics

Implementations must not panic. Callbacks fire from Drop; panicking during a drop that occurs while another panic is unwinding aborts the process. The crate’s built-in callbacks are panic-free.

Required Methods§

Source

fn on_drop(self)

Fire the callback. Consumes self.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl OnDropCallback for NoopDropCallback

Source§

impl<F> OnDropCallback for BodyDropFailureCallback<F>
where F: OnFailure<DroppedFailure> + Send + 'static,

Available on crate feature trace only.
Source§

impl<F> OnDropCallback for F
where F: FnOnce() + Send + 'static,

Source§

impl<F> OnDropCallback for FutureDropFailureCallback<F>
where F: OnFailure<DroppedFailure> + Send + 'static,

Available on crate feature trace only.