mentat/hyper/header/struct.AcceptCharset.html
2018-08-22 17:04:13 +00:00

640 lines
No EOL
97 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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 `AcceptCharset` struct in crate `hyper`.">
<meta name="keywords" content="rust, rustlang, rust-lang, AcceptCharset">
<title>hyper::header::AcceptCharset - 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="../../main.css" id="themeStyle">
<script src="../../storage.js"></script>
</head>
<body class="rustdoc struct">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<div class="sidebar-menu">&#9776;</div>
<p class='location'>Struct AcceptCharset</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#deref-methods">Methods from Deref&lt;Target=Vec&lt;QualityItem&lt;Charset&gt;&gt;&gt;</a><div class="sidebar-links"><a href="#method.capacity">capacity</a><a href="#method.as_slice">as_slice</a><a href="#method.len">len</a><a href="#method.is_empty">is_empty</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a><a href="#impl-PartialEq">PartialEq</a><a href="#impl-Deref">Deref</a><a href="#impl-DerefMut">DerefMut</a><a href="#impl-Header">Header</a><a href="#impl-Display">Display</a></div></div><p class='location'><a href='../index.html'>hyper</a>::<wbr><a href='index.html'>header</a></p><script>window.sidebarCurrent = {name: 'AcceptCharset', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div>
</nav>
<div class="theme-picker">
<button id="theme-picker" aria-label="Pick another theme!">
<img src="../../brush.svg" width="18" alt="Pick another theme!">
</button>
<div id="theme-choices"></div>
</div>
<script src="../../theme.js"></script>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>hyper</a>::<wbr><a href='index.html'>header</a>::<wbr><a class="struct" href=''>AcceptCharset</a></span><span class='out-of-band'><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/hyper/header/common/mod.rs.html#230' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct AcceptCharset(pub <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="../../hyper/header/struct.QualityItem.html" title="struct hyper::header::QualityItem">QualityItem</a>&lt;<a class="enum" href="../../hyper/header/enum.Charset.html" title="enum hyper::header::Charset">Charset</a>&gt;&gt;);</pre><div class='docblock'><p><code>Accept-Charset</code> header, defined in
<a href="http://tools.ietf.org/html/rfc7231#section-5.3.3">RFC7231</a></p>
<p>The <code>Accept-Charset</code> header field can be sent by a user agent to
indicate what charsets are acceptable in textual response content.
This field allows user agents capable of understanding more
comprehensive or special-purpose charsets to signal that capability
to an origin server that is capable of representing information in
those charsets.</p>
<h1 id="abnf" class="section-header"><a href="#abnf">ABNF</a></h1>
<pre><code class="language-text">Accept-Charset = 1#( ( charset / &quot;*&quot; ) [ weight ] )
</code></pre>
<h1 id="example-values" class="section-header"><a href="#example-values">Example values</a></h1>
<ul>
<li><code>iso-8859-5, unicode-1-1;q=0.8</code></li>
</ul>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">hyper</span>::<span class="ident">header</span>::{<span class="ident">Headers</span>, <span class="ident">AcceptCharset</span>, <span class="ident">Charset</span>, <span class="ident">qitem</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">headers</span> <span class="op">=</span> <span class="ident">Headers</span>::<span class="ident">new</span>();
<span class="ident">headers</span>.<span class="ident">set</span>(
<span class="ident">AcceptCharset</span>(<span class="macro">vec</span><span class="macro">!</span>[<span class="ident">qitem</span>(<span class="ident">Charset</span>::<span class="ident">Us_Ascii</span>)])
);</pre>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">hyper</span>::<span class="ident">header</span>::{<span class="ident">Headers</span>, <span class="ident">AcceptCharset</span>, <span class="ident">Charset</span>, <span class="ident">q</span>, <span class="ident">QualityItem</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">headers</span> <span class="op">=</span> <span class="ident">Headers</span>::<span class="ident">new</span>();
<span class="ident">headers</span>.<span class="ident">set</span>(
<span class="ident">AcceptCharset</span>(<span class="macro">vec</span><span class="macro">!</span>[
<span class="ident">QualityItem</span>::<span class="ident">new</span>(<span class="ident">Charset</span>::<span class="ident">Us_Ascii</span>, <span class="ident">q</span>(<span class="number">900</span>)),
<span class="ident">QualityItem</span>::<span class="ident">new</span>(<span class="ident">Charset</span>::<span class="ident">Iso_8859_10</span>, <span class="ident">q</span>(<span class="number">200</span>)),
])
);</pre>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">hyper</span>::<span class="ident">header</span>::{<span class="ident">Headers</span>, <span class="ident">AcceptCharset</span>, <span class="ident">Charset</span>, <span class="ident">qitem</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">headers</span> <span class="op">=</span> <span class="ident">Headers</span>::<span class="ident">new</span>();
<span class="ident">headers</span>.<span class="ident">set</span>(
<span class="ident">AcceptCharset</span>(<span class="macro">vec</span><span class="macro">!</span>[<span class="ident">qitem</span>(<span class="ident">Charset</span>::<span class="ident">Ext</span>(<span class="string">&quot;utf-8&quot;</span>.<span class="ident">to_owned</span>()))])
);</pre>
</div>
<h2 id='deref-methods' class='small-section-header'>
Methods from <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>&lt;Target = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="../../hyper/header/struct.QualityItem.html" title="struct hyper::header::QualityItem">QualityItem</a>&lt;<a class="enum" href="../../hyper/header/enum.Charset.html" title="enum hyper::header::Charset">Charset</a>&gt;&gt;&gt;<a href='#deref-methods' class='anchor'></a>
</h2>
<div class='impl-items'><h4 id='method.capacity' class="method"><span id='capacity.v' class='invisible'><code>pub fn <a href='#method.capacity' class='fnname'>capacity</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#441-443' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns the number of elements the vector can hold without
reallocating.</p>
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">vec</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">i32</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Vec</span>::<span class="ident">with_capacity</span>(<span class="number">10</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>.<span class="ident">capacity</span>(), <span class="number">10</span>);</pre>
</div><h4 id='method.reserve' class="method"><span id='reserve.v' class='invisible'><code>pub fn <a href='#method.reserve' class='fnname'>reserve</a>(&amp;mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#463-465' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Reserves capacity for at least <code>additional</code> more elements to be inserted
in the given <code>Vec&lt;T&gt;</code>. The collection may reserve more space to avoid
frequent reallocations. After calling <code>reserve</code>, capacity will be
greater than or equal to <code>self.len() + additional</code>. Does nothing if
capacity is already sufficient.</p>
<h1 id="panics" class="section-header"><a href="#panics">Panics</a></h1>
<p>Panics if the new capacity overflows <code>usize</code>.</p>
<h1 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>];
<span class="ident">vec</span>.<span class="ident">reserve</span>(<span class="number">10</span>);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">vec</span>.<span class="ident">capacity</span>() <span class="op">&gt;=</span> <span class="number">11</span>);</pre>
</div><h4 id='method.reserve_exact' class="method"><span id='reserve_exact.v' class='invisible'><code>pub fn <a href='#method.reserve_exact' class='fnname'>reserve_exact</a>(&amp;mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#488-490' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Reserves the minimum capacity for exactly <code>additional</code> more elements to
be inserted in the given <code>Vec&lt;T&gt;</code>. After calling <code>reserve_exact</code>,
capacity will be greater than or equal to <code>self.len() + additional</code>.
Does nothing if the capacity is already sufficient.</p>
<p>Note that the allocator may give the collection more space than it
requests. Therefore capacity can not be relied upon to be precisely
minimal. Prefer <code>reserve</code> if future insertions are expected.</p>
<h1 id="panics-1" class="section-header"><a href="#panics-1">Panics</a></h1>
<p>Panics if the new capacity overflows <code>usize</code>.</p>
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>];
<span class="ident">vec</span>.<span class="ident">reserve_exact</span>(<span class="number">10</span>);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">vec</span>.<span class="ident">capacity</span>() <span class="op">&gt;=</span> <span class="number">11</span>);</pre>
</div><h4 id='method.shrink_to_fit' class="method"><span id='shrink_to_fit.v' class='invisible'><code>pub fn <a href='#method.shrink_to_fit' class='fnname'>shrink_to_fit</a>(&amp;mut self)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#507-509' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Shrinks the capacity of the vector as much as possible.</p>
<p>It will drop down as close as possible to the length but the allocator
may still inform the vector that there is space for a few more elements.</p>
<h1 id="examples-4" class="section-header"><a href="#examples-4">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="ident">Vec</span>::<span class="ident">with_capacity</span>(<span class="number">10</span>);
<span class="ident">vec</span>.<span class="ident">extend</span>([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>].<span class="ident">iter</span>().<span class="ident">cloned</span>());
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>.<span class="ident">capacity</span>(), <span class="number">10</span>);
<span class="ident">vec</span>.<span class="ident">shrink_to_fit</span>();
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">vec</span>.<span class="ident">capacity</span>() <span class="op">&gt;=</span> <span class="number">3</span>);</pre>
</div><h4 id='method.truncate' class="method"><span id='truncate.v' class='invisible'><code>pub fn <a href='#method.truncate' class='fnname'>truncate</a>(&amp;mut self, len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#588-599' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Shortens the vector, keeping the first <code>len</code> elements and dropping
the rest.</p>
<p>If <code>len</code> is greater than the vector's current length, this has no
effect.</p>
<p>The <a href="#method.drain"><code>drain</code></a> method can emulate <code>truncate</code>, but causes the excess
elements to be returned instead of dropped.</p>
<p>Note that this method has no effect on the allocated capacity
of the vector.</p>
<h1 id="examples-5" class="section-header"><a href="#examples-5">Examples</a></h1>
<p>Truncating a five element vector to two elements:</p>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>];
<span class="ident">vec</span>.<span class="ident">truncate</span>(<span class="number">2</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, [<span class="number">1</span>, <span class="number">2</span>]);</pre>
<p>No truncation occurs when <code>len</code> is greater than the vector's current
length:</p>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
<span class="ident">vec</span>.<span class="ident">truncate</span>(<span class="number">8</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]);</pre>
<p>Truncating when <code>len == 0</code> is equivalent to calling the <a href="#method.clear"><code>clear</code></a>
method.</p>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
<span class="ident">vec</span>.<span class="ident">truncate</span>(<span class="number">0</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, []);</pre>
</div><h4 id='method.as_slice' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'a [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'a [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></h3><code class="content"><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'a [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></span><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'a mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></span></code></div></div><span id='as_slice.v' class='invisible'><code>pub fn <a href='#method.as_slice' class='fnname'>as_slice</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[T]</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#614-616' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Extracts a slice containing the entire vector.</p>
<p>Equivalent to <code>&amp;s[..]</code>.</p>
<h1 id="examples-6" class="section-header"><a href="#examples-6">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>::{<span class="self">self</span>, <span class="ident">Write</span>};
<span class="kw">let</span> <span class="ident">buffer</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>];
<span class="ident">io</span>::<span class="ident">sink</span>().<span class="ident">write</span>(<span class="ident">buffer</span>.<span class="ident">as_slice</span>()).<span class="ident">unwrap</span>();</pre>
</div><h4 id='method.as_mut_slice' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'a [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'a [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></h3><code class="content"><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'a [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></span><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'a mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></span></code></div></div><span id='as_mut_slice.v' class='invisible'><code>pub fn <a href='#method.as_mut_slice' class='fnname'>as_mut_slice</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [T]</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#631-633' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Extracts a mutable slice of the entire vector.</p>
<p>Equivalent to <code>&amp;mut s[..]</code>.</p>
<h1 id="examples-7" class="section-header"><a href="#examples-7">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>::{<span class="self">self</span>, <span class="ident">Read</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buffer</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">0</span>; <span class="number">3</span>];
<span class="ident">io</span>::<span class="ident">repeat</span>(<span class="number">0b101</span>).<span class="ident">read_exact</span>(<span class="ident">buffer</span>.<span class="ident">as_mut_slice</span>()).<span class="ident">unwrap</span>();</pre>
</div><h4 id='method.set_len' class="method"><span id='set_len.v' class='invisible'><code>pub unsafe fn <a href='#method.set_len' class='fnname'>set_len</a>(&amp;mut self, len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#680-682' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Sets the length of a vector.</p>
<p>This will explicitly set the size of the vector, without actually
modifying its buffers, so it is up to the caller to ensure that the
vector is actually the specified size.</p>
<h1 id="examples-8" class="section-header"><a href="#examples-8">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">ptr</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="string">&#39;r&#39;</span>, <span class="string">&#39;u&#39;</span>, <span class="string">&#39;s&#39;</span>, <span class="string">&#39;t&#39;</span>];
<span class="kw">unsafe</span> {
<span class="ident">ptr</span>::<span class="ident">drop_in_place</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">vec</span>[<span class="number">3</span>]);
<span class="ident">vec</span>.<span class="ident">set_len</span>(<span class="number">3</span>);
}
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, [<span class="string">&#39;r&#39;</span>, <span class="string">&#39;u&#39;</span>, <span class="string">&#39;s&#39;</span>]);</pre>
<p>In this example, there is a memory leak since the memory locations
owned by the inner vectors were not freed prior to the <code>set_len</code> call:</p>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>],
<span class="macro">vec</span><span class="macro">!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>],
<span class="macro">vec</span><span class="macro">!</span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>]];
<span class="kw">unsafe</span> {
<span class="ident">vec</span>.<span class="ident">set_len</span>(<span class="number">0</span>);
}</pre>
<p>In this example, the vector gets expanded from zero to four items
without any memory allocations occurring, resulting in vector
values of unallocated memory:</p>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">char</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Vec</span>::<span class="ident">new</span>();
<span class="kw">unsafe</span> {
<span class="ident">vec</span>.<span class="ident">set_len</span>(<span class="number">4</span>);
}</pre>
</div><h4 id='method.swap_remove' class="method"><span id='swap_remove.v' class='invisible'><code>pub fn <a href='#method.swap_remove' class='fnname'>swap_remove</a>(&amp;mut self, index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; T</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#707-711' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Removes an element from the vector and returns it.</p>
<p>The removed element is replaced by the last element of the vector.</p>
<p>This does not preserve ordering, but is O(1).</p>
<h1 id="panics-2" class="section-header"><a href="#panics-2">Panics</a></h1>
<p>Panics if <code>index</code> is out of bounds.</p>
<h1 id="examples-9" class="section-header"><a href="#examples-9">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">v</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="string">&quot;foo&quot;</span>, <span class="string">&quot;bar&quot;</span>, <span class="string">&quot;baz&quot;</span>, <span class="string">&quot;qux&quot;</span>];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">swap_remove</span>(<span class="number">1</span>), <span class="string">&quot;bar&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>, [<span class="string">&quot;foo&quot;</span>, <span class="string">&quot;qux&quot;</span>, <span class="string">&quot;baz&quot;</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">swap_remove</span>(<span class="number">0</span>), <span class="string">&quot;foo&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>, [<span class="string">&quot;baz&quot;</span>, <span class="string">&quot;qux&quot;</span>]);</pre>
</div><h4 id='method.insert' class="method"><span id='insert.v' class='invisible'><code>pub fn <a href='#method.insert' class='fnname'>insert</a>(&amp;mut self, index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, element: T)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#730-753' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Inserts an element at position <code>index</code> within the vector, shifting all
elements after it to the right.</p>
<h1 id="panics-3" class="section-header"><a href="#panics-3">Panics</a></h1>
<p>Panics if <code>index &gt; len</code>.</p>
<h1 id="examples-10" class="section-header"><a href="#examples-10">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
<span class="ident">vec</span>.<span class="ident">insert</span>(<span class="number">1</span>, <span class="number">4</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, [<span class="number">1</span>, <span class="number">4</span>, <span class="number">2</span>, <span class="number">3</span>]);
<span class="ident">vec</span>.<span class="ident">insert</span>(<span class="number">4</span>, <span class="number">5</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, [<span class="number">1</span>, <span class="number">4</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>]);</pre>
</div><h4 id='method.remove' class="method"><span id='remove.v' class='invisible'><code>pub fn <a href='#method.remove' class='fnname'>remove</a>(&amp;mut self, index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; T</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#770-789' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Removes and returns the element at position <code>index</code> within the vector,
shifting all elements after it to the left.</p>
<h1 id="panics-4" class="section-header"><a href="#panics-4">Panics</a></h1>
<p>Panics if <code>index</code> is out of bounds.</p>
<h1 id="examples-11" class="section-header"><a href="#examples-11">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">v</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">remove</span>(<span class="number">1</span>), <span class="number">2</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>, [<span class="number">1</span>, <span class="number">3</span>]);</pre>
</div><h4 id='method.retain' class="method"><span id='retain.v' class='invisible'><code>pub fn <a href='#method.retain' class='fnname'>retain</a>&lt;F&gt;(&amp;mut self, f: F) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#805-824' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Retains only the elements specified by the predicate.</p>
<p>In other words, remove all elements <code>e</code> such that <code>f(&amp;e)</code> returns <code>false</code>.
This method operates in place and preserves the order of the retained
elements.</p>
<h1 id="examples-12" class="section-header"><a href="#examples-12">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>];
<span class="ident">vec</span>.<span class="ident">retain</span>(<span class="op">|</span><span class="kw-2">&amp;</span><span class="ident">x</span><span class="op">|</span> <span class="ident">x</span><span class="op">%</span><span class="number">2</span> <span class="op">==</span> <span class="number">0</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, [<span class="number">2</span>, <span class="number">4</span>]);</pre>
</div><h4 id='method.dedup_by_key' class="method"><span id='dedup_by_key.v' class='invisible'><code>pub fn <a href='#method.dedup_by_key' class='fnname'>dedup_by_key</a>&lt;F, K&gt;(&amp;mut self, key: F) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T) -&gt; K,<br>&nbsp;&nbsp;&nbsp;&nbsp;K: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;K&gt;,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.16.0'>1.16.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#842-844' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Removes all but the first of consecutive elements in the vector that resolve to the same
key.</p>
<p>If the vector is sorted, this removes all duplicates.</p>
<h1 id="examples-13" class="section-header"><a href="#examples-13">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">10</span>, <span class="number">20</span>, <span class="number">21</span>, <span class="number">30</span>, <span class="number">20</span>];
<span class="ident">vec</span>.<span class="ident">dedup_by_key</span>(<span class="op">|</span><span class="ident">i</span><span class="op">|</span> <span class="kw-2">*</span><span class="ident">i</span> <span class="op">/</span> <span class="number">10</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, [<span class="number">10</span>, <span class="number">20</span>, <span class="number">30</span>, <span class="number">20</span>]);</pre>
</div><h4 id='method.dedup_by' class="method"><span id='dedup_by.v' class='invisible'><code>pub fn <a href='#method.dedup_by' class='fnname'>dedup_by</a>&lt;F&gt;(&amp;mut self, same_bucket: F) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.16.0'>1.16.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#866-950' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Removes all but the first of consecutive elements in the vector satisfying a given equality
relation.</p>
<p>The <code>same_bucket</code> function is passed references to two elements from the vector, and
returns <code>true</code> if the elements compare equal, or <code>false</code> if they do not. The elements are
passed in opposite order from their order in the vector, so if <code>same_bucket(a, b)</code> returns
<code>true</code>, <code>a</code> is removed.</p>
<p>If the vector is sorted, this removes all duplicates.</p>
<h1 id="examples-14" class="section-header"><a href="#examples-14">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="string">&quot;foo&quot;</span>, <span class="string">&quot;bar&quot;</span>, <span class="string">&quot;Bar&quot;</span>, <span class="string">&quot;baz&quot;</span>, <span class="string">&quot;bar&quot;</span>];
<span class="ident">vec</span>.<span class="ident">dedup_by</span>(<span class="op">|</span><span class="ident">a</span>, <span class="ident">b</span><span class="op">|</span> <span class="ident">a</span>.<span class="ident">eq_ignore_ascii_case</span>(<span class="ident">b</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, [<span class="string">&quot;foo&quot;</span>, <span class="string">&quot;bar&quot;</span>, <span class="string">&quot;baz&quot;</span>, <span class="string">&quot;bar&quot;</span>]);</pre>
</div><h4 id='method.push' class="method"><span id='push.v' class='invisible'><code>pub fn <a href='#method.push' class='fnname'>push</a>(&amp;mut self, value: T)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#967-978' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Appends an element to the back of a collection.</p>
<h1 id="panics-5" class="section-header"><a href="#panics-5">Panics</a></h1>
<p>Panics if the number of elements in the vector overflows a <code>usize</code>.</p>
<h1 id="examples-15" class="section-header"><a href="#examples-15">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>];
<span class="ident">vec</span>.<span class="ident">push</span>(<span class="number">3</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]);</pre>
</div><h4 id='method.place_back' class="method"><span id='place_back.v' class='invisible'><code>pub fn <a href='#method.place_back' class='fnname'>place_back</a>(&amp;mut self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.PlaceBack.html" title="struct alloc::vec::PlaceBack">PlaceBack</a>&lt;T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#999-1001' title='goto source code'>[src]</a></span></h4>
<div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>collection_placement</code>)</summary><p>placement protocol is subject to change</p>
</details></div></div><div class='docblock'><p>Returns a place for insertion at the back of the <code>Vec</code>.</p>
<p>Using this method with placement syntax is equivalent to <a href="#method.push"><code>push</code></a>,
but may be more efficient.</p>
<h1 id="examples-16" class="section-header"><a href="#examples-16">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">collection_placement</span>)]</span>
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">placement_in_syntax</span>)]</span>
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>];
<span class="ident">vec</span>.<span class="ident">place_back</span>() &lt;- <span class="number">3</span>;
<span class="ident">vec</span>.<span class="ident">place_back</span>() &lt;- <span class="number">4</span>;
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&amp;</span><span class="ident">vec</span>, <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]);</pre>
</div><h4 id='method.pop' class="method"><span id='pop.v' class='invisible'><code>pub fn <a href='#method.pop' class='fnname'>pop</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#1017-1026' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Removes the last element from a vector and returns it, or <a href="../../std/option/enum.Option.html#variant.None"><code>None</code></a> if it
is empty.</p>
<h1 id="examples-17" class="section-header"><a href="#examples-17">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>.<span class="ident">pop</span>(), <span class="prelude-val">Some</span>(<span class="number">3</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, [<span class="number">1</span>, <span class="number">2</span>]);</pre>
</div><h4 id='method.append' class="method"><span id='append.v' class='invisible'><code>pub fn <a href='#method.append' class='fnname'>append</a>(&amp;mut self, other: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;T&gt;)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.4.0'>1.4.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#1045-1050' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Moves all the elements of <code>other</code> into <code>Self</code>, leaving <code>other</code> empty.</p>
<h1 id="panics-6" class="section-header"><a href="#panics-6">Panics</a></h1>
<p>Panics if the number of elements in the vector overflows a <code>usize</code>.</p>
<h1 id="examples-18" class="section-header"><a href="#examples-18">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec2</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>];
<span class="ident">vec</span>.<span class="ident">append</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">vec2</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec2</span>, []);</pre>
</div><h4 id='method.drain' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Drain.html" title="struct alloc::vec::Drain">Drain</a>&lt;'a, T&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Drain.html" title="struct alloc::vec::Drain">Drain</a>&lt;'a, T&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Drain.html" title="struct alloc::vec::Drain">Drain</a>&lt;'a, T&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = T;</span></code></div></div><span id='drain.v' class='invisible'><code>pub fn <a href='#method.drain' class='fnname'>drain</a>&lt;R&gt;(&amp;mut self, range: R) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Drain.html" title="struct alloc::vec::Drain">Drain</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/range/trait.RangeArgument.html" title="trait alloc::range::RangeArgument">RangeArgument</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.6.0'>1.6.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#1089-1130' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Creates a draining iterator that removes the specified range in the vector
and yields the removed items.</p>
<p>Note 1: The element range is removed even if the iterator is only
partially consumed or not consumed at all.</p>
<p>Note 2: It is unspecified how many elements are removed from the vector
if the <code>Drain</code> value is leaked.</p>
<h1 id="panics-7" class="section-header"><a href="#panics-7">Panics</a></h1>
<p>Panics if the starting point is greater than the end point or if
the end point is greater than the length of the vector.</p>
<h1 id="examples-19" class="section-header"><a href="#examples-19">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">v</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
<span class="kw">let</span> <span class="ident">u</span>: <span class="ident">Vec</span><span class="op">&lt;</span>_<span class="op">&gt;</span> <span class="op">=</span> <span class="ident">v</span>.<span class="ident">drain</span>(<span class="number">1</span>..).<span class="ident">collect</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>, <span class="kw-2">&amp;</span>[<span class="number">1</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">u</span>, <span class="kw-2">&amp;</span>[<span class="number">2</span>, <span class="number">3</span>]);
<span class="comment">// A full range clears the vector</span>
<span class="ident">v</span>.<span class="ident">drain</span>(..);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>, <span class="kw-2">&amp;</span>[]);</pre>
</div><h4 id='method.clear' class="method"><span id='clear.v' class='invisible'><code>pub fn <a href='#method.clear' class='fnname'>clear</a>(&amp;mut self)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#1148-1150' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Clears the vector, removing all values.</p>
<p>Note that this method has no effect on the allocated capacity
of the vector.</p>
<h1 id="examples-20" class="section-header"><a href="#examples-20">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">v</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
<span class="ident">v</span>.<span class="ident">clear</span>();
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">is_empty</span>());</pre>
</div><h4 id='method.len' class="method"><span id='len.v' class='invisible'><code>pub fn <a href='#method.len' class='fnname'>len</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#1163-1165' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns the number of elements in the vector, also referred to
as its 'length'.</p>
<h1 id="examples-21" class="section-header"><a href="#examples-21">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">a</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">a</span>.<span class="ident">len</span>(), <span class="number">3</span>);</pre>
</div><h4 id='method.is_empty' class="method"><span id='is_empty.v' class='invisible'><code>pub fn <a href='#method.is_empty' class='fnname'>is_empty</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#1179-1181' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns <code>true</code> if the vector contains no elements.</p>
<h1 id="examples-22" class="section-header"><a href="#examples-22">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">v</span> <span class="op">=</span> <span class="ident">Vec</span>::<span class="ident">new</span>();
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">is_empty</span>());
<span class="ident">v</span>.<span class="ident">push</span>(<span class="number">1</span>);
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">v</span>.<span class="ident">is_empty</span>());</pre>
</div><h4 id='method.split_off' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;</h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;</span></code></div></div><span id='split_off.v' class='invisible'><code>pub fn <a href='#method.split_off' class='fnname'>split_off</a>(&amp;mut self, at: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.4.0'>1.4.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#1204-1220' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Splits the collection into two at the given index.</p>
<p>Returns a newly allocated <code>Self</code>. <code>self</code> contains elements <code>[0, at)</code>,
and the returned <code>Self</code> contains elements <code>[at, len)</code>.</p>
<p>Note that the capacity of <code>self</code> does not change.</p>
<h1 id="panics-8" class="section-header"><a href="#panics-8">Panics</a></h1>
<p>Panics if <code>at &gt; len</code>.</p>
<h1 id="examples-23" class="section-header"><a href="#examples-23">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>];
<span class="kw">let</span> <span class="ident">vec2</span> <span class="op">=</span> <span class="ident">vec</span>.<span class="ident">split_off</span>(<span class="number">1</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, [<span class="number">1</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec2</span>, [<span class="number">2</span>, <span class="number">3</span>]);</pre>
</div></div><div class='impl-items'><h4 id='method.resize' class="method"><span id='resize.v' class='invisible'><code>pub fn <a href='#method.resize' class='fnname'>resize</a>(&amp;mut self, new_len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, value: T)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.5.0'>1.5.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#1247-1255' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Resizes the <code>Vec</code> in-place so that <code>len</code> is equal to <code>new_len</code>.</p>
<p>If <code>new_len</code> is greater than <code>len</code>, the <code>Vec</code> is extended by the
difference, with each additional slot filled with <code>value</code>.
If <code>new_len</code> is less than <code>len</code>, the <code>Vec</code> is simply truncated.</p>
<p>This method requires <code>Clone</code> to clone the passed value. If you'd
rather create a value with <code>Default</code> instead, see <a href="#method.resize_default"><code>resize_default</code></a>.</p>
<h1 id="examples-24" class="section-header"><a href="#examples-24">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="string">&quot;hello&quot;</span>];
<span class="ident">vec</span>.<span class="ident">resize</span>(<span class="number">3</span>, <span class="string">&quot;world&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, [<span class="string">&quot;hello&quot;</span>, <span class="string">&quot;world&quot;</span>, <span class="string">&quot;world&quot;</span>]);
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>];
<span class="ident">vec</span>.<span class="ident">resize</span>(<span class="number">2</span>, <span class="number">0</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, [<span class="number">1</span>, <span class="number">2</span>]);</pre>
</div><h4 id='method.extend_from_slice' class="method"><span id='extend_from_slice.v' class='invisible'><code>pub fn <a href='#method.extend_from_slice' class='fnname'>extend_from_slice</a>(&amp;mut self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[T]</a>)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.6.0'>1.6.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#1275-1277' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Clones and appends all elements in a slice to the <code>Vec</code>.</p>
<p>Iterates over the slice <code>other</code>, clones each element, and then appends
it to this <code>Vec</code>. The <code>other</code> vector is traversed in-order.</p>
<p>Note that this function is same as <code>extend</code> except that it is
specialized to work with slices instead. If and when Rust gets
specialization this function will likely be deprecated (but still
available).</p>
<h1 id="examples-25" class="section-header"><a href="#examples-25">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>];
<span class="ident">vec</span>.<span class="ident">extend_from_slice</span>(<span class="kw-2">&amp;</span>[<span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]);</pre>
</div></div><div class='impl-items'><h4 id='method.resize_default' class="method"><span id='resize_default.v' class='invisible'><code>pub fn <a href='#method.resize_default' class='fnname'>resize_default</a>(&amp;mut self, new_len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#1307-1315' title='goto source code'>[src]</a></span></h4>
<div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>vec_resize_default</code>)</div></div><div class='docblock'><p>Resizes the <code>Vec</code> in-place so that <code>len</code> is equal to <code>new_len</code>.</p>
<p>If <code>new_len</code> is greater than <code>len</code>, the <code>Vec</code> is extended by the
difference, with each additional slot filled with <code>Default::default()</code>.
If <code>new_len</code> is less than <code>len</code>, the <code>Vec</code> is simply truncated.</p>
<p>This method uses <code>Default</code> to create new values on every push. If
you'd rather <code>Clone</code> a given value, use <a href="#method.resize"><code>resize</code></a>.</p>
<h1 id="examples-26" class="section-header"><a href="#examples-26">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">vec_resize_default</span>)]</span>
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
<span class="ident">vec</span>.<span class="ident">resize_default</span>(<span class="number">5</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">0</span>, <span class="number">0</span>]);
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>];
<span class="ident">vec</span>.<span class="ident">resize_default</span>(<span class="number">2</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, [<span class="number">1</span>, <span class="number">2</span>]);</pre>
</div></div><div class='impl-items'><h4 id='method.dedup' class="method"><span id='dedup.v' class='invisible'><code>pub fn <a href='#method.dedup' class='fnname'>dedup</a>(&amp;mut self)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#1411-1413' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Removes consecutive repeated elements in the vector.</p>
<p>If the vector is sorted, this removes all duplicates.</p>
<h1 id="examples-27" class="section-header"><a href="#examples-27">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">2</span>];
<span class="ident">vec</span>.<span class="ident">dedup</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">2</span>]);</pre>
</div><h4 id='method.remove_item' class="method"><span id='remove_item.v' class='invisible'><code>pub fn <a href='#method.remove_item' class='fnname'>remove_item</a>(&amp;mut self, item: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#1428-1431' title='goto source code'>[src]</a></span></h4>
<div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>vec_remove_item</code>)</summary><p>recently added</p>
</details></div></div><div class='docblock'><p>Removes the first instance of <code>item</code> from the vector if the item exists.</p>
<h1 id="examples-28" class="section-header"><a href="#examples-28">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">1</span>];
<span class="ident">vec</span>.<span class="ident">remove_item</span>(<span class="kw-2">&amp;</span><span class="number">1</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">vec</span>, <span class="macro">vec</span><span class="macro">!</span>[<span class="number">2</span>, <span class="number">3</span>, <span class="number">1</span>]);</pre>
</div></div><div class='impl-items'><h4 id='method.splice' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Splice.html" title="struct alloc::vec::Splice">Splice</a>&lt;'a, I&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Splice.html" title="struct alloc::vec::Splice">Splice</a>&lt;'a, I&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, I&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Splice.html" title="struct alloc::vec::Splice">Splice</a>&lt;'a, I&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a>&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::iterator::Iterator::Item">Item</a>;</span></code></div></div><span id='splice.v' class='invisible'><code>pub fn <a href='#method.splice' class='fnname'>splice</a>&lt;R, I&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;range: R, <br>&nbsp;&nbsp;&nbsp;&nbsp;replace_with: I<br>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Splice.html" title="struct alloc::vec::Splice">Splice</a>&lt;&lt;I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html" title="trait core::iter::traits::IntoIterator">IntoIterator</a>&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::IntoIterator::IntoIter">IntoIter</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html" title="trait core::iter::traits::IntoIterator">IntoIterator</a>&lt;Item = T&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/range/trait.RangeArgument.html" title="trait alloc::range::RangeArgument">RangeArgument</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.21.0'>1.21.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#1972-1979' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Creates a splicing iterator that replaces the specified range in the vector
with the given <code>replace_with</code> iterator and yields the removed items.
<code>replace_with</code> does not need to be the same length as <code>range</code>.</p>
<p>Note 1: The element range is removed even if the iterator is not
consumed until the end.</p>
<p>Note 2: It is unspecified how many elements are removed from the vector,
if the <code>Splice</code> value is leaked.</p>
<p>Note 3: The input iterator <code>replace_with</code> is only consumed
when the <code>Splice</code> value is dropped.</p>
<p>Note 4: This is optimal if:</p>
<ul>
<li>The tail (elements in the vector after <code>range</code>) is empty,</li>
<li>or <code>replace_with</code> yields fewer elements than <code>range</code>s length</li>
<li>or the lower bound of its <code>size_hint()</code> is exact.</li>
</ul>
<p>Otherwise, a temporary vector is allocated and the tail is moved twice.</p>
<h1 id="panics-9" class="section-header"><a href="#panics-9">Panics</a></h1>
<p>Panics if the starting point is greater than the end point or if
the end point is greater than the length of the vector.</p>
<h1 id="examples-29" class="section-header"><a href="#examples-29">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">v</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
<span class="kw">let</span> <span class="ident">new</span> <span class="op">=</span> [<span class="number">7</span>, <span class="number">8</span>];
<span class="kw">let</span> <span class="ident">u</span>: <span class="ident">Vec</span><span class="op">&lt;</span>_<span class="op">&gt;</span> <span class="op">=</span> <span class="ident">v</span>.<span class="ident">splice</span>(..<span class="number">2</span>, <span class="ident">new</span>.<span class="ident">iter</span>().<span class="ident">cloned</span>()).<span class="ident">collect</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>, <span class="kw-2">&amp;</span>[<span class="number">7</span>, <span class="number">8</span>, <span class="number">3</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">u</span>, <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">2</span>]);</pre>
</div><h4 id='method.drain_filter' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.DrainFilter.html" title="struct alloc::vec::DrainFilter">DrainFilter</a>&lt;'a, T, F&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.DrainFilter.html" title="struct alloc::vec::DrainFilter">DrainFilter</a>&lt;'a, T, F&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, T, F&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.DrainFilter.html" title="struct alloc::vec::DrainFilter">DrainFilter</a>&lt;'a, T, F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = T;</span></code></div></div><span id='drain_filter.v' class='invisible'><code>pub fn <a href='#method.drain_filter' class='fnname'>drain_filter</a>&lt;F&gt;(&amp;mut self, filter: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.DrainFilter.html" title="struct alloc::vec::DrainFilter">DrainFilter</a>&lt;T, F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#2027-2042' title='goto source code'>[src]</a></span></h4>
<div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>drain_filter</code>)</summary><p>recently added</p>
</details></div></div><div class='docblock'><p>Creates an iterator which uses a closure to determine if an element should be removed.</p>
<p>If the closure returns true, then the element is removed and yielded.
If the closure returns false, it will try again, and call the closure
on the next element, seeing if it passes the test.</p>
<p>Using this method is equivalent to the following code:</p>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">i</span> <span class="op">=</span> <span class="number">0</span>;
<span class="kw">while</span> <span class="ident">i</span> <span class="op">!=</span> <span class="ident">vec</span>.<span class="ident">len</span>() {
<span class="kw">if</span> <span class="ident">some_predicate</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">vec</span>[<span class="ident">i</span>]) {
<span class="kw">let</span> <span class="ident">val</span> <span class="op">=</span> <span class="ident">vec</span>.<span class="ident">remove</span>(<span class="ident">i</span>);
<span class="comment">// your code here</span>
} <span class="kw">else</span> {
<span class="ident">i</span> <span class="op">+=</span> <span class="number">1</span>;
}
}
</pre>
<p>But <code>drain_filter</code> is easier to use. <code>drain_filter</code> is also more efficient,
because it can backshift the elements of the array in bulk.</p>
<p>Note that <code>drain_filter</code> also lets you mutate every element in the filter closure,
regardless of whether you choose to keep or remove it.</p>
<h1 id="examples-30" class="section-header"><a href="#examples-30">Examples</a></h1>
<p>Splitting an array into evens and odds, reusing the original allocation:</p>
<pre class="rust rust-example-rendered">
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">drain_filter</span>)]</span>
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">numbers</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">8</span>, <span class="number">9</span>, <span class="number">11</span>, <span class="number">13</span>, <span class="number">14</span>, <span class="number">15</span>];
<span class="kw">let</span> <span class="ident">evens</span> <span class="op">=</span> <span class="ident">numbers</span>.<span class="ident">drain_filter</span>(<span class="op">|</span><span class="ident">x</span><span class="op">|</span> <span class="kw-2">*</span><span class="ident">x</span> <span class="op">%</span> <span class="number">2</span> <span class="op">==</span> <span class="number">0</span>).<span class="ident">collect</span>::<span class="op">&lt;</span><span class="ident">Vec</span><span class="op">&lt;</span>_<span class="op">&gt;&gt;</span>();
<span class="kw">let</span> <span class="ident">odds</span> <span class="op">=</span> <span class="ident">numbers</span>;
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">evens</span>, <span class="macro">vec</span><span class="macro">!</span>[<span class="number">2</span>, <span class="number">4</span>, <span class="number">6</span>, <span class="number">8</span>, <span class="number">14</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">odds</span>, <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">9</span>, <span class="number">11</span>, <span class="number">13</span>, <span class="number">15</span>]);</pre>
</div></div>
<h2 id='implementations' class='small-section-header'>
Trait Implementations<a href='#implementations' class='anchor'></a>
</h2>
<h3 id='impl-Clone' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../../hyper/header/struct.AcceptCharset.html" title="struct hyper::header::AcceptCharset">AcceptCharset</a></code><a href='#impl-Clone' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/header/common/mod.rs.html#229' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.clone' class="method"><span id='clone.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&amp;self) -&gt; <a class="struct" href="../../hyper/header/struct.AcceptCharset.html" title="struct hyper::header::AcceptCharset">AcceptCharset</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/header/common/mod.rs.html#229' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id='method.clone_from' class="method"><span id='clone_from.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/clone.rs.html#112-114' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div><h3 id='impl-Debug' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../hyper/header/struct.AcceptCharset.html" title="struct hyper::header::AcceptCharset">AcceptCharset</a></code><a href='#impl-Debug' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/header/common/mod.rs.html#229' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, __arg_0: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/header/common/mod.rs.html#229' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
</div></div><h3 id='impl-PartialEq' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a> for <a class="struct" href="../../hyper/header/struct.AcceptCharset.html" title="struct hyper::header::AcceptCharset">AcceptCharset</a></code><a href='#impl-PartialEq' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/header/common/mod.rs.html#229' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.eq' class="method"><span id='eq.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&amp;self, __arg_0: &amp;<a class="struct" href="../../hyper/header/struct.AcceptCharset.html" title="struct hyper::header::AcceptCharset">AcceptCharset</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/header/common/mod.rs.html#229' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
</div><h4 id='method.ne' class="method"><span id='ne.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&amp;self, __arg_0: &amp;<a class="struct" href="../../hyper/header/struct.AcceptCharset.html" title="struct hyper::header::AcceptCharset">AcceptCharset</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/header/common/mod.rs.html#229' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
</div></div><h3 id='impl-Deref' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a> for <a class="struct" href="../../hyper/header/struct.AcceptCharset.html" title="struct hyper::header::AcceptCharset">AcceptCharset</a></code><a href='#impl-Deref' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/header/common/mod.rs.html#104-111' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.Target' class="type"><span id='Target.t' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target' class="type">Target</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="../../hyper/header/struct.QualityItem.html" title="struct hyper::header::QualityItem">QualityItem</a>&lt;<a class="enum" href="../../hyper/header/enum.Charset.html" title="enum hyper::header::Charset">Charset</a>&gt;&gt;</code></span></h4>
<div class='docblock'><p>The resulting type after dereferencing.</p>
</div><h4 id='method.deref' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;</h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;</span></code></div></div><span id='deref.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#tymethod.deref' class='fnname'>deref</a>(&amp;self) -&gt; &amp;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="../../hyper/header/struct.QualityItem.html" title="struct hyper::header::QualityItem">QualityItem</a>&lt;<a class="enum" href="../../hyper/header/enum.Charset.html" title="enum hyper::header::Charset">Charset</a>&gt;&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/header/common/mod.rs.html#108-110' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Dereferences the value.</p>
</div></div><h3 id='impl-DerefMut' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a> for <a class="struct" href="../../hyper/header/struct.AcceptCharset.html" title="struct hyper::header::AcceptCharset">AcceptCharset</a></code><a href='#impl-DerefMut' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/header/common/mod.rs.html#113-118' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.deref_mut' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;</h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;</span></code></div></div><span id='deref_mut.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/deref/trait.DerefMut.html#tymethod.deref_mut' class='fnname'>deref_mut</a>(&amp;mut self) -&gt; &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="../../hyper/header/struct.QualityItem.html" title="struct hyper::header::QualityItem">QualityItem</a>&lt;<a class="enum" href="../../hyper/header/enum.Charset.html" title="enum hyper::header::Charset">Charset</a>&gt;&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/header/common/mod.rs.html#115-117' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Mutably dereferences the value.</p>
</div></div><h3 id='impl-Header' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../hyper/header/trait.Header.html" title="trait hyper::header::Header">Header</a> for <a class="struct" href="../../hyper/header/struct.AcceptCharset.html" title="struct hyper::header::AcceptCharset">AcceptCharset</a></code><a href='#impl-Header' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/header/common/mod.rs.html#232-246' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.header_name' class="method"><span id='header_name.v' class='invisible'><code>fn <a href='../../hyper/header/trait.Header.html#tymethod.header_name' class='fnname'>header_name</a>() -&gt; &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/header/common/mod.rs.html#234-237' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns the name of the header field this belongs to. <a href="../../hyper/header/trait.Header.html#tymethod.header_name">Read more</a></p>
</div><h4 id='method.parse_header' class="method"><span id='parse_header.v' class='invisible'><code>fn <a href='../../hyper/header/trait.Header.html#tymethod.parse_header' class='fnname'>parse_header</a>(raw: &amp;<a class="struct" href="../../hyper/header/struct.Raw.html" title="struct hyper::header::Raw">Raw</a>) -&gt; <a class="type" href="../../hyper/error/type.Result.html" title="type hyper::error::Result">Result</a>&lt;Self&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/header/common/mod.rs.html#239-241' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Parse a header from a raw stream of bytes. <a href="../../hyper/header/trait.Header.html#tymethod.parse_header">Read more</a></p>
</div><h4 id='method.fmt_header' class="method"><span id='fmt_header.v' class='invisible'><code>fn <a href='../../hyper/header/trait.Header.html#tymethod.fmt_header' class='fnname'>fmt_header</a>(&amp;self, f: &amp;mut <a class="struct" href="../../hyper/header/struct.Formatter.html" title="struct hyper::header::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/header/common/mod.rs.html#243-245' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Format a header to outgoing stream. <a href="../../hyper/header/trait.Header.html#tymethod.fmt_header">Read more</a></p>
</div></div><h3 id='impl-Display' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="../../hyper/header/struct.AcceptCharset.html" title="struct hyper::header::AcceptCharset">AcceptCharset</a></code><a href='#impl-Display' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/header/common/mod.rs.html#247-252' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.fmt-1' class="method"><span id='fmt.v-1' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/header/common/mod.rs.html#249-251' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></p>
</div></div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt><kbd>?</kbd></dt>
<dd>Show this help dialog</dd>
<dt><kbd>S</kbd></dt>
<dd>Focus the search field</dd>
<dt><kbd></kbd></dt>
<dd>Move up in search results</dd>
<dt><kbd></kbd></dt>
<dd>Move down in search results</dd>
<dt><kbd></kbd></dt>
<dd>Switch tab</dd>
<dt><kbd>&#9166;</kbd></dt>
<dd>Go to active search result</dd>
<dt><kbd>+</kbd></dt>
<dd>Expand all sections</dd>
<dt><kbd>-</kbd></dt>
<dd>Collapse all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../";
window.currentCrate = "hyper";
</script>
<script src="../../main.js"></script>
<script defer src="../../search-index.js"></script>
</body>
</html>