Sophie

Sophie

distrib > Mageia > 6 > x86_64 > media > core-updates > by-pkgid > fdedb3cf2140df9b6d419a2338ab1caa > files > 3504

rust-doc-1.25.0-1.mga6.x86_64.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 `RefCell` struct in crate `std`.">
    <meta name="keywords" content="rust, rustlang, rust-lang, RefCell">

    <title>std::cell::RefCell - 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="../../main.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 RefCell</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.new">new</a><a href="#method.into_inner">into_inner</a><a href="#method.replace">replace</a><a href="#method.replace_with">replace_with</a><a href="#method.swap">swap</a><a href="#method.borrow">borrow</a><a href="#method.try_borrow">try_borrow</a><a href="#method.borrow_mut">borrow_mut</a><a href="#method.try_borrow_mut">try_borrow_mut</a><a href="#method.as_ptr">as_ptr</a><a href="#method.get_mut">get_mut</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-Sync">!Sync</a><a href="#impl-Send">Send</a><a href="#impl-CoerceUnsized%3CRefCell%3CU%3E%3E">CoerceUnsized&lt;RefCell&lt;U&gt;&gt;</a><a href="#impl-Default">Default</a><a href="#impl-Clone">Clone</a><a href="#impl-PartialOrd%3CRefCell%3CT%3E%3E">PartialOrd&lt;RefCell&lt;T&gt;&gt;</a><a href="#impl-Ord">Ord</a><a href="#impl-Eq">Eq</a><a href="#impl-PartialEq%3CRefCell%3CT%3E%3E">PartialEq&lt;RefCell&lt;T&gt;&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a></div></div><p class='location'><a href='../index.html'>std</a>::<wbr><a href='index.html'>cell</a></p><script>window.sidebarCurrent = {name: 'RefCell', 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">
            </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=''>RefCell</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#484-487' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct RefCell&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span> { /* fields omitted */ }</pre><div class='docblock'><p>A mutable memory location with dynamically checked borrow rules</p>
<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'><code>impl&lt;T&gt; <a class="struct" href="../../std/cell/struct.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt;</code><a href='#impl' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#535-650' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>pub const fn <a href='#method.new' class='fnname'>new</a>(value: T) -&gt; <a class="struct" href="../../std/cell/struct.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#547-552' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Creates a new <code>RefCell</code> containing <code>value</code>.</p>
<h1 id="examples" class="section-header"><a href="#examples">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">RefCell</span>;

<span class="kw">let</span> <span class="ident">c</span> <span class="op">=</span> <span class="ident">RefCell</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%3ARefCell%3B%0A%0Alet%20c%20%3D%20RefCell%3A%3Anew(5)%3B%0A%7D">Run</a></pre>
</div><h4 id='method.into_inner' class="method"><span id='into_inner.v' class='invisible'><code>pub fn <a href='#method.into_inner' class='fnname'>into_inner</a>(self) -&gt; T</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#567-573' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Consumes the <code>RefCell</code>, returning the wrapped 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">RefCell</span>;

