Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 0c2243f8a1696816431e7210e991fa52 > files > 16101

rust-doc-1.35.0-1.mga7.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 `Index` trait in crate `std`."><meta name="keywords" content="rust, rustlang, rust-lang, Index"><title>std::ops::Index - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize1.35.0.css"><link rel="stylesheet" type="text/css" href="../../rustdoc1.35.0.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark1.35.0.css"><link rel="stylesheet" type="text/css" href="../../light1.35.0.css" id="themeStyle"><script src="../../storage1.35.0.js"></script><noscript><link rel="stylesheet" href="../../noscript1.35.0.css"></noscript><link rel="shortcut icon" href="../../favicon1.35.0.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow1.35.0.svg");}</style></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='../../rust-logo1.35.0.png' alt='logo' width='100'></a><p class='location'>Trait Index</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#associated-types">Associated Types</a><div class="sidebar-links"><a href="#associatedtype.Output">Output</a></div><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.index">index</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'>ops</a></p><script>window.sidebarCurrent = {name: 'Index', 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="../../brush1.35.0.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme1.35.0.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel1.35.0.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><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/ops/index.rs.html#61-69' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='../index.html'>std</a>::<wbr><a href='index.html'>ops</a>::<wbr><a class="trait" href=''>Index</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'><div class="docblock attributes">#[lang = "index"]
</div>pub trait Index&lt;Idx&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Idx: ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>,&nbsp;</span>{
    type <a href='#associatedtype.Output' class="type">Output</a>: ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>;
    fn <a href='#tymethod.index' class='fnname'>index</a>(&amp;self, index: Idx) -&gt; &amp;Self::<a class="type" href="../../std/ops/trait.Index.html#associatedtype.Output" title="type std::ops::Index::Output">Output</a>;
}</pre></div><div class='docblock'><p>Used for indexing operations (<code>container[index]</code>) in immutable contexts.</p>
<p><code>container[index]</code> is actually syntactic sugar for <code>*container.index(index)</code>,
but only when used as an immutable value. If a mutable value is requested,
<a href="../../std/ops/trait.IndexMut.html"><code>IndexMut</code></a> is used instead. This allows nice things such as
<code>let value = v[index]</code> if the type of <code>value</code> implements <a href="../../std/marker/trait.Copy.html"><code>Copy</code></a>.</p>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
<p>The following example implements <code>Index</code> on a read-only <code>NucleotideCount</code>
container, enabling individual counts to be retrieved with index syntax.</p>

<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">ops</span>::<span class="ident">Index</span>;

<span class="kw">enum</span> <span class="ident">Nucleotide</span> {
    <span class="ident">A</span>,
    <span class="ident">C</span>,
    <span class="ident">G</span>,
    <span class="ident">T</span>,
}

<span class="kw">struct</span> <span class="ident">NucleotideCount</span> {
    <span class="ident">a</span>: <span class="ident">usize</span>,
    <span class="ident">c</span>: <span class="ident">usize</span>,
    <span class="ident">g</span>: <span class="ident">usize</span>,
    <span class="ident">t</span>: <span class="ident">usize</span>,
}

<span class="kw">impl</span> <span class="ident">Index</span><span class="op">&lt;</span><span class="ident">Nucleotide</span><span class="op">&gt;</span> <span class="kw">for</span> <span class="ident">NucleotideCount</span> {
    <span class="kw">type</span> <span class="ident">Output</span> <span class="op">=</span> <span class="ident">usize</span>;

    <span class="kw">fn</span> <span class="ident">index</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">nucleotide</span>: <span class="ident">Nucleotide</span>) <span class="op">-&gt;</span> <span class="kw-2">&amp;</span><span class="self">Self</span>::<span class="ident">Output</span> {
        <span class="kw">match</span> <span class="ident">nucleotide</span> {
            <span class="ident">Nucleotide</span>::<span class="ident">A</span> <span class="op">=&gt;</span> <span class="kw-2">&amp;</span><span class="self">self</span>.<span class="ident">a</span>,
            <span class="ident">Nucleotide</span>::<span class="ident">C</span> <span class="op">=&gt;</span> <span class="kw-2">&amp;</span><span class="self">self</span>.<span class="ident">c</span>,
            <span class="ident">Nucleotide</span>::<span class="ident">G</span> <span class="op">=&gt;</span> <span class="kw-2">&amp;</span><span class="self">self</span>.<span class="ident">g</span>,
            <span class="ident">Nucleotide</span>::<span class="ident">T</span> <span class="op">=&gt;</span> <span class="kw-2">&amp;</span><span class="self">self</span>.<span class="ident">t</span>,
        }
    }
}

