Skip to main content

OnDropFutureExt

Trait OnDropFutureExt 

Source
pub trait OnDropFutureExt: Future + Sized {
    // Provided method
    fn on_drop<F: FnOnce()>(self, on_drop: F) -> OnDropFuture<Self, F>  { ... }
}
Expand description

Trait adds future on_drop support

Provided Methods§

Source

fn on_drop<F: FnOnce()>(self, on_drop: F) -> OnDropFuture<Self, F>

Wraps this future so that on_drop is called if the future is dropped before it completes. The callback is cancelled if the future resolves successfully.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§