pub struct Dropper<T>where
T: AsyncDrop,{ /* private fields */ }Expand description
A wrapper that calls AsyncDrop::async_drop when dropped.
Dropper<T> dereferences to T, so the wrapped value can be used
transparently. On drop, it spawns a dedicated thread with a short-lived
Tokio runtime to drive the cleanup future to completion. This avoids
deadlocks when the Dropper is dropped inside a single-threaded async
executor.
§Panics
Panics if the internal Tokio runtime cannot be created.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Dropper<T>where
T: Freeze,
impl<T> RefUnwindSafe for Dropper<T>where
T: RefUnwindSafe,
impl<T> Send for Dropper<T>where
T: Send,
impl<T> Sync for Dropper<T>where
T: Sync,
impl<T> Unpin for Dropper<T>where
T: Unpin,
impl<T> UnsafeUnpin for Dropper<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Dropper<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more