Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-updates > by-pkgid > 4e2dbb669434a7691662cb2f0ad38972 > files > 14299

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 `Rc` struct in crate `std`."><meta name="keywords" content="rust, rustlang, rust-lang, Rc"><title>std::rc::Rc - 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 Rc</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.try_unwrap">try_unwrap</a><a href="#method.into_raw">into_raw</a><a href="#method.from_raw">from_raw</a><a href="#method.downgrade">downgrade</a><a href="#method.weak_count">weak_count</a><a href="#method.strong_count">strong_count</a><a href="#method.get_mut">get_mut</a><a href="#method.ptr_eq">ptr_eq</a><a href="#method.make_mut">make_mut</a><a href="#method.downcast">downcast</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-From%3C%26%27a%20%5BT%5D%3E">From&lt;&amp;&#39;a [T]&gt;</a><a href="#impl-From%3CBox%3CT%3E%3E">From&lt;Box&lt;T&gt;&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-From%3CString%3E">From&lt;String&gt;</a><a href="#impl-From%3CVec%3CT%3E%3E">From&lt;Vec&lt;T&gt;&gt;</a><a href="#impl-From%3C%26%27a%20str%3E">From&lt;&amp;&#39;a str&gt;</a><a href="#impl-Display">Display</a><a href="#impl-PartialOrd%3CRc%3CT%3E%3E">PartialOrd&lt;Rc&lt;T&gt;&gt;</a><a href="#impl-Ord">Ord</a><a href="#impl-Send">!Send</a><a href="#impl-Default">Default</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-Deref">Deref</a><a href="#impl-Debug">Debug</a><a href="#impl-Clone">Clone</a><a href="#impl-Hash">Hash</a><a href="#impl-Drop">Drop</a><a href="#impl-Sync">!Sync</a><a href="#impl-Eq">Eq</a><a href="#impl-CoerceUnsized%3CRc%3CU%3E%3E">CoerceUnsized&lt;Rc&lt;U&gt;&gt;</a><a href="#impl-PartialEq%3CRc%3CT%3E%3E">PartialEq&lt;Rc&lt;T&gt;&gt;</a><a href="#impl-Pointer">Pointer</a><a href="#impl-AsRef%3CT%3E">AsRef&lt;T&gt;</a><a href="#impl-From%3CCString%3E">From&lt;CString&gt;</a><a href="#impl-From%3C%26%27a%20CStr%3E">From&lt;&amp;&#39;a CStr&gt;</a><a href="#impl-From%3COsString%3E">From&lt;OsString&gt;</a><a href="#impl-From%3C%26%27a%20OsStr%3E">From&lt;&amp;&#39;a OsStr&gt;</a><a href="#impl-UnwindSafe">UnwindSafe</a><a href="#impl-From%3CPathBuf%3E">From&lt;PathBuf&gt;</a><a href="#impl-From%3C%26%27a%20Path%3E">From&lt;&amp;&#39;a Path&gt;</a></div></div><p class='location'><a href='../index.html'>std</a>::<wbr><a href='index.html'>rc</a></p><script>window.sidebarCurrent = {name: 'Rc', 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'>rc</a>::<wbr><a class="struct" href=''>Rc</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/alloc/rc.rs.html#284-287' title='goto source code'>[src]</a></span></h1><div class="docblock type-decl"><pre class='rust struct'>pub struct Rc&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><div class='docblock'><p>A single-threaded reference-counting pointer. 'Rc' stands for 'Reference
Counted'.</p>
<p>See the <a href="./index.html">module-level documentation</a> for more details.</p>
<p>The inherent methods of <code>Rc</code> are all associated functions, which means
that you have to call them as e.g. <a href="#method.get_mut"><code>Rc::get_mut(&amp;mut value)</code></a> instead of
<code>value.get_mut()</code>. This avoids conflicts with methods of the inner
type <code>T</code>.</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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;</code><a href='#impl' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#297-364' 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 fn <a href='#method.new' class='fnname'>new</a>(value: T) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#308-321' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Constructs a new <code>Rc&lt;T&gt;</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">rc</span>::<span class="ident">Rc</span>;

<span class="kw">let</span> <span class="ident">five</span> <span class="op">=</span> <span class="ident">Rc</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%3Arc%3A%3ARc%3B%0A%0Alet%20five%20%3D%20Rc%3A%3Anew(5)%3B%0A%7D">Run</a></pre>
</div><h4 id='method.try_unwrap' class="method"><span id='try_unwrap.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.try_unwrap' class='fnname'>try_unwrap</a>(this: <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;) -&gt; <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a>&lt;T, <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.4.0'>1.4.0</div><a class='srclink' href='../../src/alloc/rc.rs.html#346-363' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Returns the contained value, if the <code>Rc</code> has exactly one strong reference.</p>
<p>Otherwise, an <a href="../../std/result/enum.Result.html"><code>Err</code></a> is returned with the same <code>Rc</code> that was
passed in.</p>
<p>This will succeed even if there are outstanding weak references.</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">rc</span>::<span class="ident">Rc</span>;

<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">new</span>(<span class="number">3</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Rc</span>::<span class="ident">try_unwrap</span>(<span class="ident">x</span>), <span class="prelude-val">Ok</span>(<span class="number">3</span>));