<span class="kw">let</span> <span class="ident">c</span> <span class="op">=</span> <span class="ident">RefCell</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>();<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%3ARefCell%3B%0A%0Alet%20c%20%3D%20RefCell%3A%3Anew(5)%3B%0A%0Alet%20five%20%3D%20c.into_inner()%3B%0A%7D">Run</a></pre>
</div><h4 id='method.replace' class="method"><span id='replace.v' class='invisible'><code>pub fn <a href='#method.replace' class='fnname'>replace</a>(&amp;self, t: T) -&gt; T</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.24.0'>1.24.0</div><a class='srclink' href='../../src/core/cell.rs.html#595-597' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Replaces the wrapped value with a new one, returning the old value,
without deinitializing either one.</p>
<p>This function corresponds to <a href="../mem/fn.replace.html"><code>std::mem::replace</code></a>.</p>
<h1 id="panics" class="section-header"><a href="#panics">Panics</a></h1>
<p>Panics if the value is currently borrowed.</p>
<h1 id="examples-2" class="section-header"><a href="#examples-2">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">RefCell</span>;
<span class="kw">let</span> <span class="ident">cell</span> <span class="op">=</span> <span class="ident">RefCell</span>::<span class="ident">new</span>(<span class="number">5</span>);
<span class="kw">let</span> <span class="ident">old_value</span> <span class="op">=</span> <span class="ident">cell</span>.<span class="ident">replace</span>(<span class="number">6</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">old_value</span>, <span class="number">5</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cell</span>, <span class="ident">RefCell</span>::<span class="ident">new</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%3ARefCell%3B%0Alet%20cell%20%3D%20RefCell%3A%3Anew(5)%3B%0Alet%20old_value%20%3D%20cell.replace(6)%3B%0Aassert_eq!(old_value%2C%205)%3B%0Aassert_eq!(cell%2C%20RefCell%3A%3Anew(6))%3B%0A%7D">Run</a></pre>
</div><h4 id='method.replace_with' class="method"><span id='replace_with.v' class='invisible'><code>pub fn <a href='#method.replace_with' class='fnname'>replace_with</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>(<a class="primitive" href="../primitive.reference.html">&amp;mut </a>T) -&gt; T,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#620-624' title='goto source code'>[src]</a></span></h4>
<div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API.  (<code>refcell_replace_swap </code><a href="https://github.com/rust-lang/rust/issues/43570">#43570</a>)</div></div><div class='docblock'><p>Replaces the wrapped value with a new one computed from <code>f</code>, returning
the old value, without deinitializing either one.</p>
<p>This function corresponds to <a href="../mem/fn.replace.html"><code>std::mem::replace</code></a>.</p>
<h1 id="panics-1" class="section-header"><a href="#panics-1">Panics</a></h1>
<p>Panics if the value is currently borrowed.</p>
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">refcell_replace_swap</span>)]</span>
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">cell</span>::<span class="ident">RefCell</span>;
<span class="kw">let</span> <span class="ident">cell</span> <span class="op">=</span> <span class="ident">RefCell</span>::<span class="ident">new</span>(<span class="number">5</span>);
<span class="kw">let</span> <span class="ident">old_value</span> <span class="op">=</span> <span class="ident">cell</span>.<span class="ident">replace_with</span>(<span class="op">|</span><span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">old</span><span class="op">|</span> <span class="ident">old</span> <span class="op">+</span> <span class="number">1</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">old_value</span>, <span class="number">5</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cell</span>, <span class="ident">RefCell</span>::<span class="ident">new</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(refcell_replace_swap)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Acell%3A%3ARefCell%3B%0Alet%20cell%20%3D%20RefCell%3A%3Anew(5)%3B%0Alet%20old_value%20%3D%20cell.replace_with(%7C%26mut%20old%7C%20old%20%2B%201)%3B%0Aassert_eq!(old_value%2C%205)%3B%0Aassert_eq!(cell%2C%20RefCell%3A%3Anew(6))%3B%0A%7D&amp;version=nightly">Run</a></pre>
</div><h4 id='method.swap' class="method"><span id='swap.v' class='invisible'><code>pub fn <a href='#method.swap' class='fnname'>swap</a>(&amp;self, other: &amp;<a class="struct" href="../../std/cell/struct.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt;)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.24.0'>1.24.0</div><a class='srclink' href='../../src/core/cell.rs.html#647-649' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Swaps the wrapped value of <code>self</code> with the wrapped value of <code>other</code>,
without deinitializing either one.</p>
<p>This function corresponds to <a href="../mem/fn.swap.html"><code>std::mem::swap</code></a>.</p>
<h1 id="panics-2" class="section-header"><a href="#panics-2">Panics</a></h1>
<p>Panics if the value in either <code>RefCell</code> is currently borrowed.</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">RefCell</span>;
<span class="kw">let</span> <span class="ident">c</span> <span class="op">=</span> <span class="ident">RefCell</span>::<span class="ident">new</span>(<span class="number">5</span>);
<span class="kw">let</span> <span class="ident">d</span> <span class="op">=</span> <span class="ident">RefCell</span>::<span class="ident">new</span>(<span class="number">6</span>);
<span class="ident">c</span>.<span class="ident">swap</span>(<span class="kw-2">&amp;</span><span class="ident">d</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">c</span>, <span class="ident">RefCell</span>::<span class="ident">new</span>(<span class="number">6</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">d</span>, <span class="ident">RefCell</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%3ARefCell%3B%0Alet%20c%20%3D%20RefCell%3A%3Anew(5)%3B%0Alet%20d%20%3D%20RefCell%3A%3Anew(6)%3B%0Ac.swap(%26d)%3B%0Aassert_eq!(c%2C%20RefCell%3A%3Anew(6))%3B%0Aassert_eq!(d%2C%20RefCell%3A%3Anew(5))%3B%0A%7D">Run</a></pre>
</div></div><h3 id='impl-1' class='impl'><span class='in-band'><code>impl&lt;T&gt; <a class="struct" href="../../std/cell/struct.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#652-856' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.borrow' class="method"><span id='borrow.v' class='invisible'><code>pub fn <a href='#method.borrow' class='fnname'>borrow</a>(&amp;self) -&gt; <a class="struct" href="../../std/cell/struct.Ref.html" title="struct std::cell::Ref">Ref</a>&lt;T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#691-693' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Immutably borrows the wrapped value.</p>
<p>The borrow lasts until the returned <code>Ref</code> exits scope. Multiple
immutable borrows can be taken out at the same time.</p>
<h1 id="panics-3" class="section-header"><a href="#panics-3">Panics</a></h1>
<p>Panics if the value is currently mutably borrowed. For a non-panicking variant, use
<a href="#method.try_borrow"><code>try_borrow</code></a>.</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">RefCell</span>;

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

<span class="kw">let</span> <span class="ident">borrowed_five</span> <span class="op">=</span> <span class="ident">c</span>.<span class="ident">borrow</span>();
<span class="kw">let</span> <span class="ident">borrowed_five2</span> <span class="op">=</span> <span class="ident">c</span>.<span class="ident">borrow</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%3ARefCell%3B%0A%0Alet%20c%20%3D%20RefCell%3A%3Anew(5)%3B%0A%0Alet%20borrowed_five%20%3D%20c.borrow()%3B%0Alet%20borrowed_five2%20%3D%20c.borrow()%3B%0A%7D">Run</a></pre>
<p>An example of panic:</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">RefCell</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">thread</span>;

<span class="kw">let</span> <span class="ident">result</span> <span class="op">=</span> <span class="ident">thread</span>::<span class="ident">spawn</span>(<span class="kw">move</span> <span class="op">||</span> {
   <span class="kw">let</span> <span class="ident">c</span> <span class="op">=</span> <span class="ident">RefCell</span>::<span class="ident">new</span>(<span class="number">5</span>);
   <span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">c</span>.<span class="ident">borrow_mut</span>();

   <span class="kw">let</span> <span class="ident">b</span> <span class="op">=</span> <span class="ident">c</span>.<span class="ident">borrow</span>(); <span class="comment">// this causes a panic</span>
}).<span class="ident">join</span>();

<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">result</span>.<span class="ident">is_err</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%3ARefCell%3B%0Ause%20std%3A%3Athread%3B%0A%0Alet%20result%20%3D%20thread%3A%3Aspawn(move%20%7C%7C%20%7B%0A%20%20%20let%20c%20%3D%20RefCell%3A%3Anew(5)%3B%0A%20%20%20let%20m%20%3D%20c.borrow_mut()%3B%0A%0A%20%20%20let%20b%20%3D%20c.borrow()%3B%20%2F%2F%20this%20causes%20a%20panic%0A%7D).join()%3B%0A%0Aassert!(result.is_err())%3B%0A%7D">Run</a></pre>
</div><h4 id='method.try_borrow' class="method"><span id='try_borrow.v' class='invisible'><code>pub fn <a href='#method.try_borrow' class='fnname'>try_borrow</a>(&amp;self) -&gt; <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a>&lt;<a class="struct" href="../../std/cell/struct.Ref.html" title="struct std::cell::Ref">Ref</a>&lt;T&gt;, <a class="struct" href="../../std/cell/struct.BorrowError.html" title="struct std::cell::BorrowError">BorrowError</a>&gt;</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.13.0'>1.13.0</div><a class='srclink' href='../../src/core/cell.rs.html#722-730' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Immutably borrows the wrapped value, returning an error if the value is currently mutably
borrowed.</p>
<p>The borrow lasts until the returned <code>Ref</code> exits scope. Multiple immutable borrows can be
taken out at the same time.</p>
<p>This is the non-panicking variant of <a href="#method.borrow"><code>borrow</code></a>.</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">RefCell</span>;

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

{
    <span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">c</span>.<span class="ident">borrow_mut</span>();
    <span class="macro">assert</span><span class="macro">!</span>(<span class="ident">c</span>.<span class="ident">try_borrow</span>().<span class="ident">is_err</span>());
}

{
    <span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">c</span>.<span class="ident">borrow</span>();
    <span class="macro">assert</span><span class="macro">!</span>(<span class="ident">c</span>.<span class="ident">try_borrow</span>().<span class="ident">is_ok</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%3ARefCell%3B%0A%0Alet%20c%20%3D%20RefCell%3A%3Anew(5)%3B%0A%0A%7B%0A%20%20%20%20let%20m%20%3D%20c.borrow_mut()%3B%0A%20%20%20%20assert!(c.try_borrow().is_err())%3B%0A%7D%0A%0A%7B%0A%20%20%20%20let%20m%20%3D%20c.borrow()%3B%0A%20%20%20%20assert!(c.try_borrow().is_ok())%3B%0A%7D%0A%7D">Run</a></pre>
</div><h4 id='method.borrow_mut' class="method"><span id='borrow_mut.v' class='invisible'><code>pub fn <a href='#method.borrow_mut' class='fnname'>borrow_mut</a>(&amp;self) -&gt; <a class="struct" href="../../std/cell/struct.RefMut.html" title="struct std::cell::RefMut">RefMut</a>&lt;T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#771-773' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Mutably borrows the wrapped value.</p>
<p>The borrow lasts until the returned <code>RefMut</code> exits scope. The value
cannot be borrowed while this borrow is active.</p>
<h1 id="panics-4" class="section-header"><a href="#panics-4">Panics</a></h1>
<p>Panics if the value is currently borrowed. For a non-panicking variant, use
<a href="#method.try_borrow_mut"><code>try_borrow_mut</code></a>.</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">RefCell</span>;

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

<span class="kw-2">*</span><span class="ident">c</span>.<span class="ident">borrow_mut</span>() <span class="op">=</span> <span class="number">7</span>;

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">*</span><span class="ident">c</span>.<span class="ident">borrow</span>(), <span class="number">7</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%3ARefCell%3B%0A%0Alet%20c%20%3D%20RefCell%3A%3Anew(5)%3B%0A%0A*c.borrow_mut()%20%3D%207%3B%0A%0Aassert_eq!(*c.borrow()%2C%207)%3B%0A%7D">Run</a></pre>
<p>An example of panic:</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">RefCell</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">thread</span>;

<span class="kw">let</span> <span class="ident">result</span> <span class="op">=</span> <span class="ident">thread</span>::<span class="ident">spawn</span>(<span class="kw">move</span> <span class="op">||</span> {
   <span class="kw">let</span> <span class="ident">c</span> <span class="op">=</span> <span class="ident">RefCell</span>::<span class="ident">new</span>(<span class="number">5</span>);
   <span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">c</span>.<span class="ident">borrow</span>();

   <span class="kw">let</span> <span class="ident">b</span> <span class="op">=</span> <span class="ident">c</span>.<span class="ident">borrow_mut</span>(); <span class="comment">// this causes a panic</span>
}).<span class="ident">join</span>();

<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">result</span>.<span class="ident">is_err</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%3ARefCell%3B%0Ause%20std%3A%3Athread%3B%0A%0Alet%20result%20%3D%20thread%3A%3Aspawn(move%20%7C%7C%20%7B%0A%20%20%20let%20c%20%3D%20RefCell%3A%3Anew(5)%3B%0A%20%20%20let%20m%20%3D%20c.borrow()%3B%0A%0A%20%20%20let%20b%20%3D%20c.borrow_mut()%3B%20%2F%2F%20this%20causes%20a%20panic%0A%7D).join()%3B%0A%0Aassert!(result.is_err())%3B%0A%7D">Run</a></pre>
</div><h4 id='method.try_borrow_mut' class="method"><span id='try_borrow_mut.v' class='invisible'><code>pub fn <a href='#method.try_borrow_mut' class='fnname'>try_borrow_mut</a>(&amp;self) -&gt; <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a>&lt;<a class="struct" href="../../std/cell/struct.RefMut.html" title="struct std::cell::RefMut">RefMut</a>&lt;T&gt;, <a class="struct" href="../../std/cell/struct.BorrowMutError.html" title="struct std::cell::BorrowMutError">BorrowMutError</a>&gt;</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.13.0'>1.13.0</div><a class='srclink' href='../../src/core/cell.rs.html#798-806' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Mutably borrows the wrapped value, returning an error if the value is currently borrowed.</p>
<p>The borrow lasts until the returned <code>RefMut</code> exits scope. The value cannot be borrowed
while this borrow is active.</p>
<p>This is the non-panicking variant of <a href="#method.borrow_mut"><code>borrow_mut</code></a>.</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">RefCell</span>;

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

{
    <span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">c</span>.<span class="ident">borrow</span>();
    <span class="macro">assert</span><span class="macro">!</span>(<span class="ident">c</span>.<span class="ident">try_borrow_mut</span>().<span class="ident">is_err</span>());
}

<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">c</span>.<span class="ident">try_borrow_mut</span>().<span class="ident">is_ok</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%3ARefCell%3B%0A%0Alet%20c%20%3D%20RefCell%3A%3Anew(5)%3B%0A%0A%7B%0A%20%20%20%20let%20m%20%3D%20c.borrow()%3B%0A%20%20%20%20assert!(c.try_borrow_mut().is_err())%3B%0A%7D%0A%0Aassert!(c.try_borrow_mut().is_ok())%3B%0A%7D">Run</a></pre>
</div><h4 id='method.as_ptr' class="method"><span id='as_ptr.v' class='invisible'><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><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#821-823' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns a raw pointer to the underlying data in this cell.</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">RefCell</span>;

<span class="kw">let</span> <span class="ident">c</span> <span class="op">=</span> <span class="ident">RefCell</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%3ARefCell%3B%0A%0Alet%20c%20%3D%20RefCell%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'><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><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#851-855' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns a mutable reference to the underlying data.</p>
<p>This call borrows <code>RefCell</code> mutably (at compile-time) so there is no
need for dynamic checks.</p>
<p>However be cautious: this method expects <code>self</code> to be mutable, which is
generally not the case when using a <code>RefCell</code>. Take a look at the
<a href="#method.borrow_mut"><code>borrow_mut</code></a> method instead if <code>self</code> isn't mutable.</p>
<p>Also, please be aware that this method is only for special circumstances and is usually
not what you want. In case of doubt, use <a href="#method.borrow_mut"><code>borrow_mut</code></a> instead.</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">RefCell</span>;

<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">c</span> <span class="op">=</span> <span class="ident">RefCell</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">RefCell</span>::<span class="ident">new</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%3ARefCell%3B%0A%0Alet%20mut%20c%20%3D%20RefCell%3A%3Anew(5)%3B%0A*c.get_mut()%20%2B%3D%201%3B%0A%0Aassert_eq!(c%2C%20RefCell%3A%3Anew(6))%3B%0A%7D">Run</a></pre>
</div></div>
            <h2 id='implementations' class='small-section-header'>
              Trait Implementations<a href='#implementations' class='anchor'></a>
            </h2>
        <h3 id='impl-Debug' class='impl'><span class='in-band'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/fmt/trait.Debug.html" title="trait std::fmt::Debug">Debug</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Debug' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/fmt/mod.rs.html#1779-1804' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><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><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/fmt/mod.rs.html#1780-1803' title='goto source code'>[src]</a></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-Sync' class='impl'><span class='in-band'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Sync' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#862' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'></div><h3 id='impl-Send' class='impl'><span class='in-band'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</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> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Send' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#859' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'></div><h3 id='impl-CoerceUnsized%3CRefCell%3CU%3E%3E' class='impl'><span class='in-band'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;U&gt;&gt; for <a class="struct" href="../../std/cell/struct.RefCell.html" title="struct std::cell::RefCell">RefCell</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%3CRefCell%3CU%3E%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#936' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'></div><h3 id='impl-Default' class='impl'><span class='in-band'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</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><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#873-879' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.default' class="method"><span id='default.v' class='invisible'><code>fn <a href='../../std/default/trait.Default.html#tymethod.default' class='fnname'>default</a>() -&gt; <a class="struct" href="../../std/cell/struct.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#876-878' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Creates a <code>RefCell&lt;T&gt;</code>, with the <code>Default</code> value for T.</p>
</div></div><h3 id='impl-Clone' class='impl'><span class='in-band'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/clone/trait.Clone.html" title="trait std::clone::Clone">Clone</a>,&nbsp;</span></code><a href='#impl-Clone' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#865-870' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.clone' class="method"><span id='clone.v' class='invisible'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#867-869' title='goto source code'>[src]</a></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'><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><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/clone.rs.html#112-114' title='goto source code'>[src]</a></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-PartialOrd%3CRefCell%3CT%3E%3E' class='impl'><span class='in-band'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt;&gt; for <a class="struct" href="../../std/cell/struct.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/cmp/trait.PartialOrd.html" title="trait std::cmp::PartialOrd">PartialOrd</a>&lt;T&gt; + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-PartialOrd%3CRefCell%3CT%3E%3E' class='anchor'></a></span><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#893-918' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.partial_cmp' class="method"><span id='partial_cmp.v' class='invisible'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</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><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#895-897' title='goto source code'>[src]</a></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'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt;) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#900-902' title='goto source code'>[src]</a></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'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt;) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#905-907' title='goto source code'>[src]</a></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'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt;) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#910-912' title='goto source code'>[src]</a></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'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt;) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#915-917' title='goto source code'>[src]</a></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-Ord' class='impl'><span class='in-band'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/cmp/trait.Ord.html" title="trait std::cmp::Ord">Ord</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Ord' class='anchor'></a></span><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#921-926' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.cmp' class="method"><span id='cmp.v' class='invisible'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt;) -&gt; <a class="enum" href="../../std/cmp/enum.Ordering.html" title="enum std::cmp::Ordering">Ordering</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#923-925' title='goto source code'>[src]</a></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'><code>fn <a href='../../std/cmp/trait.Ord.html#method.max' class='fnname'>max</a>(self, other: Self) -&gt; Self</code></span><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#460-463' title='goto source code'>[src]</a></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'><code>fn <a href='../../std/cmp/trait.Ord.html#method.min' class='fnname'>min</a>(self, other: Self) -&gt; Self</code></span><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#476-479' title='goto source code'>[src]</a></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-Eq' class='impl'><span class='in-band'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/cmp/trait.Eq.html" title="trait std::cmp::Eq">Eq</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Eq' class='anchor'></a></span><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#890' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'></div><h3 id='impl-PartialEq%3CRefCell%3CT%3E%3E' class='impl'><span class='in-band'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt;&gt; for <a class="struct" href="../../std/cell/struct.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/cmp/trait.PartialEq.html" title="trait std::cmp::PartialEq">PartialEq</a>&lt;T&gt; + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-PartialEq%3CRefCell%3CT%3E%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#882-887' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.eq' class="method"><span id='eq.v' class='invisible'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt;) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#884-886' title='goto source code'>[src]</a></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'><code>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><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cmp.rs.html#121' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
</div></div><h3 id='impl-From%3CT%3E' class='impl'><span class='in-band'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt;</code><a href='#impl-From%3CT%3E' class='anchor'></a></span><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#929-933' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.from' class="method"><span id='from.v' class='invisible'><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.RefCell.html" title="struct std::cell::RefCell">RefCell</a>&lt;T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/core/cell.rs.html#930-932' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Performs the conversion.</p>
</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>
            </div>
        </div>
    </aside>

    

    <script>
        window.rootPath = "../../";
        window.currentCrate = "std";
    </script>
    <script src="../../main.js"></script>
    <script defer src="../../search-index.js"></script>
</body>
</html>