oxipng/doc/bitflags/__core/ops/trait.Drop.html
2016-05-04 10:41:29 -04:00

178 lines
No EOL
13 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `Drop` trait in crate `bitflags`.">
<meta name="keywords" content="rust, rustlang, rust-lang, Drop">
<title>bitflags::__core::ops::Drop - Rust</title>
<link rel="stylesheet" type="text/css" href="../../../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../../../main.css">
</head>
<body class="rustdoc">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'><a href='../../index.html'>bitflags</a>::<wbr><a href='../index.html'>__core</a>::<wbr><a href='index.html'>ops</a></p><script>window.sidebarCurrent = {name: 'Drop', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content trait">
<h1 class='fqn'><span class='in-band'>Trait <a href='../../index.html'>bitflags</a>::<wbr><a href='../index.html'>__core</a>::<wbr><a href='index.html'>ops</a>::<wbr><a class='trait' href=''>Drop</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>&#x2212;</span>]
</a>
</span><a id='src-12926' class='srclink' href='https://doc.rust-lang.org/nightly/core/ops/trait.Drop.html?gotosrc=12926' title='goto source code'>[src]</a></span></h1>
<pre class='rust trait'>pub trait Drop {
fn <a href='#tymethod.drop' class='fnname'>drop</a>(&amp;mut self);
}</pre><div class='docblock'><p>The <code>Drop</code> trait is used to run some code when a value goes out of scope.
This is sometimes called a &#39;destructor&#39;.</p>
<h1 id='examples' class='section-header'><a href='#examples'>Examples</a></h1>
<p>A trivial implementation of <code>Drop</code>. The <code>drop</code> method is called when <code>_x</code>
goes out of scope, and therefore <code>main</code> prints <code>Dropping!</code>.</p>
<pre class='rust rust-example-rendered'>
<span class='kw'>struct</span> <span class='ident'>HasDrop</span>;
<span class='kw'>impl</span> <span class='ident'>Drop</span> <span class='kw'>for</span> <span class='ident'>HasDrop</span> {
<span class='kw'>fn</span> <span class='ident'>drop</span>(<span class='kw-2'>&amp;</span><span class='kw-2'>mut</span> <span class='self'>self</span>) {
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Dropping!&quot;</span>);
}
}
<span class='kw'>fn</span> <span class='ident'>main</span>() {
<span class='kw'>let</span> <span class='ident'>_x</span> <span class='op'>=</span> <span class='ident'>HasDrop</span>;
}</pre>
</div>
<h2 id='required-methods'>Required Methods</h2>
<div class='methods'>
<h3 id='tymethod.drop' class='method stab '><code>fn <a href='#tymethod.drop' class='fnname'>drop</a>(&amp;mut self)</code></h3><div class='docblock'><p>A method called when the value goes out of scope.</p>
<p>When this method has been called, <code>self</code> has not yet been deallocated.
If it were, <code>self</code> would be a dangling reference.</p>
<p>After this function is over, the memory of <code>self</code> will be deallocated.</p>
<h1 id='panics' class='section-header'><a href='#panics'>Panics</a></h1>
<p>Given that a <code>panic!</code> will call <code>drop()</code> as it unwinds, any <code>panic!</code> in
a <code>drop()</code> implementation will likely abort.</p>
</div></div>
<h2 id='implementors'>Implementors</h2>
<ul class='item-list' id='implementors-list'>
<li><code>impl&lt;T&gt; Drop for <a class='struct' href='../../../bitflags/__core/collections/linked_list/struct.LinkedList.html' title='bitflags::__core::collections::linked_list::LinkedList'>LinkedList</a>&lt;T&gt;</code></li>
<li><code>impl&lt;T&gt; Drop for <a class='struct' href='../../../bitflags/__core/collections/struct.VecDeque.html' title='bitflags::__core::collections::VecDeque'>VecDeque</a>&lt;T&gt;</code></li>
<li><code>impl&lt;'a, T&gt; Drop for <a class='struct' href='../../../bitflags/__core/collections/vec_deque/struct.Drain.html' title='bitflags::__core::collections::vec_deque::Drain'>Drain</a>&lt;'a, T&gt; <span class='where'>where T: 'a</span></code></li>
<li><code>impl&lt;W&gt; Drop for <a class='struct' href='../../../bitflags/__core/io/struct.BufWriter.html' title='bitflags::__core::io::BufWriter'>BufWriter</a>&lt;W&gt; <span class='where'>where W: <a class='trait' href='../../../bitflags/__core/io/trait.Write.html' title='bitflags::__core::io::Write'>Write</a></span></code></li>
<li><code>impl Drop for <a class='struct' href='../../../bitflags/__core/sync/mpsc/struct.Select.html' title='bitflags::__core::sync::mpsc::Select'>Select</a></code></li>
<li><code>impl&lt;'rx, T&gt; Drop for <a class='struct' href='../../../bitflags/__core/sync/mpsc/struct.Handle.html' title='bitflags::__core::sync::mpsc::Handle'>Handle</a>&lt;'rx, T&gt; <span class='where'>where T: <a class='trait' href='../../../bitflags/__core/marker/trait.Send.html' title='bitflags::__core::marker::Send'>Send</a></span></code></li>
<li><code>impl&lt;T&gt; Drop for <a class='struct' href='../../../bitflags/__core/sync/mpsc/struct.Sender.html' title='bitflags::__core::sync::mpsc::Sender'>Sender</a>&lt;T&gt;</code></li>
<li><code>impl&lt;T&gt; Drop for <a class='struct' href='../../../bitflags/__core/sync/mpsc/struct.SyncSender.html' title='bitflags::__core::sync::mpsc::SyncSender'>SyncSender</a>&lt;T&gt;</code></li>
<li><code>impl&lt;T&gt; Drop for <a class='struct' href='../../../bitflags/__core/sync/mpsc/struct.Receiver.html' title='bitflags::__core::sync::mpsc::Receiver'>Receiver</a>&lt;T&gt;</code></li>
<li><code>impl Drop for <a class='struct' href='../../../bitflags/__core/sync/struct.Condvar.html' title='bitflags::__core::sync::Condvar'>Condvar</a></code></li>
<li><code>impl&lt;T&gt; Drop for <a class='struct' href='../../../bitflags/__core/sync/struct.Mutex.html' title='bitflags::__core::sync::Mutex'>Mutex</a>&lt;T&gt; <span class='where'>where T: ?<a class='trait' href='../../../bitflags/__core/marker/trait.Sized.html' title='bitflags::__core::marker::Sized'>Sized</a></span></code></li>
<li><code>impl&lt;'a, T&gt; Drop for <a class='struct' href='../../../bitflags/__core/sync/struct.MutexGuard.html' title='bitflags::__core::sync::MutexGuard'>MutexGuard</a>&lt;'a, T&gt; <span class='where'>where T: ?<a class='trait' href='../../../bitflags/__core/marker/trait.Sized.html' title='bitflags::__core::marker::Sized'>Sized</a></span></code></li>
<li><code>impl&lt;T&gt; Drop for <a class='struct' href='../../../bitflags/__core/sync/struct.RwLock.html' title='bitflags::__core::sync::RwLock'>RwLock</a>&lt;T&gt; <span class='where'>where T: ?<a class='trait' href='../../../bitflags/__core/marker/trait.Sized.html' title='bitflags::__core::marker::Sized'>Sized</a></span></code></li>
<li><code>impl&lt;'a, T&gt; Drop for <a class='struct' href='../../../bitflags/__core/sync/struct.RwLockReadGuard.html' title='bitflags::__core::sync::RwLockReadGuard'>RwLockReadGuard</a>&lt;'a, T&gt; <span class='where'>where T: ?<a class='trait' href='../../../bitflags/__core/marker/trait.Sized.html' title='bitflags::__core::marker::Sized'>Sized</a></span></code></li>
<li><code>impl&lt;'a, T&gt; Drop for <a class='struct' href='../../../bitflags/__core/sync/struct.RwLockWriteGuard.html' title='bitflags::__core::sync::RwLockWriteGuard'>RwLockWriteGuard</a>&lt;'a, T&gt; <span class='where'>where T: ?<a class='trait' href='../../../bitflags/__core/marker/trait.Sized.html' title='bitflags::__core::marker::Sized'>Sized</a></span></code></li>
<li><code>impl&lt;T&gt; Drop for <a class='struct' href='../../../bitflags/__core/vec/struct.Vec.html' title='bitflags::__core::vec::Vec'>Vec</a>&lt;T&gt;</code></li>
<li><code>impl&lt;T&gt; Drop for <a class='struct' href='../../../bitflags/__core/vec/struct.IntoIter.html' title='bitflags::__core::vec::IntoIter'>IntoIter</a>&lt;T&gt;</code></li>
<li><code>impl&lt;'a, T&gt; Drop for <a class='struct' href='../../../bitflags/__core/vec/struct.Drain.html' title='bitflags::__core::vec::Drain'>Drain</a>&lt;'a, T&gt;</code></li>
<li><code>impl&lt;T&gt; Drop for <a class='struct' href='../../../bitflags/__core/boxed/struct.IntermediateBox.html' title='bitflags::__core::boxed::IntermediateBox'>IntermediateBox</a>&lt;T&gt; <span class='where'>where T: ?<a class='trait' href='../../../bitflags/__core/marker/trait.Sized.html' title='bitflags::__core::marker::Sized'>Sized</a></span></code></li>
<li><code>impl&lt;T&gt; Drop for <a class='struct' href='../../../bitflags/__core/rc/struct.Rc.html' title='bitflags::__core::rc::Rc'>Rc</a>&lt;T&gt; <span class='where'>where T: ?<a class='trait' href='../../../bitflags/__core/marker/trait.Sized.html' title='bitflags::__core::marker::Sized'>Sized</a></span></code></li>
<li><code>impl&lt;T&gt; Drop for <a class='struct' href='../../../bitflags/__core/rc/struct.Weak.html' title='bitflags::__core::rc::Weak'>Weak</a>&lt;T&gt; <span class='where'>where T: ?<a class='trait' href='../../../bitflags/__core/marker/trait.Sized.html' title='bitflags::__core::marker::Sized'>Sized</a></span></code></li>
<li><code>impl&lt;'a&gt; Drop for <a class='struct' href='../../../bitflags/__core/string/struct.Drain.html' title='bitflags::__core::string::Drain'>Drain</a>&lt;'a&gt;</code></li>
<li><code>impl&lt;K, V&gt; Drop for <a class='struct' href='../../../bitflags/__core/collections/struct.BTreeMap.html' title='bitflags::__core::collections::BTreeMap'>BTreeMap</a>&lt;K, V&gt;</code></li>
<li><code>impl&lt;K, V&gt; Drop for <a class='struct' href='../../../bitflags/__core/collections/btree_map/struct.IntoIter.html' title='bitflags::__core::collections::btree_map::IntoIter'>IntoIter</a>&lt;K, V&gt;</code></li>
<li><code>impl&lt;T&gt; Drop for <a class='struct' href='../../../bitflags/__core/sync/struct.Arc.html' title='bitflags::__core::sync::Arc'>Arc</a>&lt;T&gt; <span class='where'>where T: ?<a class='trait' href='../../../bitflags/__core/marker/trait.Sized.html' title='bitflags::__core::marker::Sized'>Sized</a></span></code></li>
<li><code>impl&lt;T&gt; Drop for <a class='struct' href='../../../bitflags/__core/sync/struct.Weak.html' title='bitflags::__core::sync::Weak'>Weak</a>&lt;T&gt; <span class='where'>where T: ?<a class='trait' href='../../../bitflags/__core/marker/trait.Sized.html' title='bitflags::__core::marker::Sized'>Sized</a></span></code></li>
<li><code>impl&lt;T&gt; Drop for <a class='struct' href='https://doc.rust-lang.org/nightly/alloc/raw_vec/struct.RawVec.html' title='alloc::raw_vec::RawVec'>RawVec</a>&lt;T&gt;</code></li>
</ul><script type="text/javascript" async
src="../../../implementors/core/ops/trait.Drop.js">
</script></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../../";
window.currentCrate = "bitflags";
window.playgroundUrl = "";
</script>
<script src="../../../jquery.js"></script>
<script src="../../../main.js"></script>
<script defer src="../../../search-index.js"></script>
</body>
</html>