Sophie

Sophie

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

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 `Borrow` trait in crate `std`."><meta name="keywords" content="rust, rustlang, rust-lang, Borrow"><title>std::borrow::Borrow - 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 trait"><!--[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'>Trait Borrow</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.borrow">borrow</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='../index.html'>std</a>::<wbr><a href='index.html'>borrow</a></p><script>window.sidebarCurrent = {name: 'Borrow', ty: 'trait', 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'>Trait <a href='../index.html'>std</a>::<wbr><a href='index.html'>borrow</a>::<wbr><a class="trait" href=''>Borrow</a></span><span class='out-of-band'><span class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/core/borrow.rs.html#166-188' title='goto source code'>[src]</a></span></h1><div class="docblock type-decl"><pre class='rust trait'>pub trait Borrow&lt;Borrowed&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Borrowed: ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span>{
    fn <a href='#tymethod.borrow' class='fnname'>borrow</a>(&amp;self) -&gt; <a class="primitive" href="../primitive.reference.html">&amp;</a>Borrowed;
}</pre></div><div class='docblock'><p>A trait for borrowing data.</p>
<p>In Rust, it is common to provide different representations of a type for
different use cases. For instance, storage location and management for a
value can be specifically chosen as appropriate for a particular use via
pointer types such as <a href="../../std/boxed/struct.Box.html"><code>Box&lt;T&gt;</code></a> or <a href="../../std/rc/struct.Rc.html"><code>Rc&lt;T&gt;</code></a>. Beyond these generic
wrappers that can be used with any type, some types provide optional
facets providing potentially costly functionality. An example for such a
type is <a href="../../std/string/struct.String.html"><code>String</code></a> which adds the ability to extend a string to the basic
<a href="../../std/primitive.str.html"><code>str</code></a>. This requires keeping additional information unnecessary for a
simple, immutable string.</p>
<p>These types provide access to the underlying data through references
to the type of that data. They are said to be ‘borrowed as’ that type.
For instance, a <a href="../../std/boxed/struct.Box.html"><code>Box&lt;T&gt;</code></a> can be borrowed as <code>T</code> while a <a href="../../std/string/struct.String.html"><code>String</code></a>
can be borrowed as <code>str</code>.</p>
<p>Types express that they can be borrowed as some type <code>T</code> by implementing
<code>Borrow&lt;T&gt;</code>, providing a reference to a <code>T</code> in the trait’s
<a href="#tymethod.borrow"><code>borrow</code></a> method. A type is free to borrow as several different types.
If it wishes to mutably borrow as the type – allowing the underlying data
to be modified, it can additionally implement <a href="trait.BorrowMut.html"><code>BorrowMut&lt;T&gt;</code></a>.</p>
<p>Further, when providing implementations for additional traits, it needs
to be considered whether they should behave identical to those of the
underlying type as a consequence of acting as a representation of that
underlying type. Generic code typically uses <code>Borrow&lt;T&gt;</code> when it relies
on the identical behavior of these additional trait implementations.
These traits will likely appear as additional trait bounds.</p>
<p>If generic code merely needs to work for all types that can
provide a reference to related type <code>T</code>, it is often better to use
<a href="../../std/convert/trait.AsRef.html"><code>AsRef&lt;T&gt;</code></a> as more types can safely implement it.</p>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
<p>As a data collection, <a href="../../std/collections/struct.HashMap.html"><code>HashMap&lt;K, V&gt;</code></a> owns both keys and values. If
the key’s actual data is wrapped in a managing type of some kind, it
should, however, still be possible to search for a value using a
reference to the key’s data. For instance, if the key is a string, then
it is likely stored with the hash map as a <a href="../../std/string/struct.String.html"><code>String</code></a>, while it should
be possible to search using a <a href="../../std/primitive.str.html"><code>&amp;str</code></a>. Thus, <code>insert</code> needs to
operate on a <code>String</code> while <code>get</code> needs to be able to use a <code>&amp;str</code>.</p>
<p>Slightly simplified, the relevant parts of <code>HashMap&lt;K, V&gt;</code> look like
this:</p>

<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">borrow</span>::<span class="ident">Borrow</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">hash</span>::<span class="ident">Hash</span>;

<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">HashMap</span><span class="op">&lt;</span><span class="ident">K</span>, <span class="ident">V</span><span class="op">&gt;</span> {
    <span class="comment">// fields omitted</span>
}

