Sophie

Sophie

distrib > Mageia > 6 > armv7hl > by-pkgid > 4e2dbb669434a7691662cb2f0ad38972 > files > 12051

rust-doc-1.28.0-1.mga6.armv7hl.rpm

<!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 `Cell` struct in crate `std`."><meta name="keywords" content="rust, rustlang, rust-lang, Cell"><title>std::cell::Cell - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><link rel="shortcut icon" href="https://doc.rust-lang.org/favicon.ico"></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../std/index.html'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='logo' width='100'></a><p class='location'>Struct Cell</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.get">get</a><a href="#method.update">update</a><a href="#method.new">new</a><a href="#method.as_ptr">as_ptr</a><a href="#method.get_mut">get_mut</a><a href="#method.set">set</a><a href="#method.swap">swap</a><a href="#method.replace">replace</a><a href="#method.into_inner">into_inner</a><a href="#method.take">take</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-CoerceUnsized%3CCell%3CU%3E%3E">CoerceUnsized&lt;Cell&lt;U&gt;&gt;</a><a href="#impl-PartialEq%3CCell%3CT%3E%3E">PartialEq&lt;Cell&lt;T&gt;&gt;</a><a href="#impl-Ord">Ord</a><a href="#impl-PartialOrd%3CCell%3CT%3E%3E">PartialOrd&lt;Cell&lt;T&gt;&gt;</a><a href="#impl-Debug">Debug</a><a href="#impl-Send">Send</a><a href="#impl-Sync">!Sync</a><a href="#impl-Eq">Eq</a><a href="#impl-Clone">Clone</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Default">Default</a></div></div><p class='location'><a href='../index.html'>std</a>::<wbr><a href='index.html'>cell</a></p><script>window.sidebarCurrent = {name: 'Cell', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><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"><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>std</a>::<wbr><a href='index.html'>cell</a>::<wbr><a class="struct" href=''>Cell</a></span><span class='out-of-band'><span class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><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 class='srclink' href='../../src/core/cell.rs.html#238-240' title='goto source code'>[src]</a></span></h1><div class="docblock type-decl"><pre class='rust struct'>pub struct Cell&lt;T&gt; { /* fields omitted */ }</pre></div><div class='docblock'><p>A mutable memory location.</p>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
<p>Here you can see how using <code>Cell&lt;T&gt;</code> allows to use mutable field inside
immutable struct (which is also called 'interior mutability').</p>

<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">cell</span>::<span class="ident">Cell</span>;

<span class="kw">struct</span> <span class="ident">SomeStruct</span> {
    <span class="ident">regular_field</span>: <span class="ident">u8</span>,
    <span class="ident">special_field</span>: <span class="ident">Cell</span><span class="op">&lt;</span><span class="ident">u8</span><span class="op">&gt;</span>,
}

<span class="kw">let</span> <span class="ident">my_struct</span> <span class="op">=</span> <span class="ident">SomeStruct</span> {
    <span class="ident">regular_field</span>: <span class="number">0</span>,
    <span class="ident">special_field</span>: <span class="ident">Cell</span>::<span class="ident">new</span>(<span class="number">1</span>),
};

<span class="kw">let</span> <span class="ident">new_value</span> <span class="op">=</span> <span class="number">100</span>;

<span class="comment">// ERROR, because my_struct is immutable</span>
<span class="comment">// my_struct.regular_field = new_value;</span>

