pub fn on_drop<Fut: Future, Fun: FnOnce()>(
future: Fut,
on_drop: Fun
) -> OnDrop<Fut, Fun> ⓘ
Expand description
Adds a closure to the future, which will be executed when the future is dropped. This can be useful to cleanup external resources on future cancelation or completion.