<span class="kw">impl</span><span class="op">&lt;</span><span class="ident">K</span>, <span class="ident">V</span><span class="op">&gt;</span> <span class="ident">HashMap</span><span class="op">&lt;</span><span class="ident">K</span>, <span class="ident">V</span><span class="op">&gt;</span> {
    <span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">insert</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">key</span>: <span class="ident">K</span>, <span class="ident">value</span>: <span class="ident">V</span>) <span class="op">-&gt;</span> <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="ident">V</span><span class="op">&gt;</span>
    <span class="kw">where</span> <span class="ident">K</span>: <span class="ident">Hash</span> <span class="op">+</span> <span class="ident">Eq</span>
    {
        <span class="comment">// ...</span>
    }

    <span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">get</span><span class="op">&lt;</span><span class="ident">Q</span><span class="op">&gt;</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">k</span>: <span class="kw-2">&amp;</span><span class="ident">Q</span>) <span class="op">-&gt;</span> <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="kw-2">&amp;</span><span class="ident">V</span><span class="op">&gt;</span>
    <span class="kw">where</span>
        <span class="ident">K</span>: <span class="ident">Borrow</span><span class="op">&lt;</span><span class="ident">Q</span><span class="op">&gt;</span>,
        <span class="ident">Q</span>: <span class="ident">Hash</span> <span class="op">+</span> <span class="ident">Eq</span> <span class="op">+</span> <span class="question-mark">?</span><span class="ident">Sized</span>
    {
        <span class="comment">// ...</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%3Aborrow%3A%3ABorrow%3B%0Ause%20std%3A%3Ahash%3A%3AHash%3B%0A%0Apub%20struct%20HashMap%3CK%2C%20V%3E%20%7B%0Amarker%3A%20%3A%3Astd%3A%3Amarker%3A%3APhantomData%3C(K%2C%20V)%3E%2C%0A%20%20%20%20%2F%2F%20fields%20omitted%0A%7D%0A%0Aimpl%3CK%2C%20V%3E%20HashMap%3CK%2C%20V%3E%20%7B%0A%20%20%20%20pub%20fn%20insert(%26self%2C%20key%3A%20K%2C%20value%3A%20V)%20-%3E%20Option%3CV%3E%0A%20%20%20%20where%20K%3A%20Hash%20%2B%20Eq%0A%20%20%20%20%7B%0Aunimplemented!()%0A%20%20%20%20%20%20%20%20%2F%2F%20...%0A%20%20%20%20%7D%0A%0A%20%20%20%20pub%20fn%20get%3CQ%3E(%26self%2C%20k%3A%20%26Q)%20-%3E%20Option%3C%26V%3E%0A%20%20%20%20where%0A%20%20%20%20%20%20%20%20K%3A%20Borrow%3CQ%3E%2C%0A%20%20%20%20%20%20%20%20Q%3A%20Hash%20%2B%20Eq%20%2B%20%3FSized%0A%20%20%20%20%7B%0Aunimplemented!()%0A%20%20%20%20%20%20%20%20%2F%2F%20...%0A%20%20%20%20%7D%0A%7D%0A%7D">Run</a></pre>
<p>The entire hash map is generic over a key type <code>K</code>. Because these keys
are stored with the hash map, this type has to own the key’s data.
When inserting a key-value pair, the map is given such a <code>K</code> and needs
to find the correct hash bucket and check if the key is already present
based on that <code>K</code>. It therefore requires <code>K: Hash + Eq</code>.</p>
<p>When searching for a value in the map, however, having to provide a
reference to a <code>K</code> as the key to search for would require to always
create such an owned value. For string keys, this would mean a <code>String</code>
value needs to be created just for the search for cases where only a
<code>str</code> is available.</p>
<p>Instead, the <code>get</code> method is generic over the type of the underlying key
data, called <code>Q</code> in the method signature above. It states that <code>K</code>
borrows as a <code>Q</code> by requiring that <code>K: Borrow&lt;Q&gt;</code>. By additionally
requiring <code>Q: Hash + Eq</code>, it signals the requirement that <code>K</code> and <code>Q</code>
have implementations of the <code>Hash</code> and <code>Eq</code> traits that produce identical
results.</p>
<p>The implementation of <code>get</code> relies in particular on identical
implementations of <code>Hash</code> by determining the key’s hash bucket by calling
<code>Hash::hash</code> on the <code>Q</code> value even though it inserted the key based on
the hash value calculated from the <code>K</code> value.</p>
<p>As a consequence, the hash map breaks if a <code>K</code> wrapping a <code>Q</code> value
produces a different hash than <code>Q</code>. For instance, imagine you have a
type that wraps a string but compares ASCII letters ignoring their case:</p>

<pre class="rust rust-example-rendered">
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">CaseInsensitiveString</span>(<span class="ident">String</span>);

<span class="kw">impl</span> <span class="ident">PartialEq</span> <span class="kw">for</span> <span class="ident">CaseInsensitiveString</span> {
    <span class="kw">fn</span> <span class="ident">eq</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">other</span>: <span class="kw-2">&amp;</span><span class="self">Self</span>) <span class="op">-&gt;</span> <span class="ident">bool</span> {
        <span class="self">self</span>.<span class="number">0</span>.<span class="ident">eq_ignore_ascii_case</span>(<span class="kw-2">&amp;</span><span class="ident">other</span>.<span class="number">0</span>)
    }
}

