pub trait OnDropFutureExt: Sized + Future {
// Provided method
fn on_drop<F>(self, on_drop: F) -> OnDropFuture<Self, F> ⓘ
where F: FnOnce() { ... }
}Expand description
Extension trait for running a callback when a pending future is dropped.
Provided Methods§
Sourcefn on_drop<F>(self, on_drop: F) -> OnDropFuture<Self, F> ⓘwhere
F: FnOnce(),
fn on_drop<F>(self, on_drop: F) -> OnDropFuture<Self, F> ⓘwhere
F: FnOnce(),
Wraps this future so that on_drop is called if the future is dropped
before it completes. The callback is cancelled once the future
completes, whatever its output.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".