pub enum DropResource {
Fun(Option<Box<dyn FnOnce()>>),
Struct(Box<dyn Any>),
}Expand description
Runs a destructor when dropped (or holds a value whose Drop cleans up).
Variants§
Implementations§
Source§impl DropResource
impl DropResource
pub fn new<F: FnOnce() + 'static>(drop_fun: F) -> DropResource
pub fn from_struct(inst: impl Any) -> DropResource
pub fn off(self)
Trait Implementations§
Source§impl Drop for DropResource
impl Drop for DropResource
Auto Trait Implementations§
impl !RefUnwindSafe for DropResource
impl !Send for DropResource
impl !Sync for DropResource
impl !UnwindSafe for DropResource
impl Freeze for DropResource
impl Unpin for DropResource
impl UnsafeUnpin for DropResource
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