Sophie

Sophie

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

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 `alloc`."><meta name="keywords" content="rust, rustlang, rust-lang, Borrow"><title>alloc::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='../../alloc/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'>alloc</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'>alloc</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="../../core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span>{
    fn <a href='#tymethod.borrow' class='fnname'>borrow</a>(&amp;self) -&gt; &amp;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>
    }
}</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> { }</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>)
        }
    }
}</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'>
        <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; &amp;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>);</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;[T]&gt; for [T; 28]</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; 7]</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; 27]</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; 30]</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; 12]</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; 13]</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; 2]</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; 19]</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; 21]</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; 14]</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="../../core/marker/trait.Sized.html" title="trait core::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;[T]&gt; for [T; 22]</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; 16]</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; 10]</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; 24]</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; 23]</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; 0]</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 &amp;'a T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="../../core/marker/trait.Sized.html" title="trait core::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;[T]&gt; for [T; 31]</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; 18]</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; 4]</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; 3]</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; 6]</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; 5]</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; 25]</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; 29]</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; 8]</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; 17]</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; 11]</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; 20]</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; 9]</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; 1]</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; 26]</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; 32]</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 &amp;'a mut T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="../../core/marker/trait.Sized.html" title="trait core::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;[T]&gt; for [T; 15]</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:&nbsp;?<a class="trait" href="../../core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; Borrow&lt;T&gt; for <a class="struct" href="../../alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;T&gt;</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:&nbsp;?<a class="trait" href="../../core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; Borrow&lt;T&gt; for <a class="struct" href="../../alloc/arc/struct.Arc.html" title="struct alloc::arc::Arc">Arc</a>&lt;T&gt;</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;T:&nbsp;?<a class="trait" href="../../core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; Borrow&lt;T&gt; for <a class="struct" href="../../alloc/rc/struct.Rc.html" title="struct alloc::rc::Rc">Rc</a>&lt;T&gt;</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;'a, B:&nbsp;?<a class="trait" href="../../core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; Borrow&lt;B&gt; for <a class="enum" href="../../alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, B&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;B: <a class="trait" href="../../alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;B as <a class="trait" href="../../alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a>&gt;::<a class="type" href="../../alloc/borrow/trait.ToOwned.html#associatedtype.Owned" title="type alloc::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&lt;T&gt; Borrow&lt;[T]&gt; for <a class="struct" href="../../alloc/vec/struct.Vec.html" title="struct alloc::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 Borrow&lt;str&gt; for <a class="struct" href="../../alloc/string/struct.String.html" title="struct alloc::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>
</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 = "alloc";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>