<span class="kw">impl</span> <span class="ident">Eq</span> <span class="kw">for</span> <span class="ident">CaseInsensitiveString</span> { }<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Apub%20struct%20CaseInsensitiveString(String)%3B%0A%0Aimpl%20PartialEq%20for%20CaseInsensitiveString%20%7B%0A%20%20%20%20fn%20eq(%26self%2C%20other%3A%20%26Self)%20-%3E%20bool%20%7B%0A%20%20%20%20%20%20%20%20self.0.eq_ignore_ascii_case(%26other.0)%0A%20%20%20%20%7D%0A%7D%0A%0Aimpl%20Eq%20for%20CaseInsensitiveString%20%7B%20%7D%0A%7D">Run</a></pre>
<p>Because two equal values need to produce the same hash value, the
implementation of <code>Hash</code> needs to ignore ASCII case, too:</p>

<pre class="rust rust-example-rendered">
<span class="kw">impl</span> <span class="ident">Hash</span> <span class="kw">for</span> <span class="ident">CaseInsensitiveString</span> {
    <span class="kw">fn</span> <span class="ident">hash</span><span class="op">&lt;</span><span class="ident">H</span>: <span class="ident">Hasher</span><span class="op">&gt;</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">state</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">H</span>) {
        <span class="kw">for</span> <span class="ident">c</span> <span class="kw">in</span> <span class="self">self</span>.<span class="number">0</span>.<span class="ident">as_bytes</span>() {
            <span class="ident">c</span>.<span class="ident">to_ascii_lowercase</span>().<span class="ident">hash</span>(<span class="ident">state</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%3Ahash%3A%3A%7BHash%2C%20Hasher%7D%3B%0Apub%20struct%20CaseInsensitiveString(String)%3B%0Aimpl%20Hash%20for%20CaseInsensitiveString%20%7B%0A%20%20%20%20fn%20hash%3CH%3A%20Hasher%3E(%26self%2C%20state%3A%20%26mut%20H)%20%7B%0A%20%20%20%20%20%20%20%20for%20c%20in%20self.0.as_bytes()%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20c.to_ascii_lowercase().hash(state)%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%7D%0A%7D">Run</a></pre>
<p>Can <code>CaseInsensitiveString</code> implement <code>Borrow&lt;str&gt;</code>? It certainly can
provide a reference to a string slice via its contained owned string.
But because its <code>Hash</code> implementation differs, it behaves differently
from <code>str</code> and therefore must not, in fact, implement <code>Borrow&lt;str&gt;</code>.
If it wants to allow others access to the underlying <code>str</code>, it can do
that via <code>AsRef&lt;str&gt;</code> which doesn’t carry any extra requirements.</p>
</div>
            <h2 id='required-methods' class='small-section-header'>
              Required Methods<a href='#required-methods' class='anchor'></a>
            </h2>
            <div class='methods'>
        <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><h3 id='tymethod.borrow' class='method'><span id='borrow.v' class='invisible'><code>fn <a href='#tymethod.borrow' class='fnname'>borrow</a>(&amp;self) -&gt; <a class="primitive" href="../primitive.reference.html">&amp;</a>Borrowed</code></span></h3><div class='docblock'><p>Immutably borrows from an owned value.</p>
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">borrow</span>::<span class="ident">Borrow</span>;

<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">Borrow</span><span class="op">&lt;</span><span class="ident">str</span><span class="op">&gt;&gt;</span>(<span class="ident">s</span>: <span class="ident">T</span>) {
    <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="string">&quot;Hello&quot;</span>, <span class="ident">s</span>.<span class="ident">borrow</span>());
}

<span class="kw">let</span> <span class="ident">s</span> <span class="op">=</span> <span class="string">&quot;Hello&quot;</span>.<span class="ident">to_string</span>();

<span class="ident">check</span>(<span class="ident">s</span>);

<span class="kw">let</span> <span class="ident">s</span> <span class="op">=</span> <span class="string">&quot;Hello&quot;</span>;

<span class="ident">check</span>(<span class="ident">s</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%3Aborrow%3A%3ABorrow%3B%0A%0Afn%20check%3CT%3A%20Borrow%3Cstr%3E%3E(s%3A%20T)%20%7B%0A%20%20%20%20assert_eq!(%22Hello%22%2C%20s.borrow())%3B%0A%7D%0A%0Alet%20s%20%3D%20%22Hello%22.to_string()%3B%0A%0Acheck(s)%3B%0A%0Alet%20s%20%3D%20%22Hello%22%3B%0A%0Acheck(s)%3B%0A%7D">Run</a></pre>
</div></div>
        <h2 id='implementors' class='small-section-header'>
          Implementors<a href='#implementors' class='anchor'></a>
        </h2>
        <ul class='item-list' id='implementors-list'>
    <li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 28]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 7]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 27]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 30]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 12]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 13]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 2]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 19]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 21]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 14]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;T&gt; for T <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><td><div class='out-of-band'><a class='srclink' href='../../src/core/borrow.rs.html#219-221' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 22]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 16]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 10]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 24]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 23]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 0]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;'a, T&gt; Borrow&lt;T&gt; for <a class="primitive" href="../primitive.reference.html">&amp;'a </a>T <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><td><div class='out-of-band'><a class='srclink' href='../../src/core/borrow.rs.html#229-231' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 31]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 18]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 4]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 3]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 6]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 5]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 25]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 29]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 8]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 17]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 11]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 20]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 9]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 1]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 26]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 32]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;'a, T&gt; Borrow&lt;T&gt; for <a class="primitive" href="../primitive.reference.html">&amp;'a mut </a>T <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><td><div class='out-of-band'><a class='srclink' href='../../src/core/borrow.rs.html#234-236' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="primitive" href="../primitive.array.html">[</a>T<a class="primitive" href="../primitive.array.html">; 15]</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/core/array.rs.html#138-142' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&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><td><div class='out-of-band'><a class='srclink' href='../../src/alloc/rc.rs.html#1787-1791' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;T&gt; for <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</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><td><div class='out-of-band'><a class='srclink' href='../../src/alloc/boxed.rs.html#719-723' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt; for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt;</code><td><div class='out-of-band'><a class='srclink' href='../../src/alloc/slice.rs.html#595-599' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;T&gt; Borrow&lt;T&gt; for <a class="struct" href="../../std/sync/struct.Arc.html" title="struct std::sync::Arc">Arc</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><td><div class='out-of-band'><a class='srclink' href='../../src/alloc/arc.rs.html#1909-1913' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl&lt;'a, B&gt; Borrow&lt;B&gt; for <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, B&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;B: <a class="trait" href="../../std/borrow/trait.ToOwned.html" title="trait std::borrow::ToOwned">ToOwned</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;B as <a class="trait" href="../../std/borrow/trait.ToOwned.html" title="trait std::borrow::ToOwned">ToOwned</a>&gt;::<a class="type" href="../../std/borrow/trait.ToOwned.html#associatedtype.Owned" title="type std::borrow::ToOwned::Owned">Owned</a>: 'a,&nbsp;</span></code><td><div class='out-of-band'><a class='srclink' href='../../src/alloc/borrow.rs.html#28-35' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl Borrow&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt; for <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/alloc/str.rs.html#194-199' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl Borrow&lt;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a>&gt; for <a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/std/ffi/c_str.rs.html#680-683' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl Borrow&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt; for <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/std/ffi/os_str.rs.html#833-835' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
<li><table class='table-display'><tbody><tr><td><code>impl Borrow&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code><td><div class='out-of-band'><a class='srclink' href='../../src/std/path.rs.html#1476-1480' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
</ul><script type="text/javascript">window.inlined_types=new Set([]);</script><script type="text/javascript" async
                         src="../../implementors/core/borrow/trait.Borrow.js">
                 </script></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><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>