Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-updates > by-pkgid > 564935689ab5527f955e5449ded02799 > files > 748

rust-doc-1.19.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` mod in crate `core`.">
    <meta name="keywords" content="rust, rustlang, rust-lang, cell">

    <title>core::cell - Rust</title>

    <link rel="stylesheet" type="text/css" href="../../normalize.css">
    <link rel="stylesheet" type="text/css" href="../../rustdoc.css">
    <link rel="stylesheet" type="text/css" href="../../main.css">
    

    <link rel="shortcut icon" href="https://doc.rust-lang.org/favicon.ico">
    
</head>
<body class="rustdoc mod">
    <!--[if lte IE 8]>
    <div class="warning">
        This old browser is unsupported and will most likely display funky
        things.
    </div>
    <![endif]-->

    

    <nav class="sidebar">
        <a href='../../core/index.html'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='logo' width='100'></a>
        <p class='location'>Module cell</p><div class="block items"><ul><li><a href="#structs">Structs</a></li></ul></div><p class='location'><a href='../index.html'>core</a></p><script>window.sidebarCurrent = {name: 'cell', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script>
    </nav>

    <nav class="sub">
        <form class="search-form js-only">
            <div class="search-container">
                <input class="search-input" name="search"
                       autocomplete="off"
                       placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
                       type="search">
            </div>
        </form>
    </nav>

    <section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Module <a href='../index.html'>core</a>::<wbr><a class="mod" 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#11-1171' title='goto source code'>[src]</a></span></h1>
<div class='docblock'><p>Shareable mutable containers.</p>

<p>Values of the <code>Cell&lt;T&gt;</code> and <code>RefCell&lt;T&gt;</code> types may be mutated through shared references (i.e.
the common <code>&amp;T</code> type), whereas most Rust types can only be mutated through unique (<code>&amp;mut T</code>)
references. We say that <code>Cell&lt;T&gt;</code> and <code>RefCell&lt;T&gt;</code> provide &#39;interior mutability&#39;, in contrast
with typical Rust types that exhibit &#39;inherited mutability&#39;.</p>

<p>Cell types come in two flavors: <code>Cell&lt;T&gt;</code> and <code>RefCell&lt;T&gt;</code>. <code>Cell&lt;T&gt;</code> implements interior
mutability by moving values in and out of the <code>Cell&lt;T&gt;</code>. To use references instead of values,
one must use the <code>RefCell&lt;T&gt;</code> type, acquiring a write lock before mutating. <code>Cell&lt;T&gt;</code> provides
methods to retrieve and change the current interior value:</p>

<ul>
<li>For types that implement <code>Copy</code>, the <code>get</code> method retrieves the current interior value.</li>
<li>For types that implement <code>Default</code>, the <code>take</code> method replaces the current interior value
with <code>Default::default()</code> and returns the replaced value.</li>
<li>For all types, the <code>replace</code> method replaces the current interior value and returns the
replaced value and the <code>into_inner</code> method consumes the <code>Cell&lt;T&gt;</code> and returns the interior
value. Additionally, the <code>set</code> method replaces the interior value, dropping the replaced
value.</li>
</ul>

<p><code>RefCell&lt;T&gt;</code> uses Rust&#39;s lifetimes to implement &#39;dynamic borrowing&#39;, a process whereby one can
claim temporary, exclusive, mutable access to the inner value. Borrows for <code>RefCell&lt;T&gt;</code>s are
tracked &#39;at runtime&#39;, unlike Rust&#39;s native reference types which are entirely tracked
statically, at compile time. Because <code>RefCell&lt;T&gt;</code> borrows are dynamic it is possible to attempt
to borrow a value that is already mutably borrowed; when this happens it results in thread
panic.</p>

<h1 id='when-to-choose-interior-mutability' class='section-header'><a href='#when-to-choose-interior-mutability'>When to choose interior mutability</a></h1>
<p>The more common inherited mutability, where one must have unique access to mutate a value, is
one of the key language elements that enables Rust to reason strongly about pointer aliasing,
statically preventing crash bugs. Because of that, inherited mutability is preferred, and
interior mutability is something of a last resort. Since cell types enable mutation where it
would otherwise be disallowed though, there are occasions when interior mutability might be
appropriate, or even <em>must</em> be used, e.g.</p>

<ul>
<li>Introducing mutability &#39;inside&#39; of something immutable</li>
<li>Implementation details of logically-immutable methods.</li>
<li>Mutating implementations of <code>Clone</code>.</li>
</ul>

<h2 id='introducing-mutability-inside-of-something-immutable' class='section-header'><a href='#introducing-mutability-inside-of-something-immutable'>Introducing mutability &#39;inside&#39; of something immutable</a></h2>
<p>Many shared smart pointer types, including <code>Rc&lt;T&gt;</code> and <code>Arc&lt;T&gt;</code>, provide containers that can be
cloned and shared between multiple parties. Because the contained values may be
multiply-aliased, they can only be borrowed with <code>&amp;</code>, not <code>&amp;mut</code>. Without cells it would be
impossible to mutate data inside of these smart pointers at all.</p>

<p>It&#39;s very common then to put a <code>RefCell&lt;T&gt;</code> inside shared pointer types to reintroduce
mutability:</p>

<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">HashMap</span>;
<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">rc</span>::<span class="ident">Rc</span>;

<span class="kw">fn</span> <span class="ident">main</span>() {
    <span class="kw">let</span> <span class="ident">shared_map</span>: <span class="ident">Rc</span><span class="op">&lt;</span><span class="ident">RefCell</span><span class="op">&lt;</span>_<span class="op">&gt;&gt;</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">new</span>(<span class="ident">RefCell</span>::<span class="ident">new</span>(<span class="ident">HashMap</span>::<span class="ident">new</span>()));
    <span class="ident">shared_map</span>.<span class="ident">borrow_mut</span>().<span class="ident">insert</span>(<span class="string">&quot;africa&quot;</span>, <span class="number">92388</span>);
    <span class="ident">shared_map</span>.<span class="ident">borrow_mut</span>().<span class="ident">insert</span>(<span class="string">&quot;kyoto&quot;</span>, <span class="number">11837</span>);
    <span class="ident">shared_map</span>.<span class="ident">borrow_mut</span>().<span class="ident">insert</span>(<span class="string">&quot;piccadilly&quot;</span>, <span class="number">11826</span>);
    <span class="ident">shared_map</span>.<span class="ident">borrow_mut</span>().<span class="ident">insert</span>(<span class="string">&quot;marbles&quot;</span>, <span class="number">38</span>);
}<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=use%20std%3A%3Acollections%3A%3AHashMap%3B%0Ause%20std%3A%3Acell%3A%3ARefCell%3B%0Ause%20std%3A%3Arc%3A%3ARc%3B%0A%0Afn%20main()%20%7B%0A%20%20%20%20let%20shared_map%3A%20Rc%3CRefCell%3C_%3E%3E%20%3D%20Rc%3A%3Anew(RefCell%3A%3Anew(HashMap%3A%3Anew()))%3B%0A%20%20%20%20shared_map.borrow_mut().insert(%22africa%22%2C%2092388)%3B%0A%20%20%20%20shared_map.borrow_mut().insert(%22kyoto%22%2C%2011837)%3B%0A%20%20%20%20shared_map.borrow_mut().insert(%22piccadilly%22%2C%2011826)%3B%0A%20%20%20%20shared_map.borrow_mut().insert(%22marbles%22%2C%2038)%3B%0A%7D%0A">Run</a></pre>

<p>Note that this example uses <code>Rc&lt;T&gt;</code> and not <code>Arc&lt;T&gt;</code>. <code>RefCell&lt;T&gt;</code>s are for single-threaded
scenarios. Consider using <code>RwLock&lt;T&gt;</code> or <code>Mutex&lt;T&gt;</code> if you need shared mutability in a
multi-threaded situation.</p>

<h2 id='implementation-details-of-logically-immutable-methods' class='section-header'><a href='#implementation-details-of-logically-immutable-methods'>Implementation details of logically-immutable methods</a></h2>
<p>Occasionally it may be desirable not to expose in an API that there is mutation happening
&quot;under the hood&quot;. This may be because logically the operation is immutable, but e.g. caching
forces the implementation to perform mutation; or because you must employ mutation to implement
a trait method that was originally defined to take <code>&amp;self</code>.</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">struct</span> <span class="ident">Graph</span> {
    <span class="ident">edges</span>: <span class="ident">Vec</span><span class="op">&lt;</span>(<span class="ident">i32</span>, <span class="ident">i32</span>)<span class="op">&gt;</span>,
    <span class="ident">span_tree_cache</span>: <span class="ident">RefCell</span><span class="op">&lt;</span><span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="ident">Vec</span><span class="op">&lt;</span>(<span class="ident">i32</span>, <span class="ident">i32</span>)<span class="op">&gt;&gt;</span><span class="op">&gt;</span>
}

<span class="kw">impl</span> <span class="ident">Graph</span> {
    <span class="kw">fn</span> <span class="ident">minimum_spanning_tree</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) <span class="op">-&gt;</span> <span class="ident">Vec</span><span class="op">&lt;</span>(<span class="ident">i32</span>, <span class="ident">i32</span>)<span class="op">&gt;</span> {
        <span class="comment">// Create a new scope to contain the lifetime of the</span>
        <span class="comment">// dynamic borrow</span>
        {
            <span class="comment">// Take a reference to the inside of cache cell</span>
            <span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cache</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">span_tree_cache</span>.<span class="ident">borrow_mut</span>();
            <span class="kw">if</span> <span class="ident">cache</span>.<span class="ident">is_some</span>() {
                <span class="kw">return</span> <span class="ident">cache</span>.<span class="ident">as_ref</span>().<span class="ident">unwrap</span>().<span class="ident">clone</span>();
            }

            <span class="kw">let</span> <span class="ident">span_tree</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">calc_span_tree</span>();
            <span class="kw-2">*</span><span class="ident">cache</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">span_tree</span>);
        }

        <span class="comment">// Recursive call to return the just-cached value.</span>
        <span class="comment">// Note that if we had not let the previous borrow</span>
        <span class="comment">// of the cache fall out of scope then the subsequent</span>
        <span class="comment">// recursive borrow would cause a dynamic thread panic.</span>
        <span class="comment">// This is the major hazard of using `RefCell`.</span>
        <span class="self">self</span>.<span class="ident">minimum_spanning_tree</span>()
    }
}<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(dead_code)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Acell%3A%3ARefCell%3B%0A%0Astruct%20Graph%20%7B%0A%20%20%20%20edges%3A%20Vec%3C(i32%2C%20i32)%3E%2C%0A%20%20%20%20span_tree_cache%3A%20RefCell%3COption%3CVec%3C(i32%2C%20i32)%3E%3E%3E%0A%7D%0A%0Aimpl%20Graph%20%7B%0A%20%20%20%20fn%20minimum_spanning_tree(%26self)%20-%3E%20Vec%3C(i32%2C%20i32)%3E%20%7B%0A%20%20%20%20%20%20%20%20%2F%2F%20Create%20a%20new%20scope%20to%20contain%20the%20lifetime%20of%20the%0A%20%20%20%20%20%20%20%20%2F%2F%20dynamic%20borrow%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20Take%20a%20reference%20to%20the%20inside%20of%20cache%20cell%0A%20%20%20%20%20%20%20%20%20%20%20%20let%20mut%20cache%20%3D%20self.span_tree_cache.borrow_mut()%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20cache.is_some()%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%20cache.as_ref().unwrap().clone()%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20let%20span_tree%20%3D%20self.calc_span_tree()%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20*cache%20%3D%20Some(span_tree)%3B%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20%2F%2F%20Recursive%20call%20to%20return%20the%20just-cached%20value.%0A%20%20%20%20%20%20%20%20%2F%2F%20Note%20that%20if%20we%20had%20not%20let%20the%20previous%20borrow%0A%20%20%20%20%20%20%20%20%2F%2F%20of%20the%20cache%20fall%20out%20of%20scope%20then%20the%20subsequent%0A%20%20%20%20%20%20%20%20%2F%2F%20recursive%20borrow%20would%20cause%20a%20dynamic%20thread%20panic.%0A%20%20%20%20%20%20%20%20%2F%2F%20This%20is%20the%20major%20hazard%20of%20using%20%60RefCell%60.%0A%20%20%20%20%20%20%20%20self.minimum_spanning_tree()%0A%20%20%20%20%7D%0A%20%20fn%20calc_span_tree(%26self)%20-%3E%20Vec%3C(i32%2C%20i32)%3E%20%7B%20vec!%5B%5D%20%7D%0A%7D%0A%7D">Run</a></pre>

<h2 id='mutating-implementations-of-clone' class='section-header'><a href='#mutating-implementations-of-clone'>Mutating implementations of <code>Clone</code></a></h2>
<p>This is simply a special - but common - case of the previous: hiding mutability for operations
that appear to be immutable. The <code>clone</code> method is expected to not change the source value, and
is declared to take <code>&amp;self</code>, not <code>&amp;mut self</code>. Therefore any mutation that happens in the
<code>clone</code> method must use cell types. For example, <code>Rc&lt;T&gt;</code> maintains its reference counts within a
<code>Cell&lt;T&gt;</code>.</p>

<pre class="rust rust-example-rendered">
<span class="attribute">#<span class="op">!</span>[<span class="ident">feature</span>(<span class="ident">core_intrinsics</span>)]</span>
<span class="attribute">#<span class="op">!</span>[<span class="ident">feature</span>(<span class="ident">shared</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">use</span> <span class="ident">std</span>::<span class="ident">ptr</span>::<span class="ident">Shared</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">intrinsics</span>::<span class="ident">abort</span>;

<span class="kw">struct</span> <span class="ident">Rc</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="question-mark">?</span><span class="ident">Sized</span><span class="op">&gt;</span> {
    <span class="ident">ptr</span>: <span class="ident">Shared</span><span class="op">&lt;</span><span class="ident">RcBox</span><span class="op">&lt;</span><span class="ident">T</span><span class="op">&gt;&gt;</span>
}

<span class="kw">struct</span> <span class="ident">RcBox</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="question-mark">?</span><span class="ident">Sized</span><span class="op">&gt;</span> {
    <span class="ident">strong</span>: <span class="ident">Cell</span><span class="op">&lt;</span><span class="ident">usize</span><span class="op">&gt;</span>,
    <span class="ident">refcount</span>: <span class="ident">Cell</span><span class="op">&lt;</span><span class="ident">usize</span><span class="op">&gt;</span>,
    <span class="ident">value</span>: <span class="ident">T</span>,
}

<span class="kw">impl</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="question-mark">?</span><span class="ident">Sized</span><span class="op">&gt;</span> <span class="ident">Clone</span> <span class="kw">for</span> <span class="ident">Rc</span><span class="op">&lt;</span><span class="ident">T</span><span class="op">&gt;</span> {
    <span class="kw">fn</span> <span class="ident">clone</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) <span class="op">-&gt;</span> <span class="ident">Rc</span><span class="op">&lt;</span><span class="ident">T</span><span class="op">&gt;</span> {
        <span class="self">self</span>.<span class="ident">inc_strong</span>();
        <span class="ident">Rc</span> { <span class="ident">ptr</span>: <span class="self">self</span>.<span class="ident">ptr</span> }
    }
}

<span class="kw">trait</span> <span class="ident">RcBoxPtr</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="question-mark">?</span><span class="ident">Sized</span><span class="op">&gt;</span> {

    <span class="kw">fn</span> <span class="ident">inner</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) <span class="op">-&gt;</span> <span class="kw-2">&amp;</span><span class="ident">RcBox</span><span class="op">&lt;</span><span class="ident">T</span><span class="op">&gt;</span>;

    <span class="kw">fn</span> <span class="ident">strong</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) <span class="op">-&gt;</span> <span class="ident">usize</span> {
        <span class="self">self</span>.<span class="ident">inner</span>().<span class="ident">strong</span>.<span class="ident">get</span>()
    }

    <span class="kw">fn</span> <span class="ident">inc_strong</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) {
        <span class="self">self</span>.<span class="ident">inner</span>()
            .<span class="ident">strong</span>
            .<span class="ident">set</span>(<span class="self">self</span>.<span class="ident">strong</span>()
                     .<span class="ident">checked_add</span>(<span class="number">1</span>)
                     .<span class="ident">unwrap_or_else</span>(<span class="op">||</span> <span class="kw">unsafe</span> { <span class="ident">abort</span>() }));
    }
}

<span class="kw">impl</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="question-mark">?</span><span class="ident">Sized</span><span class="op">&gt;</span> <span class="ident">RcBoxPtr</span><span class="op">&lt;</span><span class="ident">T</span><span class="op">&gt;</span> <span class="kw">for</span> <span class="ident">Rc</span><span class="op">&lt;</span><span class="ident">T</span><span class="op">&gt;</span> {
   <span class="kw">fn</span> <span class="ident">inner</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) <span class="op">-&gt;</span> <span class="kw-2">&amp;</span><span class="ident">RcBox</span><span class="op">&lt;</span><span class="ident">T</span><span class="op">&gt;</span> {
       <span class="kw">unsafe</span> {
           <span class="self">self</span>.<span class="ident">ptr</span>.<span class="ident">as_ref</span>()
       }
   }
}<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Bfeature(core_intrinsics)%5D%0A%23!%5Bfeature(shared)%5D%0Aextern%20crate%20core%3B%0Afn%20main()%20%7B%0Ause%20std%3A%3Acell%3A%3ACell%3B%0Ause%20std%3A%3Aptr%3A%3AShared%3B%0Ause%20std%3A%3Aintrinsics%3A%3Aabort%3B%0A%0Astruct%20Rc%3CT%3A%20%3FSized%3E%20%7B%0A%20%20%20%20ptr%3A%20Shared%3CRcBox%3CT%3E%3E%0A%7D%0A%0Astruct%20RcBox%3CT%3A%20%3FSized%3E%20%7B%0A%20%20%20%20strong%3A%20Cell%3Cusize%3E%2C%0A%20%20%20%20refcount%3A%20Cell%3Cusize%3E%2C%0A%20%20%20%20value%3A%20T%2C%0A%7D%0A%0Aimpl%3CT%3A%20%3FSized%3E%20Clone%20for%20Rc%3CT%3E%20%7B%0A%20%20%20%20fn%20clone(%26self)%20-%3E%20Rc%3CT%3E%20%7B%0A%20%20%20%20%20%20%20%20self.inc_strong()%3B%0A%20%20%20%20%20%20%20%20Rc%20%7B%20ptr%3A%20self.ptr%20%7D%0A%20%20%20%20%7D%0A%7D%0A%0Atrait%20RcBoxPtr%3CT%3A%20%3FSized%3E%20%7B%0A%0A%20%20%20%20fn%20inner(%26self)%20-%3E%20%26RcBox%3CT%3E%3B%0A%0A%20%20%20%20fn%20strong(%26self)%20-%3E%20usize%20%7B%0A%20%20%20%20%20%20%20%20self.inner().strong.get()%0A%20%20%20%20%7D%0A%0A%20%20%20%20fn%20inc_strong(%26self)%20%7B%0A%20%20%20%20%20%20%20%20self.inner()%0A%20%20%20%20%20%20%20%20%20%20%20%20.strong%0A%20%20%20%20%20%20%20%20%20%20%20%20.set(self.strong()%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20.checked_add(1)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20.unwrap_or_else(%7C%7C%20unsafe%20%7B%20abort()%20%7D))%3B%0A%20%20%20%20%7D%0A%7D%0A%0Aimpl%3CT%3A%20%3FSized%3E%20RcBoxPtr%3CT%3E%20for%20Rc%3CT%3E%20%7B%0A%20%20%20fn%20inner(%26self)%20-%3E%20%26RcBox%3CT%3E%20%7B%0A%20%20%20%20%20%20%20unsafe%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20self.ptr.as_ref()%0A%20%20%20%20%20%20%20%7D%0A%20%20%20%7D%0A%7D%0A%7D&amp;version=nightly">Run</a></pre>
</div><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table>
                       <tr class=' module-item'>
                           <td><a class="struct" href="struct.BorrowError.html"
                                  title='struct core::cell::BorrowError'>BorrowError</a></td>
                           <td class='docblock-short'>
                                <p>An error returned by <a href="struct.RefCell.html#method.try_borrow"><code>RefCell::try_borrow</code></a>.</p>
                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="struct" href="struct.BorrowMutError.html"
                                  title='struct core::cell::BorrowMutError'>BorrowMutError</a></td>
                           <td class='docblock-short'>
                                <p>An error returned by <a href="struct.RefCell.html#method.try_borrow_mut"><code>RefCell::try_borrow_mut</code></a>.</p>
                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="struct" href="struct.Cell.html"
                                  title='struct core::cell::Cell'>Cell</a></td>
                           <td class='docblock-short'>
                                <p>A mutable memory location.</p>
                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="struct" href="struct.Ref.html"
                                  title='struct core::cell::Ref'>Ref</a></td>
                           <td class='docblock-short'>
                                <p>Wraps a borrowed reference to a value in a <code>RefCell</code> box.
A wrapper type for an immutably borrowed value from a <code>RefCell&lt;T&gt;</code>.</p>
                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="struct" href="struct.RefCell.html"
                                  title='struct core::cell::RefCell'>RefCell</a></td>
                           <td class='docblock-short'>
                                <p>A mutable memory location with dynamically checked borrow rules</p>
                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="struct" href="struct.RefMut.html"
                                  title='struct core::cell::RefMut'>RefMut</a></td>
                           <td class='docblock-short'>
                                <p>A wrapper type for a mutably borrowed value from a <code>RefCell&lt;T&gt;</code>.</p>
                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="struct" href="struct.UnsafeCell.html"
                                  title='struct core::cell::UnsafeCell'>UnsafeCell</a></td>
                           <td class='docblock-short'>
                                <p>The core primitive for interior mutability in Rust.</p>
                           </td>
                       </tr></table></section>
    <section id='search' class="content hidden"></section>

    <section class="footer"></section>

    <aside id="help" class="hidden">
        <div>
            <h1 class="hidden">Help</h1>

            <div class="shortcuts">
                <h2>Keyboard Shortcuts</h2>

                <dl>
                    <dt>?</dt>
                    <dd>Show this help dialog</dd>
                    <dt>S</dt>
                    <dd>Focus the search field</dd>
                    <dt>&larrb;</dt>
                    <dd>Move up in search results</dd>
                    <dt>&rarrb;</dt>
                    <dd>Move down in search results</dd>
                    <dt>&#9166;</dt>
                    <dd>Go to active search result</dd>
                    <dt>+</dt>
                    <dd>Collapse/expand 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 = "core";
    </script>
    <script src="../../main.js"></script>
    <script defer src="../../search-index.js"></script>
</body>
</html>