<span class="kw">let</span> <span class="ident">nucleotide_count</span> <span class="op">=</span> <span class="ident">NucleotideCount</span> {<span class="ident">a</span>: <span class="number">14</span>, <span class="ident">c</span>: <span class="number">9</span>, <span class="ident">g</span>: <span class="number">10</span>, <span class="ident">t</span>: <span class="number">12</span>};
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">nucleotide_count</span>[<span class="ident">Nucleotide</span>::<span class="ident">A</span>], <span class="number">14</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">nucleotide_count</span>[<span class="ident">Nucleotide</span>::<span class="ident">C</span>], <span class="number">9</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">nucleotide_count</span>[<span class="ident">Nucleotide</span>::<span class="ident">G</span>], <span class="number">10</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">nucleotide_count</span>[<span class="ident">Nucleotide</span>::<span class="ident">T</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%3Aops%3A%3AIndex%3B%0A%0Aenum%20Nucleotide%20%7B%0A%20%20%20%20A%2C%0A%20%20%20%20C%2C%0A%20%20%20%20G%2C%0A%20%20%20%20T%2C%0A%7D%0A%0Astruct%20NucleotideCount%20%7B%0A%20%20%20%20a%3A%20usize%2C%0A%20%20%20%20c%3A%20usize%2C%0A%20%20%20%20g%3A%20usize%2C%0A%20%20%20%20t%3A%20usize%2C%0A%7D%0A%0Aimpl%20Index%3CNucleotide%3E%20for%20NucleotideCount%20%7B%0A%20%20%20%20type%20Output%20%3D%20usize%3B%0A%0A%20%20%20%20fn%20index(%26self%2C%20nucleotide%3A%20Nucleotide)%20-%3E%20%26Self%3A%3AOutput%20%7B%0A%20%20%20%20%20%20%20%20match%20nucleotide%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Nucleotide%3A%3AA%20%3D%3E%20%26self.a%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20Nucleotide%3A%3AC%20%3D%3E%20%26self.c%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20Nucleotide%3A%3AG%20%3D%3E%20%26self.g%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20Nucleotide%3A%3AT%20%3D%3E%20%26self.t%2C%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%7D%0A%0Alet%20nucleotide_count%20%3D%20NucleotideCount%20%7Ba%3A%2014%2C%20c%3A%209%2C%20g%3A%2010%2C%20t%3A%2012%7D%3B%0Aassert_eq!(nucleotide_count%5BNucleotide%3A%3AA%5D%2C%2014)%3B%0Aassert_eq!(nucleotide_count%5BNucleotide%3A%3AC%5D%2C%209)%3B%0Aassert_eq!(nucleotide_count%5BNucleotide%3A%3AG%5D%2C%2010)%3B%0Aassert_eq!(nucleotide_count%5BNucleotide%3A%3AT%5D%2C%2012)%3B%0A%7D">Run</a></pre></div>
</div>
            <h2 id='associated-types' class='small-section-header'>Associated Types<a href='#associated-types' class='anchor'></a></h2><div class='methods'><h3 id='associatedtype.Output' class='method'><code id='Output.t'>type <a href='#associatedtype.Output' class="type">Output</a>: ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a></code></h3><div class='docblock'><p>The returned type after indexing.</p>
</div></div><span class='loading-content'>Loading content...</span>
            <h2 id='required-methods' class='small-section-header'>Required methods<a href='#required-methods' class='anchor'></a></h2><div class='methods'><h3 id='tymethod.index' class='method'><code id='index.v'>fn <a href='#tymethod.index' class='fnname'>index</a>(&amp;self, index: Idx) -&gt; &amp;Self::<a class="type" href="../../std/ops/trait.Index.html#associatedtype.Output" title="type std::ops::Index::Output">Output</a></code></h3><div class='docblock'><p>Performs the indexing (<code>container[index]</code>) operation.</p>
</div></div><span class='loading-content'>Loading content...</span>
            <h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'><h3 id='impl-Index%3CRange%3Cusize%3E%3E' class='impl'><code class='in-band'>impl Index&lt;<a class="struct" href="../../std/ops/struct.Range.html" title="struct std::ops::Range">Range</a>&lt;<a class="primitive" href="../primitive.usize.html">usize</a>&gt;&gt; for <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a></code><a href='#impl-Index%3CRange%3Cusize%3E%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/string.rs.html#1948-1955' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Output-1' class="type"><code id='Output.t-1'>type <a href='#associatedtype.Output-1' class="type">Output</a> = <a class="primitive" href="../primitive.str.html">str</a></code></h4><h4 id='method.index' class="method hidden"><code id='index.v-1'>fn <a href='#method.index' class='fnname'>index</a>(&amp;self, index: <a class="struct" href="../../std/ops/struct.Range.html" title="struct std::ops::Range">Range</a>&lt;<a class="primitive" href="../primitive.usize.html">usize</a>&gt;) -&gt; &amp;<a class="primitive" href="../primitive.str.html">str</a></code><a class='srclink' href='../../src/alloc/string.rs.html#1952-1954' title='goto source code'>[src]</a></h4></div><h3 id='impl-Index%3CRangeFrom%3Cusize%3E%3E' class='impl'><code class='in-band'>impl Index&lt;<a class="struct" href="../../std/ops/struct.RangeFrom.html" title="struct std::ops::RangeFrom">RangeFrom</a>&lt;<a class="primitive" href="../primitive.usize.html">usize</a>&gt;&gt; for <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a></code><a href='#impl-Index%3CRangeFrom%3Cusize%3E%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/string.rs.html#1966-1973' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Output-2' class="type"><code id='Output.t-2'>type <a href='#associatedtype.Output-2' class="type">Output</a> = <a class="primitive" href="../primitive.str.html">str</a></code></h4><h4 id='method.index-1' class="method hidden"><code id='index.v-2'>fn <a href='#method.index-1' class='fnname'>index</a>(&amp;self, index: <a class="struct" href="../../std/ops/struct.RangeFrom.html" title="struct std::ops::RangeFrom">RangeFrom</a>&lt;<a class="primitive" href="../primitive.usize.html">usize</a>&gt;) -&gt; &amp;<a class="primitive" href="../primitive.str.html">str</a></code><a class='srclink' href='../../src/alloc/string.rs.html#1970-1972' title='goto source code'>[src]</a></h4></div><h3 id='impl-Index%3CRangeFull%3E' class='impl'><code class='in-band'>impl Index&lt;<a class="struct" href="../../std/ops/struct.RangeFull.html" title="struct std::ops::RangeFull">RangeFull</a>&gt; for <a class="struct" href="../../std/ffi/struct.CString.html" title="struct std::ffi::CString">CString</a></code><a href='#impl-Index%3CRangeFull%3E' class='anchor'></a><a class='srclink' href='../../src/std/ffi/c_str.rs.html#1278-1285' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Output-3' class="type"><code id='Output.t-3'>type <a href='#associatedtype.Output-3' class="type">Output</a> = <a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a></code></h4><h4 id='method.index-2' class="method hidden"><code id='index.v-3'>fn <a href='#method.index-2' class='fnname'>index</a>(&amp;self, _index: <a class="struct" href="../../std/ops/struct.RangeFull.html" title="struct std::ops::RangeFull">RangeFull</a>) -&gt; &amp;<a class="struct" href="../../std/ffi/struct.CStr.html" title="struct std::ffi::CStr">CStr</a></code><a class='srclink' href='../../src/std/ffi/c_str.rs.html#1282-1284' title='goto source code'>[src]</a></h4></div><h3 id='impl-Index%3CRangeFull%3E-1' class='impl'><code class='in-band'>impl Index&lt;<a class="struct" href="../../std/ops/struct.RangeFull.html" title="struct std::ops::RangeFull">RangeFull</a>&gt; for <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a></code><a href='#impl-Index%3CRangeFull%3E-1' class='anchor'></a><a class='srclink' href='../../src/std/ffi/os_str.rs.html#367-374' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Output-4' class="type"><code id='Output.t-4'>type <a href='#associatedtype.Output-4' class="type">Output</a> = <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a></code></h4><h4 id='method.index-3' class="method hidden"><code id='index.v-4'>fn <a href='#method.index-3' class='fnname'>index</a>(&amp;self, _index: <a class="struct" href="../../std/ops/struct.RangeFull.html" title="struct std::ops::RangeFull">RangeFull</a>) -&gt; &amp;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a></code><a class='srclink' href='../../src/std/ffi/os_str.rs.html#371-373' title='goto source code'>[src]</a></h4></div><h3 id='impl-Index%3CRangeFull%3E-2' class='impl'><code class='in-band'>impl Index&lt;<a class="struct" href="../../std/ops/struct.RangeFull.html" title="struct std::ops::RangeFull">RangeFull</a>&gt; for <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a></code><a href='#impl-Index%3CRangeFull%3E-2' class='anchor'></a><a class='srclink' href='../../src/alloc/string.rs.html#1975-1982' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Output-5' class="type"><code id='Output.t-5'>type <a href='#associatedtype.Output-5' class="type">Output</a> = <a class="primitive" href="../primitive.str.html">str</a></code></h4><h4 id='method.index-4' class="method hidden"><code id='index.v-5'>fn <a href='#method.index-4' class='fnname'>index</a>(&amp;self, _index: <a class="struct" href="../../std/ops/struct.RangeFull.html" title="struct std::ops::RangeFull">RangeFull</a>) -&gt; &amp;<a class="primitive" href="../primitive.str.html">str</a></code><a class='srclink' href='../../src/alloc/string.rs.html#1979-1981' title='goto source code'>[src]</a></h4></div><h3 id='impl-Index%3CRangeInclusive%3Cusize%3E%3E' class='impl'><code class='in-band'>impl Index&lt;<a class="struct" href="../../std/ops/struct.RangeInclusive.html" title="struct std::ops::RangeInclusive">RangeInclusive</a>&lt;<a class="primitive" href="../primitive.usize.html">usize</a>&gt;&gt; for <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a></code><a href='#impl-Index%3CRangeInclusive%3Cusize%3E%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/string.rs.html#1984-1991' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Output-6' class="type"><code id='Output.t-6'>type <a href='#associatedtype.Output-6' class="type">Output</a> = <a class="primitive" href="../primitive.str.html">str</a></code></h4><h4 id='method.index-5' class="method hidden"><code id='index.v-6'>fn <a href='#method.index-5' class='fnname'>index</a>(&amp;self, index: <a class="struct" href="../../std/ops/struct.RangeInclusive.html" title="struct std::ops::RangeInclusive">RangeInclusive</a>&lt;<a class="primitive" href="../primitive.usize.html">usize</a>&gt;) -&gt; &amp;<a class="primitive" href="../primitive.str.html">str</a></code><a class='srclink' href='../../src/alloc/string.rs.html#1988-1990' title='goto source code'>[src]</a></h4></div><h3 id='impl-Index%3CRangeTo%3Cusize%3E%3E' class='impl'><code class='in-band'>impl Index&lt;<a class="struct" href="../../std/ops/struct.RangeTo.html" title="struct std::ops::RangeTo">RangeTo</a>&lt;<a class="primitive" href="../primitive.usize.html">usize</a>&gt;&gt; for <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a></code><a href='#impl-Index%3CRangeTo%3Cusize%3E%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/string.rs.html#1957-1964' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Output-7' class="type"><code id='Output.t-7'>type <a href='#associatedtype.Output-7' class="type">Output</a> = <a class="primitive" href="../primitive.str.html">str</a></code></h4><h4 id='method.index-6' class="method hidden"><code id='index.v-7'>fn <a href='#method.index-6' class='fnname'>index</a>(&amp;self, index: <a class="struct" href="../../std/ops/struct.RangeTo.html" title="struct std::ops::RangeTo">RangeTo</a>&lt;<a class="primitive" href="../primitive.usize.html">usize</a>&gt;) -&gt; &amp;<a class="primitive" href="../primitive.str.html">str</a></code><a class='srclink' href='../../src/alloc/string.rs.html#1961-1963' title='goto source code'>[src]</a></h4></div><h3 id='impl-Index%3CRangeToInclusive%3Cusize%3E%3E' class='impl'><code class='in-band'>impl Index&lt;<a class="struct" href="../../std/ops/struct.RangeToInclusive.html" title="struct std::ops::RangeToInclusive">RangeToInclusive</a>&lt;<a class="primitive" href="../primitive.usize.html">usize</a>&gt;&gt; for <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a></code><a href='#impl-Index%3CRangeToInclusive%3Cusize%3E%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/string.rs.html#1993-2000' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Output-8' class="type"><code id='Output.t-8'>type <a href='#associatedtype.Output-8' class="type">Output</a> = <a class="primitive" href="../primitive.str.html">str</a></code></h4><h4 id='method.index-7' class="method hidden"><code id='index.v-8'>fn <a href='#method.index-7' class='fnname'>index</a>(&amp;self, index: <a class="struct" href="../../std/ops/struct.RangeToInclusive.html" title="struct std::ops::RangeToInclusive">RangeToInclusive</a>&lt;<a class="primitive" href="../primitive.usize.html">usize</a>&gt;) -&gt; &amp;<a class="primitive" href="../primitive.str.html">str</a></code><a class='srclink' href='../../src/alloc/string.rs.html#1997-1999' title='goto source code'>[src]</a></h4></div><h3 id='impl-Index%3C%26%27_%20Q%3E' class='impl'><code class='in-band'>impl&lt;'_, K, Q, V&gt; Index&lt;<a class="primitive" href="../primitive.reference.html">&amp;'_ </a>Q&gt; for <a class="struct" href="../../std/collections/btree_map/struct.BTreeMap.html" title="struct std::collections::btree_map::BTreeMap">BTreeMap</a>&lt;K, V&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: <a class="trait" href="../../std/cmp/trait.Ord.html" title="trait std::cmp::Ord">Ord</a> + <a class="trait" href="../../std/borrow/trait.Borrow.html" title="trait std::borrow::Borrow">Borrow</a>&lt;Q&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;Q: <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-Index%3C%26%27_%20Q%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/collections/btree/map.rs.html#1794-1809' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Output-9' class="type"><code id='Output.t-9'>type <a href='#associatedtype.Output-9' class="type">Output</a> = V</code></h4><h4 id='method.index-8' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="primitive" href="../primitive.reference.html">&amp;'_ mut </a>F</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="../primitive.reference.html">&amp;'_ mut </a>F</h3><code class="content"><span class="where fmt-newline">impl&lt;'_, F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="primitive" href="../primitive.reference.html">&amp;'_ mut </a>F <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</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/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;'_, 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;'_ 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;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;'_ mut </a>R</span><span class="where fmt-newline">impl&lt;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;'_ mut </a>W</span></code></div></div><code id='index.v-9'>fn <a href='#method.index-8' class='fnname'>index</a>(&amp;self, key: <a class="primitive" href="../primitive.reference.html">&amp;</a>Q) -&gt; <a class="primitive" href="../primitive.reference.html">&amp;</a>V</code><a class='srclink' href='../../src/alloc/collections/btree/map.rs.html#1806-1808' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns a reference to the value corresponding to the supplied key.</p>
<h1 id="panics" class="section-header"><a href="#panics">Panics</a></h1>
<p>Panics if the key is not present in the <code>BTreeMap</code>.</p>
</div></div><h3 id='impl-Index%3Cusize%3E' class='impl'><code class='in-band'>impl&lt;A&gt; Index&lt;<a class="primitive" href="../primitive.usize.html">usize</a>&gt; for <a class="struct" href="../../std/collections/vec_deque/struct.VecDeque.html" title="struct std::collections::vec_deque::VecDeque">VecDeque</a>&lt;A&gt;</code><a href='#impl-Index%3Cusize%3E' class='anchor'></a><a class='srclink' href='../../src/alloc/collections/vec_deque.rs.html#2617-2624' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Output-10' class="type"><code id='Output.t-10'>type <a href='#associatedtype.Output-10' class="type">Output</a> = A</code></h4><h4 id='method.index-9' class="method hidden"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="primitive" href="../primitive.reference.html">&amp;'_ mut </a>F</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="../primitive.reference.html">&amp;'_ mut </a>F</h3><code class="content"><span class="where fmt-newline">impl&lt;'_, F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="primitive" href="../primitive.reference.html">&amp;'_ mut </a>F <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</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/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;'_, 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;'_ 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;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;'_ mut </a>R</span><span class="where fmt-newline">impl&lt;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;'_ mut </a>W</span></code></div></div><code id='index.v-10'>fn <a href='#method.index-9' class='fnname'>index</a>(&amp;self, index: <a class="primitive" href="../primitive.usize.html">usize</a>) -&gt; <a class="primitive" href="../primitive.reference.html">&amp;</a>A</code><a class='srclink' href='../../src/alloc/collections/vec_deque.rs.html#2621-2623' title='goto source code'>[src]</a></h4></div><h3 id='impl-Index%3CI%3E' class='impl'><code class='in-band'>impl&lt;I&gt; Index&lt;I&gt; for <a class="primitive" href="../primitive.str.html">str</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/slice/trait.SliceIndex.html" title="trait std::slice::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;,&nbsp;</span></code><a href='#impl-Index%3CI%3E' class='anchor'></a><a class='srclink' href='../../src/core/str/mod.rs.html#1608-1618' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Output-11' class="type"><code id='Output.t-11'>type <a href='#associatedtype.Output-11' class="type">Output</a> = &lt;I as <a class="trait" href="../../std/slice/trait.SliceIndex.html" title="trait std::slice::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;&gt;::<a class="type" href="../../std/slice/trait.SliceIndex.html#associatedtype.Output" title="type std::slice::SliceIndex::Output">Output</a></code></h4><h4 id='method.index-10' class="method hidden"><code id='index.v-11'>fn <a href='#method.index-10' class='fnname'>index</a>(&amp;self, index: I) -&gt; &amp;&lt;I as <a class="trait" href="../../std/slice/trait.SliceIndex.html" title="trait std::slice::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;&gt;::<a class="type" href="../../std/slice/trait.SliceIndex.html#associatedtype.Output" title="type std::slice::SliceIndex::Output">Output</a></code><a class='srclink' href='../../src/core/str/mod.rs.html#1615-1617' title='goto source code'>[src]</a></h4></div><h3 id='impl-Index%3C%26%27_%20Q%3E-1' class='impl'><code class='in-band'>impl&lt;K, Q:&nbsp;?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>, V, S, '_&gt; Index&lt;<a class="primitive" href="../primitive.reference.html">&amp;'_ </a>Q&gt; for <a class="struct" href="../../std/collections/struct.HashMap.html" title="struct std::collections::HashMap">HashMap</a>&lt;K, V, S&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: <a class="trait" href="../../std/cmp/trait.Eq.html" title="trait std::cmp::Eq">Eq</a> + <a class="trait" href="../../std/hash/trait.Hash.html" title="trait std::hash::Hash">Hash</a> + <a class="trait" href="../../std/borrow/trait.Borrow.html" title="trait std::borrow::Borrow">Borrow</a>&lt;Q&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;Q: <a class="trait" href="../../std/cmp/trait.Eq.html" title="trait std::cmp::Eq">Eq</a> + <a class="trait" href="../../std/hash/trait.Hash.html" title="trait std::hash::Hash">Hash</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="../../std/hash/trait.BuildHasher.html" title="trait std::hash::BuildHasher">BuildHasher</a>,&nbsp;</span></code><a href='#impl-Index%3C%26%27_%20Q%3E-1' class='anchor'></a><a class='srclink' href='../../src/std/collections/hash/map.rs.html#1646-1662' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Output-12' class="type"><code id='Output.t-12'>type <a href='#associatedtype.Output-12' class="type">Output</a> = V</code></h4><h4 id='method.index-11' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="primitive" href="../primitive.reference.html">&amp;'_ mut </a>F</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="../primitive.reference.html">&amp;'_ mut </a>F</h3><code class="content"><span class="where fmt-newline">impl&lt;'_, F&gt; <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a> for <a class="primitive" href="../primitive.reference.html">&amp;'_ mut </a>F <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../std/marker/trait.Unpin.html" title="trait std::marker::Unpin">Unpin</a> + <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</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/future/trait.Future.html#associatedtype.Output' class="type">Output</a> = &lt;F as <a class="trait" href="../../std/future/trait.Future.html" title="trait std::future::Future">Future</a>&gt;::<a class="type" href="../../std/future/trait.Future.html#associatedtype.Output" title="type std::future::Future::Output">Output</a>;</span><span class="where fmt-newline">impl&lt;'_, 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;'_ 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;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;'_ mut </a>R</span><span class="where fmt-newline">impl&lt;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;'_ mut </a>W</span></code></div></div><code id='index.v-12'>fn <a href='#method.index-11' class='fnname'>index</a>(&amp;self, key: <a class="primitive" href="../primitive.reference.html">&amp;</a>Q) -&gt; <a class="primitive" href="../primitive.reference.html">&amp;</a>V</code><a class='srclink' href='../../src/std/collections/hash/map.rs.html#1659-1661' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns a reference to the value corresponding to the supplied key.</p>
<h1 id="panics-1" class="section-header"><a href="#panics-1">Panics</a></h1>
<p>Panics if the key is not present in the <code>HashMap</code>.</p>
</div></div><h3 id='impl-Index%3CI%3E-1' class='impl'><code class='in-band'>impl&lt;T, I&gt; Index&lt;I&gt; for <a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/slice/trait.SliceIndex.html" title="trait std::slice::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;,&nbsp;</span></code><a href='#impl-Index%3CI%3E-1' class='anchor'></a><a class='srclink' href='../../src/core/slice/mod.rs.html#2536-2545' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Output-13' class="type"><code id='Output.t-13'>type <a href='#associatedtype.Output-13' class="type">Output</a> = &lt;I as <a class="trait" href="../../std/slice/trait.SliceIndex.html" title="trait std::slice::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;&gt;::<a class="type" href="../../std/slice/trait.SliceIndex.html#associatedtype.Output" title="type std::slice::SliceIndex::Output">Output</a></code></h4><h4 id='method.index-12' class="method hidden"><code id='index.v-13'>fn <a href='#method.index-12' class='fnname'>index</a>(&amp;self, index: I) -&gt; &amp;&lt;I as <a class="trait" href="../../std/slice/trait.SliceIndex.html" title="trait std::slice::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;&gt;::<a class="type" href="../../std/slice/trait.SliceIndex.html#associatedtype.Output" title="type std::slice::SliceIndex::Output">Output</a></code><a class='srclink' href='../../src/core/slice/mod.rs.html#2542-2544' title='goto source code'>[src]</a></h4></div><h3 id='impl-Index%3CI%3E-2' class='impl'><code class='in-band'>impl&lt;T, I&gt; Index&lt;I&gt; for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="../../std/slice/trait.SliceIndex.html" title="trait std::slice::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;,&nbsp;</span></code><a href='#impl-Index%3CI%3E-2' class='anchor'></a><a class='srclink' href='../../src/alloc/vec.rs.html#1672-1679' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Output-14' class="type"><code id='Output.t-14'>type <a href='#associatedtype.Output-14' class="type">Output</a> = &lt;I as <a class="trait" href="../../std/slice/trait.SliceIndex.html" title="trait std::slice::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="../primitive.slice.html">[</a>T<a class="primitive" href="../primitive.slice.html">]</a>&gt;&gt;::<a class="type" href="../../std/slice/trait.SliceIndex.html#associatedtype.Output" title="type std::slice::SliceIndex::Output">Output</a></code></h4><h4 id='method.index-13' class="method hidden"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;<a class="primitive" href="../primitive.u8.html">u8</a>&gt;</span></code></div></div><code id='index.v-14'>fn <a href='#method.index-13' class='fnname'>index</a>(&amp;self, index: I) -&gt; &amp;&lt;<a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a>&lt;T&gt; as <a class="trait" href="../../std/ops/trait.Index.html" title="trait std::ops::Index">Index</a>&lt;I&gt;&gt;::<a class="type" href="../../std/ops/trait.Index.html#associatedtype.Output" title="type std::ops::Index::Output">Output</a></code><a class='srclink' href='../../src/alloc/vec.rs.html#1676-1678' title='goto source code'>[src]</a></h4></div></div><span class='loading-content'>Loading content...</span><script type="text/javascript">window.inlined_types=new Set([]);</script><script type="text/javascript" async
                         src="../../implementors/core/ops/index/trait.Index.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="../../main1.35.0.js"></script><script defer src="../../search-index.js"></script></body></html>