Trait std::ops::Drop
[−]
[src]
pub trait Drop {
fn drop(&mut self);
}The Drop`Drop` trait is used to run some code when a value goes out of scope. This
is sometimes called a 'destructor'.
Examples
A trivial implementation of Drop`Drop. The`. The drop`dropmethod is called when` method is called when _x`_xgoes out of scope, and therefore` goes
out of scope, and therefore main`mainprints` prints Dropping!`Dropping!`.
struct HasDrop; impl Drop for HasDrop { fn drop(&mut self) { println!("Dropping!"); } } fn main() { let _x = HasDrop; }
Required Methods
fn drop(&mut self)
The drop`drop` method, called when the value goes out of scope.
Implementors
impl<'b> Drop for BorrowRef<'b>impl<'b> Drop for BorrowRefMut<'b>impl<T> Drop for Arc<T>impl<T> Drop for Weak<T>impl<T> Drop for Rc<T> where T: ?Sizedimpl<T> Drop for Weak<T> where T: ?Sizedimpl<'a, T> Drop for Hole<'a, T>impl<T> Drop for RawItems<T>impl<K, V> Drop for Node<K, V>impl<K, V> Drop for MoveTraversalImpl<K, V>impl<T> Drop for LinkedList<T>impl<'a> Drop for Drain<'a>impl<T> Drop for Vec<T>impl<T> Drop for IntoIter<T>impl<'a, T> Drop for Drain<'a, T>impl<'a, T> Drop for DerefVec<'a, T>impl<T, U> Drop for PartialVecNonZeroSized<T, U>impl<T, U> Drop for PartialVecZeroSized<T, U>impl<T> Drop for VecDeque<T>impl<'a, T> Drop for Drain<'a, T> where T: 'aimpl<'a, T: Send + 'a> Drop for JoinGuard<'a, T>impl Drop for DynamicLibraryimpl<W: Write> Drop for BufWriter<W>impl Drop for Selectimpl<'rx, T: Send> Drop for Handle<'rx, T>impl<T> Drop for Sender<T>impl<T> Drop for SyncSender<T>impl<T> Drop for Receiver<T>impl Drop for Condvarimpl<T: ?Sized> Drop for Mutex<T>impl<'a, T: ?Sized> Drop for MutexGuard<'a, T>impl<T: ?Sized> Drop for RwLock<T>impl<'a, T: ?Sized> Drop for RwLockReadGuard<'a, T>impl<'a, T: ?Sized> Drop for RwLockWriteGuard<'a, T>impl<'a> Drop for SemaphoreGuard<'a>