<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">new</span>(<span class="number">4</span>);
<span class="kw">let</span> <span class="ident">_y</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">clone</span>(<span class="kw-2">&amp;</span><span class="ident">x</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">*</span><span class="ident">Rc</span>::<span class="ident">try_unwrap</span>(<span class="ident">x</span>).<span class="ident">unwrap_err</span>(), <span class="number">4</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%3Arc%3A%3ARc%3B%0A%0Alet%20x%20%3D%20Rc%3A%3Anew(3)%3B%0Aassert_eq!(Rc%3A%3Atry_unwrap(x)%2C%20Ok(3))%3B%0A%0Alet%20x%20%3D%20Rc%3A%3Anew(4)%3B%0Alet%20_y%20%3D%20Rc%3A%3Aclone(%26x)%3B%0Aassert_eq!(*Rc%3A%3Atry_unwrap(x).unwrap_err()%2C%204)%3B%0A%7D">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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#366-560' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.into_raw' class="method"><span id='into_raw.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.into_raw' class='fnname'>into_raw</a>(this: <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;) -&gt; <a class="primitive" href="../primitive.pointer.html">*const T</a></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/alloc/rc.rs.html#384-388' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Consumes the <code>Rc</code>, returning the wrapped pointer.</p>
<p>To avoid a memory leak the pointer must be converted back to an <code>Rc</code> using
<a href="struct.Rc.html#method.from_raw"><code>Rc::from_raw</code></a>.</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">rc</span>::<span class="ident">Rc</span>;