<span class="comment">// WORKS, although `my_struct` is immutable, field `special_field` is mutable because it is Cell</span>
<span class="ident">my_struct</span>.<span class="ident">special_field</span>.<span class="ident">set</span>(<span class="ident">new_value</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">my_struct</span>.<span class="ident">special_field</span>.<span class="ident">get</span>(), <span class="ident">new_value</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Acell%3A%3ACell%3B%0A%0Astruct%20SomeStruct%20%7B%0A%20%20%20%20regular_field%3A%20u8%2C%0A%20%20%20%20special_field%3A%20Cell%3Cu8%3E%2C%0A%7D%0A%0Alet%20my_struct%20%3D%20SomeStruct%20%7B%0A%20%20%20%20regular_field%3A%200%2C%0A%20%20%20%20special_field%3A%20Cell%3A%3Anew(1)%2C%0A%7D%3B%0A%0Alet%20new_value%20%3D%20100%3B%0A%0A%2F%2F%20ERROR%2C%20because%20my_struct%20is%20immutable%0A%2F%2F%20my_struct.regular_field%20%3D%20new_value%3B%0A%0A%2F%2F%20WORKS%2C%20although%20%60my_struct%60%20is%20immutable%2C%20field%20%60special_field%60%20is%20mutable%20because%20it%20is%20Cell%0Amy_struct.special_field.set(new_value)%3B%0Aassert_eq!(my_struct.special_field.get()%2C%20new_value)%3B%0A%7D">Run</a></pre>
<p>See the <a href="index.html">module-level documentation</a> for more.</p>
</div>
                    <h2 id='methods' class='small-section-header'>
                      Methods<a href='#methods' class='anchor'></a>
                    </h2>
                <h3 id='impl' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/marker/trait.Copy.html" title="trait std::marker::Copy">Copy</a>,&nbsp;</span></code><a href='#impl' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#242-286' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.get' class="method"><span id='get.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.get' class='fnname'>get</a>(&amp;self) -&gt; T</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#256-258' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Returns a copy of the contained value.</p>
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">cell</span>::<span class="ident">Cell</span>;

<span class="kw">let</span> <span class="ident">c</span> <span class="op">=</span> <span class="ident">Cell</span>::<span class="ident">new</span>(<span class="number">5</span>);

<span class="kw">let</span> <span class="ident">five</span> <span class="op">=</span> <span class="ident">c</span>.<span class="ident">get</span>();<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Acell%3A%3ACell%3B%0A%0Alet%20c%20%3D%20Cell%3A%3Anew(5)%3B%0A%0Alet%20five%20%3D%20c.get()%3B%0A%7D">Run</a></pre>
</div><h4 id='method.update' class="method"><span id='update.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.update' class='fnname'>update</a>&lt;F&gt;(&amp;self, f: F) -&gt; T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/ops/trait.FnOnce.html" title="trait std::ops::FnOnce">FnOnce</a>(T) -&gt; T,&nbsp;</span></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#277-285' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API.  (<code>cell_update </code><a href="https://github.com/rust-lang/rust/issues/50186">#50186</a>)</div></div><div class='docblock'><p>Updates the contained value using a function and returns the new value.</p>
<h1 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">cell_update</span>)]</span>

<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">cell</span>::<span class="ident">Cell</span>;

<span class="kw">let</span> <span class="ident">c</span> <span class="op">=</span> <span class="ident">Cell</span>::<span class="ident">new</span>(<span class="number">5</span>);
<span class="kw">let</span> <span class="ident">new</span> <span class="op">=</span> <span class="ident">c</span>.<span class="ident">update</span>(<span class="op">|</span><span class="ident">x</span><span class="op">|</span> <span class="ident">x</span> <span class="op">+</span> <span class="number">1</span>);

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">new</span>, <span class="number">6</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">c</span>.<span class="ident">get</span>(), <span class="number">6</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0A%23!%5Bfeature(cell_update)%5D%0A%0Afn%20main()%20%7B%0Ause%20std%3A%3Acell%3A%3ACell%3B%0A%0Alet%20c%20%3D%20Cell%3A%3Anew(5)%3B%0Alet%20new%20%3D%20c.update(%7Cx%7C%20x%20%2B%201)%3B%0A%0Aassert_eq!(new%2C%206)%3B%0Aassert_eq!(c.get()%2C%206)%3B%0A%7D&amp;version=nightly">Run</a></pre>
</div></div><h3 id='impl-1' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt;</code><a href='#impl-1' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#365-499' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub const fn <a href='#method.new' class='fnname'>new</a>(value: T) -&gt; <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#377-381' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Creates a new <code>Cell</code> containing the given value.</p>
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">cell</span>::<span class="ident">Cell</span>;

<span class="kw">let</span> <span class="ident">c</span> <span class="op">=</span> <span class="ident">Cell</span>::<span class="ident">new</span>(<span class="number">5</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Acell%3A%3ACell%3B%0A%0Alet%20c%20%3D%20Cell%3A%3Anew(5)%3B%0A%7D">Run</a></pre>
</div><h4 id='method.as_ptr' class="method"><span id='as_ptr.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.as_ptr' class='fnname'>as_ptr</a>(&amp;self) -&gt; <a class="primitive" href="../primitive.pointer.html">*mut T</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.12.0'>1.12.0</div><a class='srclink' href='../../src/core/cell.rs.html#396-398' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Returns a raw pointer to the underlying data in this cell.</p>
<h1 id="examples-4" class="section-header"><a href="#examples-4">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">cell</span>::<span class="ident">Cell</span>;

<span class="kw">let</span> <span class="ident">c</span> <span class="op">=</span> <span class="ident">Cell</span>::<span class="ident">new</span>(<span class="number">5</span>);

<span class="kw">let</span> <span class="ident">ptr</span> <span class="op">=</span> <span class="ident">c</span>.<span class="ident">as_ptr</span>();<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Acell%3A%3ACell%3B%0A%0Alet%20c%20%3D%20Cell%3A%3Anew(5)%3B%0A%0Alet%20ptr%20%3D%20c.as_ptr()%3B%0A%7D">Run</a></pre>
</div><h4 id='method.get_mut' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="primitive" href="../primitive.reference.html">&amp;'a mut </a>I</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="../primitive.reference.html">&amp;'a mut </a>I</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, I&gt; <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="primitive" href="../primitive.reference.html">&amp;'a mut </a>I <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">    type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>&gt;::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl&lt;'a, R:&nbsp;<a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="primitive" href="../primitive.reference.html">&amp;'a mut </a>R</span><span class="where fmt-newline">impl&lt;'a, W:&nbsp;<a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="primitive" href="../primitive.reference.html">&amp;'a mut </a>W</span></code></div></div><span id='get_mut.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.get_mut' class='fnname'>get_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="../primitive.reference.html">&amp;mut </a>T</code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.11.0'>1.11.0</div><a class='srclink' href='../../src/core/cell.rs.html#417-421' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Returns a mutable reference to the underlying data.</p>
<p>This call borrows <code>Cell</code> mutably (at compile-time) which guarantees
that we possess the only reference.</p>
<h1 id="examples-5" class="section-header"><a href="#examples-5">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">cell</span>::<span class="ident">Cell</span>;

<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">c</span> <span class="op">=</span> <span class="ident">Cell</span>::<span class="ident">new</span>(<span class="number">5</span>);
<span class="kw-2">*</span><span class="ident">c</span>.<span class="ident">get_mut</span>() <span class="op">+=</span> <span class="number">1</span>;

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">c</span>.<span class="ident">get</span>(), <span class="number">6</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Acell%3A%3ACell%3B%0A%0Alet%20mut%20c%20%3D%20Cell%3A%3Anew(5)%3B%0A*c.get_mut()%20%2B%3D%201%3B%0A%0Aassert_eq!(c.get()%2C%206)%3B%0A%7D">Run</a></pre>
</div><h4 id='method.set' class="method"><span id='set.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.set' class='fnname'>set</a>(&amp;self, val: T)</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#436-439' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Sets the contained value.</p>
<h1 id="examples-6" class="section-header"><a href="#examples-6">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">cell</span>::<span class="ident">Cell</span>;

<span class="kw">let</span> <span class="ident">c</span> <span class="op">=</span> <span class="ident">Cell</span>::<span class="ident">new</span>(<span class="number">5</span>);

<span class="ident">c</span>.<span class="ident">set</span>(<span class="number">10</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Acell%3A%3ACell%3B%0A%0Alet%20c%20%3D%20Cell%3A%3Anew(5)%3B%0A%0Ac.set(10)%3B%0A%7D">Run</a></pre>
</div><h4 id='method.swap' class="method"><span id='swap.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.swap' class='fnname'>swap</a>(&amp;self, other: &amp;<a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt;)</code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.17.0'>1.17.0</div><a class='srclink' href='../../src/core/cell.rs.html#457-464' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Swaps the values of two Cells.
Difference with <code>std::mem::swap</code> is that this function doesn't require <code>&amp;mut</code> reference.</p>
<h1 id="examples-7" class="section-header"><a href="#examples-7">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">cell</span>::<span class="ident">Cell</span>;

<span class="kw">let</span> <span class="ident">c1</span> <span class="op">=</span> <span class="ident">Cell</span>::<span class="ident">new</span>(<span class="number">5i32</span>);
<span class="kw">let</span> <span class="ident">c2</span> <span class="op">=</span> <span class="ident">Cell</span>::<span class="ident">new</span>(<span class="number">10i32</span>);
<span class="ident">c1</span>.<span class="ident">swap</span>(<span class="kw-2">&amp;</span><span class="ident">c2</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">10</span>, <span class="ident">c1</span>.<span class="ident">get</span>());
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">5</span>, <span class="ident">c2</span>.<span class="ident">get</span>());<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Acell%3A%3ACell%3B%0A%0Alet%20c1%20%3D%20Cell%3A%3Anew(5i32)%3B%0Alet%20c2%20%3D%20Cell%3A%3Anew(10i32)%3B%0Ac1.swap(%26c2)%3B%0Aassert_eq!(10%2C%20c1.get())%3B%0Aassert_eq!(5%2C%20c2.get())%3B%0A%7D">Run</a></pre>
</div><h4 id='method.replace' class="method"><span id='replace.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.replace' class='fnname'>replace</a>(&amp;self, val: T) -&gt; T</code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.17.0'>1.17.0</div><a class='srclink' href='../../src/core/cell.rs.html#479-481' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Replaces the contained value, and returns it.</p>
<h1 id="examples-8" class="section-header"><a href="#examples-8">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">cell</span>::<span class="ident">Cell</span>;

<span class="kw">let</span> <span class="ident">cell</span> <span class="op">=</span> <span class="ident">Cell</span>::<span class="ident">new</span>(<span class="number">5</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cell</span>.<span class="ident">get</span>(), <span class="number">5</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cell</span>.<span class="ident">replace</span>(<span class="number">10</span>), <span class="number">5</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cell</span>.<span class="ident">get</span>(), <span class="number">10</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Acell%3A%3ACell%3B%0A%0Alet%20cell%20%3D%20Cell%3A%3Anew(5)%3B%0Aassert_eq!(cell.get()%2C%205)%3B%0Aassert_eq!(cell.replace(10)%2C%205)%3B%0Aassert_eq!(cell.get()%2C%2010)%3B%0A%7D">Run</a></pre>
</div><h4 id='method.into_inner' class="method"><span id='into_inner.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.into_inner' class='fnname'>into_inner</a>(self) -&gt; T</code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.17.0'>1.17.0</div><a class='srclink' href='../../src/core/cell.rs.html#496-498' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Unwraps the value.</p>
<h1 id="examples-9" class="section-header"><a href="#examples-9">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">cell</span>::<span class="ident">Cell</span>;

<span class="kw">let</span> <span class="ident">c</span> <span class="op">=</span> <span class="ident">Cell</span>::<span class="ident">new</span>(<span class="number">5</span>);
<span class="kw">let</span> <span class="ident">five</span> <span class="op">=</span> <span class="ident">c</span>.<span class="ident">into_inner</span>();

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">five</span>, <span class="number">5</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Acell%3A%3ACell%3B%0A%0Alet%20c%20%3D%20Cell%3A%3Anew(5)%3B%0Alet%20five%20%3D%20c.into_inner()%3B%0A%0Aassert_eq!(five%2C%205)%3B%0A%7D">Run</a></pre>
</div></div><h3 id='impl-2' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/default/trait.Default.html" title="trait std::default::Default">Default</a>,&nbsp;</span></code><a href='#impl-2' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#501-519' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.take' class="method"><span id='take.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.take' class='fnname'>take</a>(&amp;self) -&gt; T</code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.17.0'>1.17.0</div><a class='srclink' href='../../src/core/cell.rs.html#516-518' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Takes the value of the cell, leaving <code>Default::default()</code> in its place.</p>
<h1 id="examples-10" class="section-header"><a href="#examples-10">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">cell</span>::<span class="ident">Cell</span>;

<span class="kw">let</span> <span class="ident">c</span> <span class="op">=</span> <span class="ident">Cell</span>::<span class="ident">new</span>(<span class="number">5</span>);
<span class="kw">let</span> <span class="ident">five</span> <span class="op">=</span> <span class="ident">c</span>.<span class="ident">take</span>();

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">five</span>, <span class="number">5</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">c</span>.<span class="ident">into_inner</span>(), <span class="number">0</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Acell%3A%3ACell%3B%0A%0Alet%20c%20%3D%20Cell%3A%3Anew(5)%3B%0Alet%20five%20%3D%20c.take()%3B%0A%0Aassert_eq!(five%2C%205)%3B%0Aassert_eq!(c.into_inner()%2C%200)%3B%0A%7D">Run</a></pre>
</div></div>
                <h2 id='implementations' class='small-section-header'>
                  Trait Implementations<a href='#implementations' class='anchor'></a>
                </h2>
                <div id='implementations-list'><h3 id='impl-CoerceUnsized%3CCell%3CU%3E%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;T, U&gt; <a class="trait" href="../../std/ops/trait.CoerceUnsized.html" title="trait std::ops::CoerceUnsized">CoerceUnsized</a>&lt;<a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;U&gt;&gt; for <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/ops/trait.CoerceUnsized.html" title="trait std::ops::CoerceUnsized">CoerceUnsized</a>&lt;U&gt;,&nbsp;</span></code><a href='#impl-CoerceUnsized%3CCell%3CU%3E%3E' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#522' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'></div><h3 id='impl-PartialEq%3CCell%3CT%3E%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; <a class="trait" href="../../std/cmp/trait.PartialEq.html" title="trait std::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt;&gt; for <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/marker/trait.Copy.html" title="trait std::marker::Copy">Copy</a> + <a class="trait" href="../../std/cmp/trait.PartialEq.html" title="trait std::cmp::PartialEq">PartialEq</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-PartialEq%3CCell%3CT%3E%3E' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#312-317' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.eq' class="method"><span id='eq.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&amp;self, other: &amp;<a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt;) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#314-316' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>. <a href="../../std/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
</div><h4 id='method.ne' class="method"><span id='ne.v' class='invisible'><table class='table-display'><tbody><tr><td><code><div class="docblock attributes">#[must_use]
</div>fn <a href='../../std/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&amp;self, other: <a class="primitive" href="../primitive.reference.html">&amp;</a>Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cmp.rs.html#123' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>This method tests for <code>!=</code>.</p>
</div></div><h3 id='impl-Ord' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; <a class="trait" href="../../std/cmp/trait.Ord.html" title="trait std::cmp::Ord">Ord</a> for <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/marker/trait.Copy.html" title="trait std::marker::Copy">Copy</a> + <a class="trait" href="../../std/cmp/trait.Ord.html" title="trait std::cmp::Ord">Ord</a>,&nbsp;</span></code><a href='#impl-Ord' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.10.0'>1.10.0</div><a class='srclink' href='../../src/core/cell.rs.html#351-356' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.cmp' class="method"><span id='cmp.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/cmp/trait.Ord.html#tymethod.cmp' class='fnname'>cmp</a>(&amp;self, other: &amp;<a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt;) -&gt; <a class="enum" href="../../std/cmp/enum.Ordering.html" title="enum std::cmp::Ordering">Ordering</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#353-355' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>This method returns an <code>Ordering</code> between <code>self</code> and <code>other</code>. <a href="../../std/cmp/trait.Ord.html#tymethod.cmp">Read more</a></p>
</div><h4 id='method.max' class="method"><span id='max.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/cmp/trait.Ord.html#method.max' class='fnname'>max</a>(self, other: Self) -&gt; Self</code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.21.0'>1.21.0</div><a class='srclink' href='../../src/core/cmp.rs.html#469-472' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Compares and returns the maximum of two values. <a href="../../std/cmp/trait.Ord.html#method.max">Read more</a></p>
</div><h4 id='method.min' class="method"><span id='min.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/cmp/trait.Ord.html#method.min' class='fnname'>min</a>(self, other: Self) -&gt; Self</code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.21.0'>1.21.0</div><a class='srclink' href='../../src/core/cmp.rs.html#485-488' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Compares and returns the minimum of two values. <a href="../../std/cmp/trait.Ord.html#method.min">Read more</a></p>
</div></div><h3 id='impl-PartialOrd%3CCell%3CT%3E%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; <a class="trait" href="../../std/cmp/trait.PartialOrd.html" title="trait std::cmp::PartialOrd">PartialOrd</a>&lt;<a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt;&gt; for <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/marker/trait.Copy.html" title="trait std::marker::Copy">Copy</a> + <a class="trait" href="../../std/cmp/trait.PartialOrd.html" title="trait std::cmp::PartialOrd">PartialOrd</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-PartialOrd%3CCell%3CT%3E%3E' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.10.0'>1.10.0</div><a class='srclink' href='../../src/core/cell.rs.html#323-348' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.partial_cmp' class="method"><span id='partial_cmp.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&amp;self, other: &amp;<a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt;) -&gt; <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;<a class="enum" href="../../std/cmp/enum.Ordering.html" title="enum std::cmp::Ordering">Ordering</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#325-327' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
</div><h4 id='method.lt' class="method"><span id='lt.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&amp;self, other: &amp;<a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt;) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#330-332' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
</div><h4 id='method.le' class="method"><span id='le.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&amp;self, other: &amp;<a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt;) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#335-337' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
</div><h4 id='method.gt' class="method"><span id='gt.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&amp;self, other: &amp;<a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt;) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#340-342' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
</div><h4 id='method.ge' class="method"><span id='ge.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&amp;self, other: &amp;<a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt;) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#345-347' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
</div></div><h3 id='impl-Debug' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; <a class="trait" href="../../std/fmt/trait.Debug.html" title="trait std::fmt::Debug">Debug</a> for <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/marker/trait.Copy.html" title="trait std::marker::Copy">Copy</a> + <a class="trait" href="../../std/fmt/trait.Debug.html" title="trait std::fmt::Debug">Debug</a>,&nbsp;</span></code><a href='#impl-Debug' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/fmt/mod.rs.html#2053-2059' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="../../std/fmt/struct.Formatter.html" title="struct std::fmt::Formatter">Formatter</a>) -&gt; <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a>&lt;<a class="primitive" href="../primitive.unit.html">()</a>, <a class="struct" href="../../std/fmt/struct.Error.html" title="struct std::fmt::Error">Error</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/fmt/mod.rs.html#2054-2058' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Formats the value using the given formatter. <a href="../../std/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
</div></div><h3 id='impl-Send' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; <a class="trait" href="../../std/marker/trait.Send.html" title="trait std::marker::Send">Send</a> for <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/marker/trait.Send.html" title="trait std::marker::Send">Send</a>,&nbsp;</span></code><a href='#impl-Send' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#289' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; !<a class="trait" href="../../std/marker/trait.Sync.html" title="trait std::marker::Sync">Sync</a> for <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt;</code><a href='#impl-Sync' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#292' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'></div><h3 id='impl-Eq' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; <a class="trait" href="../../std/cmp/trait.Eq.html" title="trait std::cmp::Eq">Eq</a> for <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/marker/trait.Copy.html" title="trait std::marker::Copy">Copy</a> + <a class="trait" href="../../std/cmp/trait.Eq.html" title="trait std::cmp::Eq">Eq</a>,&nbsp;</span></code><a href='#impl-Eq' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.2.0'>1.2.0</div><a class='srclink' href='../../src/core/cell.rs.html#320' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'></div><h3 id='impl-Clone' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; <a class="trait" href="../../std/clone/trait.Clone.html" title="trait std::clone::Clone">Clone</a> for <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/marker/trait.Copy.html" title="trait std::marker::Copy">Copy</a>,&nbsp;</span></code><a href='#impl-Clone' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#295-300' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.clone' class="method"><span id='clone.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&amp;self) -&gt; <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#297-299' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Returns a copy of the value. <a href="../../std/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id='method.clone_from' class="method"><span id='clone_from.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&amp;mut self, source: <a class="primitive" href="../primitive.reference.html">&amp;</a>Self)</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/clone.rs.html#130-132' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="../../std/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div><h3 id='impl-From%3CT%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; <a class="trait" href="../../std/convert/trait.From.html" title="trait std::convert::From">From</a>&lt;T&gt; for <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt;</code><a href='#impl-From%3CT%3E' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.12.0'>1.12.0</div><a class='srclink' href='../../src/core/cell.rs.html#359-363' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.from' class="method"><span id='from.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(t: T) -&gt; <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#360-362' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Performs the conversion.</p>
</div></div><h3 id='impl-Default' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; <a class="trait" href="../../std/default/trait.Default.html" title="trait std::default::Default">Default</a> for <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/default/trait.Default.html" title="trait std::default::Default">Default</a>,&nbsp;</span></code><a href='#impl-Default' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#303-309' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.default' class="method"><span id='default.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/default/trait.Default.html#tymethod.default' class='fnname'>default</a>() -&gt; <a class="struct" href="../../std/cell/struct.Cell.html" title="struct std::cell::Cell">Cell</a>&lt;T&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#306-308' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Creates a <code>Cell&lt;T&gt;</code>, with the <code>Default</code> value for T.</p>
</div></div></div></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><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</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><p>Search multiple things at once by splitting your query with comma (e.g. <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../../";window.currentCrate = "std";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>