Trait ethcore_util::standard::ops::Drop 1.0.0
[−]
[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.
This function cannot be called explicitly. This is compiler error
E0040. However, the std::mem::drop
function in the prelude can be
used to call the argument's Drop
implementation.
Panics
Given that a panic!
will call drop()
as it unwinds, any panic!
in
a drop()
implementation will likely abort.
Implementors
impl<'a, T> Drop for PeekMut<'a, T> where T: Ord
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: 'a
impl Drop for Secp256k1
impl Drop for DBIterator
impl<'a> Drop for Snapshot<'a>
impl Drop for WriteBatch
impl Drop for DB
impl Drop for ReadOptions
impl Drop for DBVector
impl Drop for Options
impl Drop for BlockBasedOptions
impl Drop for WriteOptions
impl Drop for Cache
impl<'a, T> Drop for SmallVecMoveIterator<'a, T> where T: 'a
impl<A> Drop for SmallVec<A> where A: Array
impl<T> Drop for NoDrop<T>
impl<T> Drop for IntermediateBox<T> where T: ?Sized
impl<T> Drop for Arc<T> where T: ?Sized
impl<T> Drop for Weak<T> where T: ?Sized
impl<T> Drop for Rc<T> where T: ?Sized
impl<T> Drop for Weak<T> where T: ?Sized
impl<T> Drop for RawVec<T>
impl Drop for CString
impl<W> Drop for BufWriter<W> where W: Write
impl Drop for Select
impl<'rx, T> Drop for Handle<'rx, T> where T: Send
impl<T> Drop for Sender<T>
impl<T> Drop for SyncSender<T>
impl<T> Drop for Receiver<T>
impl Drop for Condvar
impl<T> Drop for Mutex<T> where T: ?Sized
impl<'a, T> Drop for MutexGuard<'a, T> where T: ?Sized
impl<T> Drop for RwLock<T> where T: ?Sized
impl<'a, T> Drop for RwLockReadGuard<'a, T> where T: ?Sized
impl<'a, T> Drop for RwLockWriteGuard<'a, T> where T: ?Sized
impl<'a, K, I, F> Drop for Group<'a, K, I, F> where I: Iterator, I::Item: 'a
impl<'a, I> Drop for Chunk<'a, I> where I: Iterator, I::Item: 'a
impl<K, V, S> Drop for LinkedHashMap<K, V, S>
impl<K, V> Drop for IntoIter<K, V>
impl<T> Drop for ThreadLocal<T> where T: Send + ?Sized
impl<'a, T> Drop for MutexGuard<'a, T> where T: 'a + ?Sized
impl<'a, T> Drop for RwLockReadGuard<'a, T> where T: 'a + ?Sized
impl<'a, T> Drop for RwLockWriteGuard<'a, T> where T: 'a + ?Sized
impl Drop for RandomTempPath
impl Drop for StopGuard
impl<A> Drop for ArrayVec<A> where A: Array
impl<A> Drop for IntoIter<A> where A: Array
impl<'a, A> Drop for Drain<'a, A> where A: Array, A::Item: 'a
impl Drop for Database
impl<'a> Drop for TrieDBMut<'a>
impl Drop for PerfTimer