<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">new</span>(<span class="number">10</span>);
<span class="kw">let</span> <span class="ident">x_ptr</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">into_raw</span>(<span class="ident">x</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw">unsafe</span> { <span class="kw-2">*</span><span class="ident">x_ptr</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%3Arc%3A%3ARc%3B%0A%0Alet%20x%20%3D%20Rc%3A%3Anew(10)%3B%0Alet%20x_ptr%20%3D%20Rc%3A%3Ainto_raw(x)%3B%0Aassert_eq!(unsafe%20%7B%20*x_ptr%20%7D%2C%2010)%3B%0A%7D">Run</a></pre>
</div><h4 id='method.from_raw' class="method"><span id='from_raw.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub unsafe fn <a href='#method.from_raw' class='fnname'>from_raw</a>(ptr: <a class="primitive" href="../primitive.pointer.html">*const T</a>) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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/alloc/rc.rs.html#419-434' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Constructs an <code>Rc</code> from a raw pointer.</p>
<p>The raw pointer must have been previously returned by a call to a
<a href="struct.Rc.html#method.into_raw"><code>Rc::into_raw</code></a>.</p>
<p>This function is unsafe because improper use may lead to memory problems. For example, a
double-free may occur if the function is called twice on the same raw pointer.</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">rc</span>::<span class="ident">Rc</span>;

<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">new</span>(<span class="number">10</span>);
<span class="kw">let</span> <span class="ident">x_ptr</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">into_raw</span>(<span class="ident">x</span>);

<span class="kw">unsafe</span> {
    <span class="comment">// Convert back to an `Rc` to prevent leak.</span>
    <span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">from_raw</span>(<span class="ident">x_ptr</span>);
    <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">*</span><span class="ident">x</span>, <span class="number">10</span>);

    <span class="comment">// Further calls to `Rc::from_raw(x_ptr)` would be memory unsafe.</span>
}

<span class="comment">// The memory was freed when `x` went out of scope above, so `x_ptr` is now dangling!</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%3Arc%3A%3ARc%3B%0A%0Alet%20x%20%3D%20Rc%3A%3Anew(10)%3B%0Alet%20x_ptr%20%3D%20Rc%3A%3Ainto_raw(x)%3B%0A%0Aunsafe%20%7B%0A%20%20%20%20%2F%2F%20Convert%20back%20to%20an%20%60Rc%60%20to%20prevent%20leak.%0A%20%20%20%20let%20x%20%3D%20Rc%3A%3Afrom_raw(x_ptr)%3B%0A%20%20%20%20assert_eq!(*x%2C%2010)%3B%0A%0A%20%20%20%20%2F%2F%20Further%20calls%20to%20%60Rc%3A%3Afrom_raw(x_ptr)%60%20would%20be%20memory%20unsafe.%0A%7D%0A%0A%2F%2F%20The%20memory%20was%20freed%20when%20%60x%60%20went%20out%20of%20scope%20above%2C%20so%20%60x_ptr%60%20is%20now%20dangling!%0A%7D">Run</a></pre>
</div><h4 id='method.downgrade' class="method"><span id='downgrade.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.downgrade' class='fnname'>downgrade</a>(this: &amp;<a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;) -&gt; <a class="struct" href="../../std/rc/struct.Weak.html" title="struct std::rc::Weak">Weak</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.4.0'>1.4.0</div><a class='srclink' href='../../src/alloc/rc.rs.html#450-453' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Creates a new <a href="struct.Weak.html"><code>Weak</code></a> pointer to this value.</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">rc</span>::<span class="ident">Rc</span>;

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

<span class="kw">let</span> <span class="ident">weak_five</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">downgrade</span>(<span class="kw-2">&amp;</span><span class="ident">five</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%3Arc%3A%3ARc%3B%0A%0Alet%20five%20%3D%20Rc%3A%3Anew(5)%3B%0A%0Alet%20weak_five%20%3D%20Rc%3A%3Adowngrade(%26five)%3B%0A%7D">Run</a></pre>
</div><h4 id='method.weak_count' class="method"><span id='weak_count.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.weak_count' class='fnname'>weak_count</a>(this: &amp;<a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;) -&gt; <a class="primitive" href="../primitive.usize.html">usize</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.15.0'>1.15.0</div><a class='srclink' href='../../src/alloc/rc.rs.html#471-473' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Gets the number of <a href="struct.Weak.html"><code>Weak</code></a> pointers to this value.</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">rc</span>::<span class="ident">Rc</span>;

<span class="kw">let</span> <span class="ident">five</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">new</span>(<span class="number">5</span>);
<span class="kw">let</span> <span class="ident">_weak_five</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">downgrade</span>(<span class="kw-2">&amp;</span><span class="ident">five</span>);

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">1</span>, <span class="ident">Rc</span>::<span class="ident">weak_count</span>(<span class="kw-2">&amp;</span><span class="ident">five</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%3Arc%3A%3ARc%3B%0A%0Alet%20five%20%3D%20Rc%3A%3Anew(5)%3B%0Alet%20_weak_five%20%3D%20Rc%3A%3Adowngrade(%26five)%3B%0A%0Aassert_eq!(1%2C%20Rc%3A%3Aweak_count(%26five))%3B%0A%7D">Run</a></pre>
</div><h4 id='method.strong_count' class="method"><span id='strong_count.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.strong_count' class='fnname'>strong_count</a>(this: &amp;<a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;) -&gt; <a class="primitive" href="../primitive.usize.html">usize</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.15.0'>1.15.0</div><a class='srclink' href='../../src/alloc/rc.rs.html#489-491' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Gets the number of strong (<code>Rc</code>) pointers to this 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">rc</span>::<span class="ident">Rc</span>;

<span class="kw">let</span> <span class="ident">five</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">new</span>(<span class="number">5</span>);
<span class="kw">let</span> <span class="ident">_also_five</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">clone</span>(<span class="kw-2">&amp;</span><span class="ident">five</span>);

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">2</span>, <span class="ident">Rc</span>::<span class="ident">strong_count</span>(<span class="kw-2">&amp;</span><span class="ident">five</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%3Arc%3A%3ARc%3B%0A%0Alet%20five%20%3D%20Rc%3A%3Anew(5)%3B%0Alet%20_also_five%20%3D%20Rc%3A%3Aclone(%26five)%3B%0A%0Aassert_eq!(2%2C%20Rc%3A%3Astrong_count(%26five))%3B%0A%7D">Run</a></pre>
</div><h4 id='method.get_mut' class="method"><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>(this: &amp;mut <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;) -&gt; <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;<a class="primitive" href="../primitive.reference.html">&amp;mut </a>T&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.4.0'>1.4.0</div><a class='srclink' href='../../src/alloc/rc.rs.html#530-538' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Returns a mutable reference to the inner value, if there are
no other <code>Rc</code> or <a href="struct.Weak.html"><code>Weak</code></a> pointers to the same value.</p>
<p>Returns <a href="../../std/option/enum.Option.html#variant.None"><code>None</code></a> otherwise, because it is not safe to
mutate a shared value.</p>
<p>See also <a href="struct.Rc.html#method.make_mut"><code>make_mut</code></a>, which will <a href="../../std/clone/trait.Clone.html#tymethod.clone"><code>clone</code></a>
the inner value when it's shared.</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">rc</span>::<span class="ident">Rc</span>;

<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">x</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">new</span>(<span class="number">3</span>);
<span class="kw-2">*</span><span class="ident">Rc</span>::<span class="ident">get_mut</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">x</span>).<span class="ident">unwrap</span>() <span class="op">=</span> <span class="number">4</span>;
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">*</span><span class="ident">x</span>, <span class="number">4</span>);

<span class="kw">let</span> <span class="ident">_y</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">clone</span>(<span class="kw-2">&amp;</span><span class="ident">x</span>);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">Rc</span>::<span class="ident">get_mut</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">x</span>).<span class="ident">is_none</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%3Arc%3A%3ARc%3B%0A%0Alet%20mut%20x%20%3D%20Rc%3A%3Anew(3)%3B%0A*Rc%3A%3Aget_mut(%26mut%20x).unwrap()%20%3D%204%3B%0Aassert_eq!(*x%2C%204)%3B%0A%0Alet%20_y%20%3D%20Rc%3A%3Aclone(%26x)%3B%0Aassert!(Rc%3A%3Aget_mut(%26mut%20x).is_none())%3B%0A%7D">Run</a></pre>
</div><h4 id='method.ptr_eq' class="method"><span id='ptr_eq.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.ptr_eq' class='fnname'>ptr_eq</a>(this: &amp;<a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;, other: &amp;<a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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><div class='since' title='Stable since Rust version 1.17.0'>1.17.0</div><a class='srclink' href='../../src/alloc/rc.rs.html#557-559' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Returns true if the two <code>Rc</code>s point to the same value (not
just values that compare as equal).</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">rc</span>::<span class="ident">Rc</span>;

<span class="kw">let</span> <span class="ident">five</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">new</span>(<span class="number">5</span>);
<span class="kw">let</span> <span class="ident">same_five</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">clone</span>(<span class="kw-2">&amp;</span><span class="ident">five</span>);
<span class="kw">let</span> <span class="ident">other_five</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">new</span>(<span class="number">5</span>);

<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">Rc</span>::<span class="ident">ptr_eq</span>(<span class="kw-2">&amp;</span><span class="ident">five</span>, <span class="kw-2">&amp;</span><span class="ident">same_five</span>));
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">Rc</span>::<span class="ident">ptr_eq</span>(<span class="kw-2">&amp;</span><span class="ident">five</span>, <span class="kw-2">&amp;</span><span class="ident">other_five</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%3Arc%3A%3ARc%3B%0A%0Alet%20five%20%3D%20Rc%3A%3Anew(5)%3B%0Alet%20same_five%20%3D%20Rc%3A%3Aclone(%26five)%3B%0Alet%20other_five%20%3D%20Rc%3A%3Anew(5)%3B%0A%0Aassert!(Rc%3A%3Aptr_eq(%26five%2C%20%26same_five))%3B%0Aassert!(!Rc%3A%3Aptr_eq(%26five%2C%20%26other_five))%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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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-2' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#562-619' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.make_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='make_mut.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.make_mut' class='fnname'>make_mut</a>(this: &amp;mut <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;) -&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.4.0'>1.4.0</div><a class='srclink' href='../../src/alloc/rc.rs.html#594-618' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Makes a mutable reference into the given <code>Rc</code>.</p>
<p>If there are other <code>Rc</code> or <a href="struct.Weak.html"><code>Weak</code></a> pointers to the same value,
then <code>make_mut</code> will invoke <a href="../../std/clone/trait.Clone.html#tymethod.clone"><code>clone</code></a> on the inner value to
ensure unique ownership. This is also referred to as clone-on-write.</p>
<p>See also <a href="struct.Rc.html#method.get_mut"><code>get_mut</code></a>, which will fail rather than cloning.</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">rc</span>::<span class="ident">Rc</span>;

<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">data</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">new</span>(<span class="number">5</span>);

<span class="kw-2">*</span><span class="ident">Rc</span>::<span class="ident">make_mut</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">data</span>) <span class="op">+=</span> <span class="number">1</span>;        <span class="comment">// Won&#39;t clone anything</span>
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">other_data</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">clone</span>(<span class="kw-2">&amp;</span><span class="ident">data</span>);    <span class="comment">// Won&#39;t clone inner data</span>
<span class="kw-2">*</span><span class="ident">Rc</span>::<span class="ident">make_mut</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">data</span>) <span class="op">+=</span> <span class="number">1</span>;        <span class="comment">// Clones inner data</span>
<span class="kw-2">*</span><span class="ident">Rc</span>::<span class="ident">make_mut</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">data</span>) <span class="op">+=</span> <span class="number">1</span>;        <span class="comment">// Won&#39;t clone anything</span>
<span class="kw-2">*</span><span class="ident">Rc</span>::<span class="ident">make_mut</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">other_data</span>) <span class="op">*=</span> <span class="number">2</span>;  <span class="comment">// Won&#39;t clone anything</span>

<span class="comment">// Now `data` and `other_data` point to different values.</span>
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">*</span><span class="ident">data</span>, <span class="number">8</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">*</span><span class="ident">other_data</span>, <span class="number">12</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%3Arc%3A%3ARc%3B%0A%0Alet%20mut%20data%20%3D%20Rc%3A%3Anew(5)%3B%0A%0A*Rc%3A%3Amake_mut(%26mut%20data)%20%2B%3D%201%3B%20%20%20%20%20%20%20%20%2F%2F%20Won't%20clone%20anything%0Alet%20mut%20other_data%20%3D%20Rc%3A%3Aclone(%26data)%3B%20%20%20%20%2F%2F%20Won't%20clone%20inner%20data%0A*Rc%3A%3Amake_mut(%26mut%20data)%20%2B%3D%201%3B%20%20%20%20%20%20%20%20%2F%2F%20Clones%20inner%20data%0A*Rc%3A%3Amake_mut(%26mut%20data)%20%2B%3D%201%3B%20%20%20%20%20%20%20%20%2F%2F%20Won't%20clone%20anything%0A*Rc%3A%3Amake_mut(%26mut%20other_data)%20*%3D%202%3B%20%20%2F%2F%20Won't%20clone%20anything%0A%0A%2F%2F%20Now%20%60data%60%20and%20%60other_data%60%20point%20to%20different%20values.%0Aassert_eq!(*data%2C%208)%3B%0Aassert_eq!(*other_data%2C%2012)%3B%0A%7D">Run</a></pre>
</div></div><h3 id='impl-3' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="trait" href="../../std/any/trait.Any.html" title="trait std::any::Any">Any</a> + 'static&gt;</code><a href='#impl-3' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#621-654' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.downcast' class="method"><span id='downcast.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.downcast' class='fnname'>downcast</a>&lt;T&gt;(self) -&gt; <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a>&lt;<a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;, <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="trait" href="../../std/any/trait.Any.html" title="trait std::any::Any">Any</a> + 'static&gt;&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/any/trait.Any.html" title="trait std::any::Any">Any</a>,&nbsp;</span></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#645-653' 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>rc_downcast </code><a href="https://github.com/rust-lang/rust/issues/44608">#44608</a>)</div></div><div class='docblock'><p>Attempt to downcast the <code>Rc&lt;Any&gt;</code> to a concrete type.</p>
<h1 id="examples-10" class="section-header"><a href="#examples-10">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">rc_downcast</span>)]</span>
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">any</span>::<span class="ident">Any</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">print_if_string</span>(<span class="ident">value</span>: <span class="ident">Rc</span><span class="op">&lt;</span><span class="ident">Any</span><span class="op">&gt;</span>) {
    <span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Ok</span>(<span class="ident">string</span>) <span class="op">=</span> <span class="ident">value</span>.<span class="ident">downcast</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>() {
        <span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;String ({}): {}&quot;</span>, <span class="ident">string</span>.<span class="ident">len</span>(), <span class="ident">string</span>);
    }
}

<span class="kw">fn</span> <span class="ident">main</span>() {
    <span class="kw">let</span> <span class="ident">my_string</span> <span class="op">=</span> <span class="string">&quot;Hello World&quot;</span>.<span class="ident">to_string</span>();
    <span class="ident">print_if_string</span>(<span class="ident">Rc</span>::<span class="ident">new</span>(<span class="ident">my_string</span>));
    <span class="ident">print_if_string</span>(<span class="ident">Rc</span>::<span class="ident">new</span>(<span class="number">0i8</span>));
}<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0A%23!%5Bfeature(rc_downcast)%5D%0Ause%20std%3A%3Aany%3A%3AAny%3B%0Ause%20std%3A%3Arc%3A%3ARc%3B%0A%0Afn%20print_if_string(value%3A%20Rc%3CAny%3E)%20%7B%0A%20%20%20%20if%20let%20Ok(string)%20%3D%20value.downcast%3A%3A%3CString%3E()%20%7B%0A%20%20%20%20%20%20%20%20println!(%22String%20(%7B%7D)%3A%20%7B%7D%22%2C%20string.len()%2C%20string)%3B%0A%20%20%20%20%7D%0A%7D%0A%0Afn%20main()%20%7B%0A%20%20%20%20let%20my_string%20%3D%20%22Hello%20World%22.to_string()%3B%0A%20%20%20%20print_if_string(Rc%3A%3Anew(my_string))%3B%0A%20%20%20%20print_if_string(Rc%3A%3Anew(0i8))%3B%0A%7D&amp;version=nightly">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-From%3C%26%27a%20%5BT%5D%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;'a, T&gt; <a class="trait" href="../../std/convert/trait.From.html" title="trait std::convert::From">From</a>&lt;<a class="primitive" href="../primitive.slice.html">&amp;'a [T]</a>&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&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-From%3C%26%27a%20%5BT%5D%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.21.0'>1.21.0</div><a class='srclink' href='../../src/alloc/rc.rs.html#1084-1089' 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>(v: <a class="primitive" href="../primitive.slice.html">&amp;[T]</a>) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#1086-1088' 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-From%3CBox%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/convert/trait.From.html" title="trait std::convert::From">From</a>&lt;<a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;T&gt;&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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-From%3CBox%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.21.0'>1.21.0</div><a class='srclink' href='../../src/alloc/rc.rs.html#1109-1114' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.from-1' class="method"><span id='from.v-1' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(v: <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;T&gt;) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#1111-1113' 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-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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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.6.0'>1.6.0</div><a class='srclink' href='../../src/alloc/rc.rs.html#1077-1081' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.from-2' class="method"><span id='from.v-2' 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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#1078-1080' 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-From%3CString%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../../std/convert/trait.From.html" title="trait std::convert::From">From</a>&lt;<a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a href='#impl-From%3CString%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.21.0'>1.21.0</div><a class='srclink' href='../../src/alloc/rc.rs.html#1101-1106' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.from-3' class="method"><span id='from.v-3' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(v: <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#1103-1105' 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-From%3CVec%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/convert/trait.From.html" title="trait std::convert::From">From</a>&lt;<a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;</code><a href='#impl-From%3CVec%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.21.0'>1.21.0</div><a class='srclink' href='../../src/alloc/rc.rs.html#1117-1129' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.from-4' class="method"><span id='from.v-4' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(v: <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#1119-1128' 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-From%3C%26%27a%20str%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;'a&gt; <a class="trait" href="../../std/convert/trait.From.html" title="trait std::convert::From">From</a>&lt;&amp;'a <a class="primitive" href="../primitive.str.html">str</a>&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;</code><a href='#impl-From%3C%26%27a%20str%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.21.0'>1.21.0</div><a class='srclink' href='../../src/alloc/rc.rs.html#1092-1098' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.from-5' class="method"><span id='from.v-5' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(v: &amp;<a class="primitive" href="../primitive.str.html">str</a>) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#1094-1097' 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-Display' 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.Display.html" title="trait std::fmt::Display">Display</a> for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/fmt/trait.Display.html" title="trait std::fmt::Display">Display</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Display' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#1056-1060' 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.Display.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/alloc/rc.rs.html#1057-1059' 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.Display.html#tymethod.fmt">Read more</a></p>
</div></div><h3 id='impl-PartialOrd%3CRc%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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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%3CRc%3CT%3E%3E' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#933-1024' 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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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/alloc/rc.rs.html#949-951' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Partial comparison for two <code>Rc</code>s.</p>
<p>The two are compared by calling <code>partial_cmp()</code> on their inner values.</p>
<h1 id="examples-11" class="section-header"><a href="#examples-11">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">rc</span>::<span class="ident">Rc</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">cmp</span>::<span class="ident">Ordering</span>;

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

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="prelude-val">Some</span>(<span class="ident">Ordering</span>::<span class="ident">Less</span>), <span class="ident">five</span>.<span class="ident">partial_cmp</span>(<span class="kw-2">&amp;</span><span class="ident">Rc</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%3Arc%3A%3ARc%3B%0Ause%20std%3A%3Acmp%3A%3AOrdering%3B%0A%0Alet%20five%20%3D%20Rc%3A%3Anew(5)%3B%0A%0Aassert_eq!(Some(Ordering%3A%3ALess)%2C%20five.partial_cmp(%26Rc%3A%3Anew(6)))%3B%0A%7D">Run</a></pre>
</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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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/alloc/rc.rs.html#967-969' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Less-than comparison for two <code>Rc</code>s.</p>
<p>The two are compared by calling <code>&lt;</code> on their inner values.</p>
<h1 id="examples-12" class="section-header"><a href="#examples-12">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">rc</span>::<span class="ident">Rc</span>;

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

<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">five</span> <span class="op">&lt;</span> <span class="ident">Rc</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%3Arc%3A%3ARc%3B%0A%0Alet%20five%20%3D%20Rc%3A%3Anew(5)%3B%0A%0Aassert!(five%20%3C%20Rc%3A%3Anew(6))%3B%0A%7D">Run</a></pre>
</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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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/alloc/rc.rs.html#985-987' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>'Less than or equal to' comparison for two <code>Rc</code>s.</p>
<p>The two are compared by calling <code>&lt;=</code> on their inner values.</p>
<h1 id="examples-13" class="section-header"><a href="#examples-13">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">rc</span>::<span class="ident">Rc</span>;

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

<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">five</span> <span class="op">&lt;=</span> <span class="ident">Rc</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%3Arc%3A%3ARc%3B%0A%0Alet%20five%20%3D%20Rc%3A%3Anew(5)%3B%0A%0Aassert!(five%20%3C%3D%20Rc%3A%3Anew(5))%3B%0A%7D">Run</a></pre>
</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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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/alloc/rc.rs.html#1003-1005' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Greater-than comparison for two <code>Rc</code>s.</p>
<p>The two are compared by calling <code>&gt;</code> on their inner values.</p>
<h1 id="examples-14" class="section-header"><a href="#examples-14">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">rc</span>::<span class="ident">Rc</span>;

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

<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">five</span> <span class="op">&gt;</span> <span class="ident">Rc</span>::<span class="ident">new</span>(<span class="number">4</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%3Arc%3A%3ARc%3B%0A%0Alet%20five%20%3D%20Rc%3A%3Anew(5)%3B%0A%0Aassert!(five%20%3E%20Rc%3A%3Anew(4))%3B%0A%7D">Run</a></pre>
</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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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/alloc/rc.rs.html#1021-1023' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>'Greater than or equal to' comparison for two <code>Rc</code>s.</p>
<p>The two are compared by calling <code>&gt;=</code> on their inner values.</p>
<h1 id="examples-15" class="section-header"><a href="#examples-15">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">rc</span>::<span class="ident">Rc</span>;

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

<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">five</span> <span class="op">&gt;=</span> <span class="ident">Rc</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%3Arc%3A%3ARc%3B%0A%0Alet%20five%20%3D%20Rc%3A%3Anew(5)%3B%0A%0Aassert!(five%20%3E%3D%20Rc%3A%3Anew(5))%3B%0A%7D">Run</a></pre>
</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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#1027-1046' 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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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/alloc/rc.rs.html#1043-1045' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Comparison for two <code>Rc</code>s.</p>
<p>The two are compared by calling <code>cmp()</code> on their inner values.</p>
<h1 id="examples-16" class="section-header"><a href="#examples-16">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">rc</span>::<span class="ident">Rc</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">cmp</span>::<span class="ident">Ordering</span>;

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

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ordering</span>::<span class="ident">Less</span>, <span class="ident">five</span>.<span class="ident">cmp</span>(<span class="kw-2">&amp;</span><span class="ident">Rc</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%3Arc%3A%3ARc%3B%0Ause%20std%3A%3Acmp%3A%3AOrdering%3B%0A%0Alet%20five%20%3D%20Rc%3A%3Anew(5)%3B%0A%0Aassert_eq!(Ordering%3A%3ALess%2C%20five.cmp(%26Rc%3A%3Anew(6)))%3B%0A%7D">Run</a></pre>
</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-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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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-Send' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#290' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'></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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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/alloc/rc.rs.html#873-888' 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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#885-887' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Creates a new <code>Rc&lt;T&gt;</code>, with the <code>Default</code> value for <code>T</code>.</p>
<h1 id="examples-17" class="section-header"><a href="#examples-17">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">rc</span>::<span class="ident">Rc</span>;

<span class="kw">let</span> <span class="ident">x</span>: <span class="ident">Rc</span><span class="op">&lt;</span><span class="ident">i32</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Default</span>::<span class="ident">default</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">*</span><span class="ident">x</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%3Arc%3A%3ARc%3B%0A%0Alet%20x%3A%20Rc%3Ci32%3E%20%3D%20Default%3A%3Adefault()%3B%0Aassert_eq!(*x%2C%200)%3B%0A%7D">Run</a></pre>
</div></div><h3 id='impl-Borrow%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/borrow/trait.Borrow.html" title="trait std::borrow::Borrow">Borrow</a>&lt;T&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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-Borrow%3CT%3E' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#1787-1791' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.borrow' 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='borrow.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&amp;self) -&gt; <a class="primitive" href="../primitive.reference.html">&amp;</a>T</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#1788-1790' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Immutably borrows from an owned value. <a href="../../std/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
</div></div><h3 id='impl-Deref' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; <a class="trait" href="../../std/ops/trait.Deref.html" title="trait std::ops::Deref">Deref</a> for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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-Deref' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#792-799' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='associatedtype.Target' class="type"><span id='Target.t' class='invisible'><code>type <a href='../../std/ops/trait.Deref.html#associatedtype.Target' class="type">Target</a> = T</code></span></h4>
<div class='docblock'><p>The resulting type after dereferencing.</p>
</div><h4 id='method.deref' 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='deref.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/ops/trait.Deref.html#tymethod.deref' class='fnname'>deref</a>(&amp;self) -&gt; <a class="primitive" href="../primitive.reference.html">&amp;</a>T</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#796-798' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Dereferences the value.</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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#1063-1067' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.fmt-1' class="method"><span id='fmt.v-1' 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/alloc/rc.rs.html#1064-1066' 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-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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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-Clone' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#850-870' 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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#866-869' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Makes a clone of the <code>Rc</code> pointer.</p>
<p>This creates another pointer to the same inner value, increasing the
strong reference count.</p>
<h1 id="examples-18" class="section-header"><a href="#examples-18">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">rc</span>::<span class="ident">Rc</span>;

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

<span class="ident">Rc</span>::<span class="ident">clone</span>(<span class="kw-2">&amp;</span><span class="ident">five</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%3Arc%3A%3ARc%3B%0A%0Alet%20five%20%3D%20Rc%3A%3Anew(5)%3B%0A%0ARc%3A%3Aclone(%26five)%3B%0A%7D">Run</a></pre>
</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-Hash' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; <a class="trait" href="../../std/hash/trait.Hash.html" title="trait std::hash::Hash">Hash</a> for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/hash/trait.Hash.html" title="trait std::hash::Hash">Hash</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Hash' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#1049-1053' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.hash' class="method"><span id='hash.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/hash/trait.Hash.html#tymethod.hash' class='fnname'>hash</a>&lt;H&gt;(&amp;self, state: <a class="primitive" href="../primitive.reference.html">&amp;mut </a>H) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;H: <a class="trait" href="../../std/hash/trait.Hasher.html" title="trait std::hash::Hasher">Hasher</a>,&nbsp;</span></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#1050-1052' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Feeds this value into the given [<code>Hasher</code>]. <a href="../../std/hash/trait.Hash.html#tymethod.hash">Read more</a></p>
</div><h4 id='method.hash_slice' class="method"><span id='hash_slice.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/hash/trait.Hash.html#method.hash_slice' class='fnname'>hash_slice</a>&lt;H&gt;(data: <a class="primitive" href="../primitive.slice.html">&amp;[Self]</a>, state: <a class="primitive" href="../primitive.reference.html">&amp;mut </a>H) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;H: <a class="trait" href="../../std/hash/trait.Hasher.html" title="trait std::hash::Hasher">Hasher</a>,&nbsp;</span></code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.3.0'>1.3.0</div><a class='srclink' href='../../src/core/hash/mod.rs.html#203-209' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Feeds a slice of this type into the given [<code>Hasher</code>]. <a href="../../std/hash/trait.Hash.html#method.hash_slice">Read more</a></p>
</div></div><h3 id='impl-Drop' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; <a class="trait" href="../../std/ops/trait.Drop.html" title="trait std::ops::Drop">Drop</a> for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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-Drop' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#802-847' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.drop' class="method"><span id='drop.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/ops/trait.Drop.html#tymethod.drop' class='fnname'>drop</a>(&amp;mut self)</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#830-846' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Drops the <code>Rc</code>.</p>
<p>This will decrement the strong reference count. If the strong reference
count reaches zero then the only other references (if any) are
<a href="struct.Weak.html"><code>Weak</code></a>, so we <code>drop</code> the inner value.</p>
<h1 id="examples-19" class="section-header"><a href="#examples-19">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">rc</span>::<span class="ident">Rc</span>;

<span class="kw">struct</span> <span class="ident">Foo</span>;

<span class="kw">impl</span> <span class="ident">Drop</span> <span class="kw">for</span> <span class="ident">Foo</span> {
    <span class="kw">fn</span> <span class="ident">drop</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>) {
        <span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;dropped!&quot;</span>);
    }
}

<span class="kw">let</span> <span class="ident">foo</span>  <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">new</span>(<span class="ident">Foo</span>);
<span class="kw">let</span> <span class="ident">foo2</span> <span class="op">=</span> <span class="ident">Rc</span>::<span class="ident">clone</span>(<span class="kw-2">&amp;</span><span class="ident">foo</span>);

<span class="ident">drop</span>(<span class="ident">foo</span>);    <span class="comment">// Doesn&#39;t print anything</span>
<span class="ident">drop</span>(<span class="ident">foo2</span>);   <span class="comment">// Prints &quot;dropped!&quot;</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%3Arc%3A%3ARc%3B%0A%0Astruct%20Foo%3B%0A%0Aimpl%20Drop%20for%20Foo%20%7B%0A%20%20%20%20fn%20drop(%26mut%20self)%20%7B%0A%20%20%20%20%20%20%20%20println!(%22dropped!%22)%3B%0A%20%20%20%20%7D%0A%7D%0A%0Alet%20foo%20%20%3D%20Rc%3A%3Anew(Foo)%3B%0Alet%20foo2%20%3D%20Rc%3A%3Aclone(%26foo)%3B%0A%0Adrop(foo)%3B%20%20%20%20%2F%2F%20Doesn't%20print%20anything%0Adrop(foo2)%3B%20%20%20%2F%2F%20Prints%20%22dropped!%22%0A%7D">Run</a></pre>
</div></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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#930' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'></div><h3 id='impl-CoerceUnsized%3CRc%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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;U&gt;&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../std/marker/trait.Unsize.html" title="trait std::marker::Unsize">Unsize</a>&lt;U&gt; + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;U: ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-CoerceUnsized%3CRc%3CU%3E%3E' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#295' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'></div><h3 id='impl-PartialEq%3CRc%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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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%3CRc%3CT%3E%3E' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#891-927' 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/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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/alloc/rc.rs.html#906-908' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Equality for two <code>Rc</code>s.</p>
<p>Two <code>Rc</code>s are equal if their inner values are equal.</p>
<h1 id="examples-20" class="section-header"><a href="#examples-20">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">rc</span>::<span class="ident">Rc</span>;

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

<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">five</span> <span class="op">==</span> <span class="ident">Rc</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%3Arc%3A%3ARc%3B%0A%0Alet%20five%20%3D%20Rc%3A%3Anew(5)%3B%0A%0Aassert!(five%20%3D%3D%20Rc%3A%3Anew(5))%3B%0A%7D">Run</a></pre>
</div><h4 id='method.ne' class="method"><span id='ne.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&amp;self, other: &amp;<a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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/alloc/rc.rs.html#924-926' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Inequality for two <code>Rc</code>s.</p>
<p>Two <code>Rc</code>s are unequal if their inner values are unequal.</p>
<h1 id="examples-21" class="section-header"><a href="#examples-21">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">rc</span>::<span class="ident">Rc</span>;

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

<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">five</span> <span class="op">!=</span> <span class="ident">Rc</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%3Arc%3A%3ARc%3B%0A%0Alet%20five%20%3D%20Rc%3A%3Anew(5)%3B%0A%0Aassert!(five%20!%3D%20Rc%3A%3Anew(6))%3B%0A%7D">Run</a></pre>
</div></div><h3 id='impl-Pointer' 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.Pointer.html" title="trait std::fmt::Pointer">Pointer</a> for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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-Pointer' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#1070-1074' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.fmt-2' class="method"><span id='fmt.v-2' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/fmt/trait.Pointer.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/alloc/rc.rs.html#1071-1073' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Formats the value using the given formatter.</p>
</div></div><h3 id='impl-AsRef%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.AsRef.html" title="trait std::convert::AsRef">AsRef</a>&lt;T&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</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-AsRef%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.5.0'>1.5.0</div><a class='srclink' href='../../src/alloc/rc.rs.html#1794-1798' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.as_ref' 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='as_ref.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/convert/trait.AsRef.html#tymethod.as_ref' class='fnname'>as_ref</a>(&amp;self) -&gt; <a class="primitive" href="../primitive.reference.html">&amp;</a>T</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/rc.rs.html#1795-1797' 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-From%3CCString%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../../std/convert/trait.From.html" title="trait std::convert::From">From</a>&lt;<a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a>&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a href='#impl-From%3CCString%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.24.0'>1.24.0</div><a class='srclink' href='../../src/std/ffi/c_str.rs.html#760-766' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.from-6' class="method"><span id='from.v-6' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(s: <a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a>) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/ffi/c_str.rs.html#762-765' 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-From%3C%26%27a%20CStr%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;'a&gt; <a class="trait" href="../../std/convert/trait.From.html" title="trait std::convert::From">From</a>&lt;&amp;'a <a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code><a href='#impl-From%3C%26%27a%20CStr%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.24.0'>1.24.0</div><a class='srclink' href='../../src/std/ffi/c_str.rs.html#769-775' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.from-7' class="method"><span id='from.v-7' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(s: &amp;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/ffi/c_str.rs.html#771-774' 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-From%3COsString%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../../std/convert/trait.From.html" title="trait std::convert::From">From</a>&lt;<a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a href='#impl-From%3COsString%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.24.0'>1.24.0</div><a class='srclink' href='../../src/std/ffi/os_str.rs.html#650-656' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.from-8' class="method"><span id='from.v-8' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(s: <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/ffi/os_str.rs.html#652-655' 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-From%3C%26%27a%20OsStr%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;'a&gt; <a class="trait" href="../../std/convert/trait.From.html" title="trait std::convert::From">From</a>&lt;&amp;'a <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code><a href='#impl-From%3C%26%27a%20OsStr%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.24.0'>1.24.0</div><a class='srclink' href='../../src/std/ffi/os_str.rs.html#659-665' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.from-9' class="method"><span id='from.v-9' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(s: &amp;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/ffi/os_str.rs.html#661-664' 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-UnwindSafe' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;T:&nbsp;<a class="trait" href="../../std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt; <a class="trait" href="../../std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;T&gt;</code><a href='#impl-UnwindSafe' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.9.0'>1.9.0</div><a class='srclink' href='../../src/std/panic.rs.html#229' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'></div><h3 id='impl-From%3CPathBuf%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../../std/convert/trait.From.html" title="trait std::convert::From">From</a>&lt;<a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a href='#impl-From%3CPathBuf%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.24.0'>1.24.0</div><a class='srclink' href='../../src/std/path.rs.html#1540-1546' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.from-10' class="method"><span id='from.v-10' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(s: <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/path.rs.html#1542-1545' 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-From%3C%26%27a%20Path%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;'a&gt; <a class="trait" href="../../std/convert/trait.From.html" title="trait std::convert::From">From</a>&lt;&amp;'a <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt; for <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code><a href='#impl-From%3C%26%27a%20Path%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.24.0'>1.24.0</div><a class='srclink' href='../../src/std/path.rs.html#1549-1555' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.from-11' class="method"><span id='from.v-11' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../std/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(s: &amp;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>) -&gt; <a class="struct" href="../../std/rc/struct.Rc.html" title="struct std::rc::Rc">Rc</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/path.rs.html#1551-1554' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Performs the conversion.</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>