Trait bitflags::__core::ops::Drop
[−]
[src]
pub trait Drop {
fn drop(&mut self);
}The 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. The drop method is called when _x
goes out of scope, and therefore main prints Dropping!.
struct HasDrop; impl Drop for HasDrop { fn drop(&mut self) { println!("Dropping!"); } } fn main() { let _x = HasDrop; }
Required Methods
fn drop(&mut self)
A method called when the value goes out of scope.
When this method has been called, self has not yet been deallocated.
If it were, self would be a dangling reference.
After this function is over, the memory of self will be deallocated.
Panics
Given that a panic! will call drop() as it unwinds, any panic! in
a drop() implementation will likely abort.
Implementors
impl<T> Drop for IntermediateBox<T> where T: ?Sizedimpl<T> Drop for Arc<T> where T: ?Sizedimpl<T> Drop for Weak<T> where T: ?Sizedimpl<T> Drop for Rc<T> where T: ?Sizedimpl<T> Drop for Weak<T> where T: ?Sizedimpl<T> Drop for RawVec<T>impl<'b> Drop for BorrowRef<'b>impl<'b> Drop for BorrowRefMut<'b>impl<'a, T> Drop for Hole<'a, T>impl<K, V> Drop for BTreeMap<K, V>impl<K, V> Drop for IntoIter<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<T> Drop for VecDeque<T>impl<'a, T> Drop for Drain<'a, T> where T: 'aimpl<'a, K, V> Drop for Drain<'a, K, V> where K: 'a, V: 'aimpl<K, V> Drop for RawTable<K, V>impl Drop for DynamicLibraryimpl<W> Drop for BufWriter<W> where W: Writeimpl<T> Drop for Packet<T>impl Drop for Selectimpl<'rx, T> Drop for Handle<'rx, T> where T: Sendimpl<T> Drop for Packet<T>impl<T> Drop for Packet<T>impl<T> Drop for Packet<T>impl<T> Drop for Queue<T>impl<T> Drop for Queue<T>impl<T> Drop for Sender<T>impl<T> Drop for SyncSender<T>impl<T> Drop for Receiver<T>impl Drop for Condvarimpl<T> Drop for Mutex<T> where T: ?Sizedimpl<'a, T> Drop for MutexGuard<'a, T> where T: ?Sizedimpl<T> Drop for RwLock<T> where T: ?Sizedimpl<'a, T> Drop for RwLockReadGuard<'a, T> where T: ?Sizedimpl<'a, T> Drop for RwLockWriteGuard<'a, T> where T: ?Sizedimpl<'a> Drop for SemaphoreGuard<'a>impl Drop for LookupHostimpl<T> Drop for ReentrantMutex<T>impl<'a, T> Drop for ReentrantMutexGuard<'a, T>impl Drop for Keyimpl Drop for FileDescimpl Drop for Dirimpl Drop for Handlerimpl Drop for Thread