#[cfg(feature = "async-std-task")] mod impl_task { use async_std::task::JoinHandle; use crate::{DropGuard, DropGuarded}; impl DropGuarded for JoinHandle { #[inline] fn cancel(self) { let _ = JoinHandle::::cancel(self); } } impl core::future::Future for DropGuard> { type Output = T; fn poll( mut self: core::pin::Pin<&mut Self>, cx: &mut core::task::Context<'_>, ) -> core::task::Poll { let handle = (*self).inner.as_mut().expect("can only be None in drop"); core::pin::Pin::new(handle).poll(cx) } } }