320 lines
120 KiB
HTML
320 lines
120 KiB
HTML
<!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="A `Vec`-like container that can store a small number of elements inline."><meta name="keywords" content="rust, rustlang, rust-lang, SmallVec"><title>smallvec::SmallVec - 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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings"></script><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../favicon.svg">
|
||
<link rel="alternate icon" type="image/png" href="../favicon-16x16.png">
|
||
<link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></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">☰</div><a href='../smallvec/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><p class="location">Struct SmallVec</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.append">append</a><a href="#method.as_mut_ptr">as_mut_ptr</a><a href="#method.as_mut_slice">as_mut_slice</a><a href="#method.as_ptr">as_ptr</a><a href="#method.as_slice">as_slice</a><a href="#method.capacity">capacity</a><a href="#method.clear">clear</a><a href="#method.dedup">dedup</a><a href="#method.dedup_by">dedup_by</a><a href="#method.dedup_by_key">dedup_by_key</a><a href="#method.drain">drain</a><a href="#method.extend_from_slice">extend_from_slice</a><a href="#method.from_buf">from_buf</a><a href="#method.from_buf_and_len">from_buf_and_len</a><a href="#method.from_buf_and_len_unchecked">from_buf_and_len_unchecked</a><a href="#method.from_elem">from_elem</a><a href="#method.from_raw_parts">from_raw_parts</a><a href="#method.from_slice">from_slice</a><a href="#method.from_vec">from_vec</a><a href="#method.grow">grow</a><a href="#method.inline_size">inline_size</a><a href="#method.insert">insert</a><a href="#method.insert_from_slice">insert_from_slice</a><a href="#method.insert_many">insert_many</a><a href="#method.into_boxed_slice">into_boxed_slice</a><a href="#method.into_inner">into_inner</a><a href="#method.into_vec">into_vec</a><a href="#method.is_empty">is_empty</a><a href="#method.len">len</a><a href="#method.new">new</a><a href="#method.pop">pop</a><a href="#method.push">push</a><a href="#method.remove">remove</a><a href="#method.reserve">reserve</a><a href="#method.reserve_exact">reserve_exact</a><a href="#method.resize">resize</a><a href="#method.resize_with">resize_with</a><a href="#method.retain">retain</a><a href="#method.set_len">set_len</a><a href="#method.shrink_to_fit">shrink_to_fit</a><a href="#method.spilled">spilled</a><a href="#method.swap_remove">swap_remove</a><a href="#method.truncate">truncate</a><a href="#method.try_grow">try_grow</a><a href="#method.try_reserve">try_reserve</a><a href="#method.try_reserve_exact">try_reserve_exact</a><a href="#method.with_capacity">with_capacity</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-AsMut%3C%5B%3CA%20as%20Array%3E%3A%3AItem%5D%3E">AsMut<[<A as Array>::Item]></a><a href="#impl-AsRef%3C%5B%3CA%20as%20Array%3E%3A%3AItem%5D%3E">AsRef<[<A as Array>::Item]></a><a href="#impl-Borrow%3C%5B%3CA%20as%20Array%3E%3A%3AItem%5D%3E">Borrow<[<A as Array>::Item]></a><a href="#impl-BorrowMut%3C%5B%3CA%20as%20Array%3E%3A%3AItem%5D%3E">BorrowMut<[<A as Array>::Item]></a><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a><a href="#impl-Default">Default</a><a href="#impl-Deref">Deref</a><a href="#impl-DerefMut">DerefMut</a><a href="#impl-Drop">Drop</a><a href="#impl-Eq">Eq</a><a href="#impl-Extend%3C%3CA%20as%20Array%3E%3A%3AItem%3E">Extend<<A as Array>::Item></a><a href="#impl-From%3C%26%27a%20%5B%3CA%20as%20Array%3E%3A%3AItem%5D%3E">From<&'a [<A as Array>::Item]></a><a href="#impl-From%3CA%3E">From<A></a><a href="#impl-From%3CVec%3C%3CA%20as%20Array%3E%3A%3AItem%2C%20Global%3E%3E">From<Vec<<A as Array>::Item, Global>></a><a href="#impl-FromIterator%3C%3CA%20as%20Array%3E%3A%3AItem%3E">FromIterator<<A as Array>::Item></a><a href="#impl-Hash">Hash</a><a href="#impl-Index%3CI%3E">Index<I></a><a href="#impl-IndexMut%3CI%3E">IndexMut<I></a><a href="#impl-IntoIterator">IntoIterator</a><a href="#impl-Ord">Ord</a><a href="#impl-PartialEq%3CSmallVec%3CB%3E%3E">PartialEq<SmallVec<B>></a><a href="#impl-PartialOrd%3CSmallVec%3CA%3E%3E">PartialOrd<SmallVec<A>></a><a href="#impl-Send">Send</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3C!%3E">From<!></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><p class="location"><a href="index.html">smallvec</a></p><div id="sidebar-vars" data-name="SmallVec" data-ty="struct" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" class="help-button">?</button>
|
||
<a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Struct <a href="index.html">smallvec</a>::<wbr><a class="struct" href="">SmallVec</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">−</span>]</a></span><a class="srclink" href="../src/smallvec/lib.rs.html#474-480" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust struct">pub struct SmallVec<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> { /* fields omitted */ }</pre></div><div class="docblock"><p>A <code>Vec</code>-like container that can store a small number of elements inline.</p>
|
||
<p><code>SmallVec</code> acts like a vector, but can store a limited amount of data inline within the
|
||
<code>SmallVec</code> struct rather than in a separate allocation. If the data exceeds this limit, the
|
||
<code>SmallVec</code> will “spill” its data onto the heap, allocating a new buffer to hold it.</p>
|
||
<p>The amount of data that a <code>SmallVec</code> can store inline depends on its backing store. The backing
|
||
store can be any type that implements the <code>Array</code> trait; usually it is a small fixed-sized
|
||
array. For example a <code>SmallVec<[u64; 8]></code> can hold up to eight 64-bit integers inline.</p>
|
||
<h2 id="example" class="section-header"><a href="#example">Example</a></h2>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">smallvec</span>::<span class="ident">SmallVec</span>;
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">v</span> <span class="op">=</span> <span class="ident">SmallVec</span>::<span class="op"><</span>[<span class="ident">u8</span>; <span class="number">4</span>]<span class="op">></span>::<span class="ident">new</span>(); <span class="comment">// initialize an empty vector</span>
|
||
|
||
<span class="comment">// The vector can hold up to 4 items without spilling onto the heap.</span>
|
||
<span class="ident">v</span>.<span class="ident">extend</span>(<span class="number">0</span>..<span class="number">4</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">len</span>(), <span class="number">4</span>);
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">v</span>.<span class="ident">spilled</span>());
|
||
|
||
<span class="comment">// Pushing another element will force the buffer to spill:</span>
|
||
<span class="ident">v</span>.<span class="ident">push</span>(<span class="number">4</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">len</span>(), <span class="number">5</span>);
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">spilled</span>());</pre></div>
|
||
</div><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><h3 id="impl" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a href="#impl" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#482-1332" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a>() -> <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a class="srclink" href="../src/smallvec/lib.rs.html#485-496" title="goto source code">[src]</a></h4><div class="docblock"><p>Construct an empty vector</p>
|
||
</div><h4 id="method.with_capacity" class="method"><code>pub fn <a href="#method.with_capacity" class="fnname">with_capacity</a>(n: usize) -> Self</code><a class="srclink" href="../src/smallvec/lib.rs.html#512-516" title="goto source code">[src]</a></h4><div class="docblock"><p>Construct an empty vector with enough capacity pre-allocated to store at least <code>n</code>
|
||
elements.</p>
|
||
<p>Will create a heap allocation only if <code>n</code> is larger than the inline capacity.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
|
||
<span class="kw">let</span> <span class="ident">v</span>: <span class="ident">SmallVec</span><span class="op"><</span>[<span class="ident">u8</span>; <span class="number">3</span>]<span class="op">></span> <span class="op">=</span> <span class="ident">SmallVec</span>::<span class="ident">with_capacity</span>(<span class="number">100</span>);
|
||
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">is_empty</span>());
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">capacity</span>() <span class="op">></span><span class="op">=</span> <span class="number">100</span>);</pre></div>
|
||
</div><h4 id="method.from_vec" class="method"><code>pub fn <a href="#method.from_vec" class="fnname">from_vec</a>(vec: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>>) -> <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a class="srclink" href="../src/smallvec/lib.rs.html#531-553" title="goto source code">[src]</a></h4><div class="docblock"><p>Construct a new <code>SmallVec</code> from a <code>Vec<A::Item></code>.</p>
|
||
<p>Elements will be copied to the inline buffer if vec.capacity() <= Self::inline_capacity().</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">smallvec</span>::<span class="ident">SmallVec</span>;
|
||
|
||
<span class="kw">let</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="kw">let</span> <span class="ident">small_vec</span>: <span class="ident">SmallVec</span><span class="op"><</span>[<span class="kw">_</span>; <span class="number">3</span>]<span class="op">></span> <span class="op">=</span> <span class="ident">SmallVec</span>::<span class="ident">from_vec</span>(<span class="ident">vec</span>);
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="kw-2">*</span><span class="ident">small_vec</span>, <span class="kw-2">&</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>]);</pre></div>
|
||
</div><h4 id="method.from_buf" class="method"><code>pub fn <a href="#method.from_buf" class="fnname">from_buf</a>(buf: A) -> <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a class="srclink" href="../src/smallvec/lib.rs.html#567-572" title="goto source code">[src]</a></h4><div class="docblock"><p>Constructs a new <code>SmallVec</code> on the stack from an <code>A</code> without
|
||
copying elements.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">smallvec</span>::<span class="ident">SmallVec</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">buf</span> <span class="op">=</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="kw">let</span> <span class="ident">small_vec</span>: <span class="ident">SmallVec</span><span class="op"><</span><span class="kw">_</span><span class="op">></span> <span class="op">=</span> <span class="ident">SmallVec</span>::<span class="ident">from_buf</span>(<span class="ident">buf</span>);
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="kw-2">*</span><span class="ident">small_vec</span>, <span class="kw-2">&</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>]);</pre></div>
|
||
</div><h4 id="method.from_buf_and_len" class="method"><code>pub fn <a href="#method.from_buf_and_len" class="fnname">from_buf_and_len</a>(buf: A, len: usize) -> <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a class="srclink" href="../src/smallvec/lib.rs.html#587-590" title="goto source code">[src]</a></h4><div class="docblock"><p>Constructs a new <code>SmallVec</code> on the stack from an <code>A</code> without
|
||
copying elements. Also sets the length, which must be less or
|
||
equal to the size of <code>buf</code>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">smallvec</span>::<span class="ident">SmallVec</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">buf</span> <span class="op">=</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">0</span>, <span class="number">0</span>, <span class="number">0</span>];
|
||
<span class="kw">let</span> <span class="ident">small_vec</span>: <span class="ident">SmallVec</span><span class="op"><</span><span class="kw">_</span><span class="op">></span> <span class="op">=</span> <span class="ident">SmallVec</span>::<span class="ident">from_buf_and_len</span>(<span class="ident">buf</span>, <span class="number">5</span>);
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="kw-2">*</span><span class="ident">small_vec</span>, <span class="kw-2">&</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>]);</pre></div>
|
||
</div><h4 id="method.from_buf_and_len_unchecked" class="method"><code>pub unsafe fn <a href="#method.from_buf_and_len_unchecked" class="fnname">from_buf_and_len_unchecked</a>(<br> buf: <a class="union" href="https://doc.rust-lang.org/nightly/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a><A>, <br> len: usize<br>) -> <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a class="srclink" href="../src/smallvec/lib.rs.html#608-613" title="goto source code">[src]</a></h4><div class="docblock"><p>Constructs a new <code>SmallVec</code> on the stack from an <code>A</code> without
|
||
copying elements. Also sets the length. The user is responsible
|
||
for ensuring that <code>len <= A::size()</code>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">smallvec</span>::<span class="ident">SmallVec</span>;
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">mem</span>::<span class="ident">MaybeUninit</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">buf</span> <span class="op">=</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">0</span>, <span class="number">0</span>, <span class="number">0</span>];
|
||
<span class="kw">let</span> <span class="ident">small_vec</span>: <span class="ident">SmallVec</span><span class="op"><</span><span class="kw">_</span><span class="op">></span> <span class="op">=</span> <span class="kw">unsafe</span> {
|
||
<span class="ident">SmallVec</span>::<span class="ident">from_buf_and_len_unchecked</span>(<span class="ident">MaybeUninit</span>::<span class="ident">new</span>(<span class="ident">buf</span>), <span class="number">5</span>)
|
||
};
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="kw-2">*</span><span class="ident">small_vec</span>, <span class="kw-2">&</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>]);</pre></div>
|
||
</div><h4 id="method.set_len" class="method"><code>pub unsafe fn <a href="#method.set_len" class="fnname">set_len</a>(&mut self, new_len: usize)</code><a class="srclink" href="../src/smallvec/lib.rs.html#620-623" title="goto source code">[src]</a></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>
|
||
</div><h4 id="method.inline_size" class="method"><code>pub fn <a href="#method.inline_size" class="fnname">inline_size</a>(&self) -> usize</code><a class="srclink" href="../src/smallvec/lib.rs.html#647-649" title="goto source code">[src]</a></h4><div class="docblock"><p>The maximum number of elements this vector can hold inline</p>
|
||
</div><h4 id="method.len" class="method"><code>pub fn <a href="#method.len" class="fnname">len</a>(&self) -> usize</code><a class="srclink" href="../src/smallvec/lib.rs.html#653-655" title="goto source code">[src]</a></h4><div class="docblock"><p>The number of elements stored in the vector</p>
|
||
</div><h4 id="method.is_empty" class="method"><code>pub fn <a href="#method.is_empty" class="fnname">is_empty</a>(&self) -> bool</code><a class="srclink" href="../src/smallvec/lib.rs.html#659-661" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns <code>true</code> if the vector is empty</p>
|
||
</div><h4 id="method.capacity" class="method"><code>pub fn <a href="#method.capacity" class="fnname">capacity</a>(&self) -> usize</code><a class="srclink" href="../src/smallvec/lib.rs.html#665-667" title="goto source code">[src]</a></h4><div class="docblock"><p>The number of items the vector can hold without reallocating</p>
|
||
</div><h4 id="method.spilled" class="method"><code>pub fn <a href="#method.spilled" class="fnname">spilled</a>(&self) -> bool</code><a class="srclink" href="../src/smallvec/lib.rs.html#702-704" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns <code>true</code> if the data has spilled into a separate heap-allocated buffer.</p>
|
||
</div><h4 id="method.drain" class="method"><code>pub fn <a href="#method.drain" class="fnname">drain</a><R>(&mut self, range: R) -> <a class="struct" href="../smallvec/struct.Drain.html" title="struct smallvec::Drain">Drain</a><'_, A><span class="notable-traits"><span class="notable-traits-tooltip">ⓘ<div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="struct" href="../smallvec/struct.Drain.html" title="struct smallvec::Drain">Drain</a><'a, T></h3><code class="content"><span class="where fmt-newline">impl<'a, T: 'a + <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="../smallvec/struct.Drain.html" title="struct smallvec::Drain">Drain</a><'a, T></span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" class="type">Item</a> = T::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>;</span></code></span></div></span></span> <span class="where fmt-newline">where<br> R: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/range/trait.RangeBounds.html" title="trait core::ops::range::RangeBounds">RangeBounds</a><usize>, </span></code><a class="srclink" href="../src/smallvec/lib.rs.html#719-752" title="goto source code">[src]</a></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" class="section-header"><a href="#panics">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>
|
||
</div><h4 id="method.push" class="method"><code>pub fn <a href="#method.push" class="fnname">push</a>(&mut self, value: A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>)</code><a class="srclink" href="../src/smallvec/lib.rs.html#756-768" title="goto source code">[src]</a></h4><div class="docblock"><p>Append an item to the vector.</p>
|
||
</div><h4 id="method.pop" class="method"><code>pub fn <a href="#method.pop" class="fnname">pop</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>></code><a class="srclink" href="../src/smallvec/lib.rs.html#772-782" title="goto source code">[src]</a></h4><div class="docblock"><p>Remove an item from the end of the vector and return it, or None if empty.</p>
|
||
</div><h4 id="method.append" class="method"><code>pub fn <a href="#method.append" class="fnname">append</a><B>(&mut self, other: &mut <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><B>) <span class="where fmt-newline">where<br> B: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a><Item = A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>>, </span></code><a class="srclink" href="../src/smallvec/lib.rs.html#796-801" title="goto source code">[src]</a></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="example-1" class="section-header"><a href="#example-1">Example</a></h1>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">v0</span>: <span class="ident">SmallVec</span><span class="op"><</span>[<span class="ident">u8</span>; <span class="number">16</span>]<span class="op">></span> <span class="op">=</span> <span class="macro">smallvec</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">v1</span>: <span class="ident">SmallVec</span><span class="op"><</span>[<span class="ident">u8</span>; <span class="number">32</span>]<span class="op">></span> <span class="op">=</span> <span class="macro">smallvec</span><span class="macro">!</span>[<span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>];
|
||
<span class="ident">v0</span>.<span class="ident">append</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">v1</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">*</span><span class="ident">v0</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="kw-2">*</span><span class="ident">v1</span>, []);</pre></div>
|
||
</div><h4 id="method.grow" class="method"><code>pub fn <a href="#method.grow" class="fnname">grow</a>(&mut self, new_cap: usize)</code><a class="srclink" href="../src/smallvec/lib.rs.html#807-809" title="goto source code">[src]</a></h4><div class="docblock"><p>Re-allocate to set the capacity to <code>max(new_cap, inline_size())</code>.</p>
|
||
<p>Panics if <code>new_cap</code> is less than the vector’s length
|
||
or if the capacity computation overflows <code>usize</code>.</p>
|
||
</div><h4 id="method.try_grow" class="method"><code>pub fn <a href="#method.try_grow" class="fnname">try_grow</a>(&mut self, new_cap: usize) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(), <a class="enum" href="../smallvec/enum.CollectionAllocErr.html" title="enum smallvec::CollectionAllocErr">CollectionAllocErr</a>></code><a class="srclink" href="../src/smallvec/lib.rs.html#814-853" title="goto source code">[src]</a></h4><div class="docblock"><p>Re-allocate to set the capacity to <code>max(new_cap, inline_size())</code>.</p>
|
||
<p>Panics if <code>new_cap</code> is less than the vector’s length</p>
|
||
</div><h4 id="method.reserve" class="method"><code>pub fn <a href="#method.reserve" class="fnname">reserve</a>(&mut self, additional: usize)</code><a class="srclink" href="../src/smallvec/lib.rs.html#861-863" title="goto source code">[src]</a></h4><div class="docblock"><p>Reserve capacity for <code>additional</code> more elements to be inserted.</p>
|
||
<p>May reserve more space to avoid frequent reallocations.</p>
|
||
<p>Panics if the capacity computation overflows <code>usize</code>.</p>
|
||
</div><h4 id="method.try_reserve" class="method"><code>pub fn <a href="#method.try_reserve" class="fnname">try_reserve</a>(<br> &mut self, <br> additional: usize<br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(), <a class="enum" href="../smallvec/enum.CollectionAllocErr.html" title="enum smallvec::CollectionAllocErr">CollectionAllocErr</a>></code><a class="srclink" href="../src/smallvec/lib.rs.html#868-881" title="goto source code">[src]</a></h4><div class="docblock"><p>Reserve capacity for <code>additional</code> more elements to be inserted.</p>
|
||
<p>May reserve more space to avoid frequent reallocations.</p>
|
||
</div><h4 id="method.reserve_exact" class="method"><code>pub fn <a href="#method.reserve_exact" class="fnname">reserve_exact</a>(&mut self, additional: usize)</code><a class="srclink" href="../src/smallvec/lib.rs.html#886-888" title="goto source code">[src]</a></h4><div class="docblock"><p>Reserve the minimum capacity for <code>additional</code> more elements to be inserted.</p>
|
||
<p>Panics if the new capacity overflows <code>usize</code>.</p>
|
||
</div><h4 id="method.try_reserve_exact" class="method"><code>pub fn <a href="#method.try_reserve_exact" class="fnname">try_reserve_exact</a>(<br> &mut self, <br> additional: usize<br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(), <a class="enum" href="../smallvec/enum.CollectionAllocErr.html" title="enum smallvec::CollectionAllocErr">CollectionAllocErr</a>></code><a class="srclink" href="../src/smallvec/lib.rs.html#891-900" title="goto source code">[src]</a></h4><div class="docblock"><p>Reserve the minimum capacity for <code>additional</code> more elements to be inserted.</p>
|
||
</div><h4 id="method.shrink_to_fit" class="method"><code>pub fn <a href="#method.shrink_to_fit" class="fnname">shrink_to_fit</a>(&mut self)</code><a class="srclink" href="../src/smallvec/lib.rs.html#906-922" title="goto source code">[src]</a></h4><div class="docblock"><p>Shrink the capacity of the vector as much as possible.</p>
|
||
<p>When possible, this will move data from an external heap buffer to the vector’s inline
|
||
storage.</p>
|
||
</div><h4 id="method.truncate" class="method"><code>pub fn <a href="#method.truncate" class="fnname">truncate</a>(&mut self, len: usize)</code><a class="srclink" href="../src/smallvec/lib.rs.html#931-940" title="goto source code">[src]</a></h4><div class="docblock"><p>Shorten the vector, keeping the first <code>len</code> elements and dropping the rest.</p>
|
||
<p>If <code>len</code> is greater than or equal to the vector’s current length, this has no
|
||
effect.</p>
|
||
<p>This does not re-allocate. If you want the vector’s capacity to shrink, call
|
||
<code>shrink_to_fit</code> after truncating.</p>
|
||
</div><h4 id="method.as_slice" class="method"><code>pub fn <a href="#method.as_slice" class="fnname">as_slice</a>(&self) -> &[A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>]</code><a class="srclink" href="../src/smallvec/lib.rs.html#945-947" title="goto source code">[src]</a></h4><div class="docblock"><p>Extracts a slice containing the entire vector.</p>
|
||
<p>Equivalent to <code>&s[..]</code>.</p>
|
||
</div><h4 id="method.as_mut_slice" class="method"><code>pub fn <a href="#method.as_mut_slice" class="fnname">as_mut_slice</a>(&mut self) -> &mut [A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>]</code><a class="srclink" href="../src/smallvec/lib.rs.html#952-954" title="goto source code">[src]</a></h4><div class="docblock"><p>Extracts a mutable slice of the entire vector.</p>
|
||
<p>Equivalent to <code>&mut s[..]</code>.</p>
|
||
</div><h4 id="method.swap_remove" class="method"><code>pub fn <a href="#method.swap_remove" class="fnname">swap_remove</a>(&mut self, index: usize) -> A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a></code><a class="srclink" href="../src/smallvec/lib.rs.html#962-967" title="goto source code">[src]</a></h4><div class="docblock"><p>Remove the element at position <code>index</code>, replacing it with the last element.</p>
|
||
<p>This does not preserve ordering, but is O(1).</p>
|
||
<p>Panics if <code>index</code> is out of bounds.</p>
|
||
</div><h4 id="method.clear" class="method"><code>pub fn <a href="#method.clear" class="fnname">clear</a>(&mut self)</code><a class="srclink" href="../src/smallvec/lib.rs.html#971-973" title="goto source code">[src]</a></h4><div class="docblock"><p>Remove all elements from the vector.</p>
|
||
</div><h4 id="method.remove" class="method"><code>pub fn <a href="#method.remove" class="fnname">remove</a>(&mut self, index: usize) -> A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a></code><a class="srclink" href="../src/smallvec/lib.rs.html#979-990" title="goto source code">[src]</a></h4><div class="docblock"><p>Remove and return the element at position <code>index</code>, shifting all elements after it to the
|
||
left.</p>
|
||
<p>Panics if <code>index</code> is out of bounds.</p>
|
||
</div><h4 id="method.insert" class="method"><code>pub fn <a href="#method.insert" class="fnname">insert</a>(&mut self, index: usize, element: A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>)</code><a class="srclink" href="../src/smallvec/lib.rs.html#995-1007" title="goto source code">[src]</a></h4><div class="docblock"><p>Insert an element at position <code>index</code>, shifting all elements after it to the right.</p>
|
||
<p>Panics if <code>index</code> is out of bounds.</p>
|
||
</div><h4 id="method.insert_many" class="method"><code>pub fn <a href="#method.insert_many" class="fnname">insert_many</a><I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>>>(<br> &mut self, <br> index: usize, <br> iterable: I<br>)</code><a class="srclink" href="../src/smallvec/lib.rs.html#1011-1089" title="goto source code">[src]</a></h4><div class="docblock"><p>Insert multiple elements at position <code>index</code>, shifting all following elements toward the
|
||
back.</p>
|
||
</div><h4 id="method.into_vec" class="method"><code>pub fn <a href="#method.into_vec" class="fnname">into_vec</a>(self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>></code><a class="srclink" href="../src/smallvec/lib.rs.html#1093-1104" title="goto source code">[src]</a></h4><div class="docblock"><p>Convert a SmallVec to a Vec, without reallocating if the SmallVec has already spilled onto
|
||
the heap.</p>
|
||
</div><h4 id="method.into_boxed_slice" class="method"><code>pub fn <a href="#method.into_boxed_slice" class="fnname">into_boxed_slice</a>(self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><[A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>]></code><a class="srclink" href="../src/smallvec/lib.rs.html#1110-1112" title="goto source code">[src]</a></h4><div class="docblock"><p>Converts a <code>SmallVec</code> into a <code>Box<[T]></code> without reallocating if the <code>SmallVec</code> has already spilled
|
||
onto the heap.</p>
|
||
<p>Note that this will drop any excess capacity.</p>
|
||
</div><h4 id="method.into_inner" class="method"><code>pub fn <a href="#method.into_inner" class="fnname">into_inner</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><A, Self></code><a class="srclink" href="../src/smallvec/lib.rs.html#1118-1129" title="goto source code">[src]</a></h4><div class="docblock"><p>Convert the SmallVec into an <code>A</code> if possible. Otherwise return <code>Err(Self)</code>.</p>
|
||
<p>This method returns <code>Err(Self)</code> if the SmallVec is too short (and the <code>A</code> contains uninitialized elements),
|
||
or if the SmallVec is too long (and all the elements were spilled to the heap).</p>
|
||
</div><h4 id="method.retain" class="method"><code>pub fn <a href="#method.retain" class="fnname">retain</a><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>(&mut A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>) -> bool>(&mut self, f: F)</code><a class="srclink" href="../src/smallvec/lib.rs.html#1136-1147" title="goto source code">[src]</a></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(&e)</code> returns <code>false</code>.
|
||
This method operates in place and preserves the order of the retained
|
||
elements.</p>
|
||
</div><h4 id="method.dedup" class="method"><code>pub fn <a href="#method.dedup" class="fnname">dedup</a>(&mut self) <span class="where fmt-newline">where<br> A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>>, </span></code><a class="srclink" href="../src/smallvec/lib.rs.html#1150-1155" title="goto source code">[src]</a></h4><div class="docblock"><p>Removes consecutive duplicate elements.</p>
|
||
</div><h4 id="method.dedup_by" class="method"><code>pub fn <a href="#method.dedup_by" class="fnname">dedup_by</a><F>(&mut self, same_bucket: F) <span class="where fmt-newline">where<br> 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>(&mut A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>, &mut A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>) -> bool, </span></code><a class="srclink" href="../src/smallvec/lib.rs.html#1158-1187" title="goto source code">[src]</a></h4><div class="docblock"><p>Removes consecutive duplicate elements using the given equality relation.</p>
|
||
</div><h4 id="method.dedup_by_key" class="method"><code>pub fn <a href="#method.dedup_by_key" class="fnname">dedup_by_key</a><F, K>(&mut self, key: F) <span class="where fmt-newline">where<br> 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>(&mut A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>) -> K,<br> K: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><K>, </span></code><a class="srclink" href="../src/smallvec/lib.rs.html#1190-1196" title="goto source code">[src]</a></h4><div class="docblock"><p>Removes consecutive elements that map to the same key.</p>
|
||
</div><h4 id="method.resize_with" class="method"><code>pub fn <a href="#method.resize_with" class="fnname">resize_with</a><F>(&mut self, new_len: usize, f: F) <span class="where fmt-newline">where<br> 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::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>, </span></code><a class="srclink" href="../src/smallvec/lib.rs.html#1223-1238" title="goto source code">[src]</a></h4><div class="docblock"><p>Resizes the <code>SmallVec</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>SmallVec</code> is extended by the difference, with each
|
||
additional slot filled with the result of calling the closure <code>f</code>. The return values from <code>f</code></p>
|
||
<p>If <code>new_len</code> is less than <code>len</code>, the <code>SmallVec</code> is simply truncated.</p>
|
||
<p>This method uses a closure to create new values on every push. If you’d rather <code>Clone</code> a given
|
||
value, use <code>resize</code>. If you want to use the <code>Default</code> trait to generate values, you can pass
|
||
<code>Default::default()</code> as the second argument.</p>
|
||
<p>Added for std::vec::Vec compatibility (added in Rust 1.33.0)</p>
|
||
|
||
<div class="example-wrap"><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">SmallVec</span><span class="op"><</span>[<span class="kw">_</span>; <span class="number">4</span>]<span class="op">></span> <span class="op">=</span> <span class="macro">smallvec</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_with</span>(<span class="number">5</span>, <span class="ident">Default</span>::<span class="ident">default</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="kw-2">*</span><span class="ident">vec</span>, <span class="kw-2">&</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="ident">SmallVec</span><span class="op"><</span>[<span class="kw">_</span>; <span class="number">4</span>]<span class="op">></span> <span class="op">=</span> <span class="macro">smallvec</span><span class="macro">!</span>[];
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">p</span> <span class="op">=</span> <span class="number">1</span>;
|
||
<span class="ident">vec</span>.<span class="ident">resize_with</span>(<span class="number">4</span>, <span class="op">|</span><span class="op">|</span> { <span class="ident">p</span> <span class="kw-2">*</span><span class="op">=</span> <span class="number">2</span>; <span class="ident">p</span> });
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="kw-2">*</span><span class="ident">vec</span>, <span class="kw-2">&</span>[<span class="number">2</span>, <span class="number">4</span>, <span class="number">8</span>, <span class="number">16</span>]);</pre></div>
|
||
</div><h4 id="method.from_raw_parts" class="method"><code>pub unsafe fn <a href="#method.from_raw_parts" class="fnname">from_raw_parts</a>(<br> ptr: *mut A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>, <br> length: usize, <br> capacity: usize<br>) -> <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a class="srclink" href="../src/smallvec/lib.rs.html#1309-1315" title="goto source code">[src]</a></h4><div class="docblock"><p>Creates a <code>SmallVec</code> directly from the raw components of another
|
||
<code>SmallVec</code>.</p>
|
||
<h1 id="safety" class="section-header"><a href="#safety">Safety</a></h1>
|
||
<p>This is highly unsafe, due to the number of invariants that aren’t
|
||
checked:</p>
|
||
<ul>
|
||
<li><code>ptr</code> needs to have been previously allocated via <code>SmallVec</code> for its
|
||
spilled storage (at least, it’s highly likely to be incorrect if it
|
||
wasn’t).</li>
|
||
<li><code>ptr</code>’s <code>A::Item</code> type needs to be the same size and alignment that
|
||
it was allocated with</li>
|
||
<li><code>length</code> needs to be less than or equal to <code>capacity</code>.</li>
|
||
<li><code>capacity</code> needs to be the capacity that the pointer was allocated
|
||
with.</li>
|
||
</ul>
|
||
<p>Violating these may cause problems like corrupting the allocator’s
|
||
internal data structures.</p>
|
||
<p>Additionally, <code>capacity</code> must be greater than the amount of inline
|
||
storage <code>A</code> has; that is, the new <code>SmallVec</code> must need to spill over
|
||
into heap allocated storage. This condition is asserted against.</p>
|
||
<p>The ownership of <code>ptr</code> is effectively transferred to the
|
||
<code>SmallVec</code> which may then deallocate, reallocate or change the
|
||
contents of memory pointed to by the pointer at will. Ensure
|
||
that nothing else uses the pointer after calling this
|
||
function.</p>
|
||
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">mem</span>;
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">ptr</span>;
|
||
|
||
<span class="kw">fn</span> <span class="ident">main</span>() {
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">v</span>: <span class="ident">SmallVec</span><span class="op"><</span>[<span class="kw">_</span>; <span class="number">1</span>]<span class="op">></span> <span class="op">=</span> <span class="macro">smallvec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
|
||
|
||
<span class="comment">// Pull out the important parts of `v`.</span>
|
||
<span class="kw">let</span> <span class="ident">p</span> <span class="op">=</span> <span class="ident">v</span>.<span class="ident">as_mut_ptr</span>();
|
||
<span class="kw">let</span> <span class="ident">len</span> <span class="op">=</span> <span class="ident">v</span>.<span class="ident">len</span>();
|
||
<span class="kw">let</span> <span class="ident">cap</span> <span class="op">=</span> <span class="ident">v</span>.<span class="ident">capacity</span>();
|
||
<span class="kw">let</span> <span class="ident">spilled</span> <span class="op">=</span> <span class="ident">v</span>.<span class="ident">spilled</span>();
|
||
|
||
<span class="kw">unsafe</span> {
|
||
<span class="comment">// Forget all about `v`. The heap allocation that stored the</span>
|
||
<span class="comment">// three values won't be deallocated.</span>
|
||
<span class="ident">mem</span>::<span class="ident">forget</span>(<span class="ident">v</span>);
|
||
|
||
<span class="comment">// Overwrite memory with [4, 5, 6].</span>
|
||
<span class="comment">//</span>
|
||
<span class="comment">// This is only safe if `spilled` is true! Otherwise, we are</span>
|
||
<span class="comment">// writing into the old `SmallVec`'s inline storage on the</span>
|
||
<span class="comment">// stack.</span>
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">spilled</span>);
|
||
<span class="kw">for</span> <span class="ident">i</span> <span class="kw">in</span> <span class="number">0</span>..<span class="ident">len</span> {
|
||
<span class="ident">ptr</span>::<span class="ident">write</span>(<span class="ident">p</span>.<span class="ident">add</span>(<span class="ident">i</span>), <span class="number">4</span> <span class="op">+</span> <span class="ident">i</span>);
|
||
}
|
||
|
||
<span class="comment">// Put everything back together into a SmallVec with a different</span>
|
||
<span class="comment">// amount of inline storage, but which is still less than `cap`.</span>
|
||
<span class="kw">let</span> <span class="ident">rebuilt</span> <span class="op">=</span> <span class="ident">SmallVec</span>::<span class="op"><</span>[<span class="kw">_</span>; <span class="number">2</span>]<span class="op">></span>::<span class="ident">from_raw_parts</span>(<span class="ident">p</span>, <span class="ident">len</span>, <span class="ident">cap</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="kw-2">*</span><span class="ident">rebuilt</span>, <span class="kw-2">&</span>[<span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]);
|
||
}
|
||
}</pre></div>
|
||
</div><h4 id="method.as_ptr" class="method"><code>pub fn <a href="#method.as_ptr" class="fnname">as_ptr</a>(&self) -> *const A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a></code><a class="srclink" href="../src/smallvec/lib.rs.html#1318-1323" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns a raw pointer to the vector’s buffer.</p>
|
||
</div><h4 id="method.as_mut_ptr" class="method"><code>pub fn <a href="#method.as_mut_ptr" class="fnname">as_mut_ptr</a>(&mut self) -> *mut A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a></code><a class="srclink" href="../src/smallvec/lib.rs.html#1326-1331" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns a raw mutable pointer to the vector’s buffer.</p>
|
||
</div></div><h3 id="impl-1" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A> <span class="where fmt-newline">where<br> A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a>, </span></code><a href="#impl-1" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1334-1394" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from_slice" class="method"><code>pub fn <a href="#method.from_slice" class="fnname">from_slice</a>(slice: &[A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>]) -> Self</code><a class="srclink" href="../src/smallvec/lib.rs.html#1341-1365" title="goto source code">[src]</a></h4><div class="docblock"><p>Copy the elements from a slice into a new <code>SmallVec</code>.</p>
|
||
<p>For slices of <code>Copy</code> types, this is more efficient than <code>SmallVec::from(slice)</code>.</p>
|
||
</div><h4 id="method.insert_from_slice" class="method"><code>pub fn <a href="#method.insert_from_slice" class="fnname">insert_from_slice</a>(&mut self, index: usize, slice: &[A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>])</code><a class="srclink" href="../src/smallvec/lib.rs.html#1371-1384" title="goto source code">[src]</a></h4><div class="docblock"><p>Copy elements from a slice into the vector at position <code>index</code>, shifting any following
|
||
elements toward the back.</p>
|
||
<p>For slices of <code>Copy</code> types, this is more efficient than <code>insert</code>.</p>
|
||
</div><h4 id="method.extend_from_slice" class="method"><code>pub fn <a href="#method.extend_from_slice" class="fnname">extend_from_slice</a>(&mut self, slice: &[A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>])</code><a class="srclink" href="../src/smallvec/lib.rs.html#1390-1393" title="goto source code">[src]</a></h4><div class="docblock"><p>Copy elements from a slice and append them to the vector.</p>
|
||
<p>For slices of <code>Copy</code> types, this is more efficient than <code>extend</code>.</p>
|
||
</div></div><h3 id="impl-2" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A> <span class="where fmt-newline">where<br> A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>, </span></code><a href="#impl-2" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1396-1440" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.resize" class="method"><code>pub fn <a href="#method.resize" class="fnname">resize</a>(&mut self, len: usize, value: A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>)</code><a class="srclink" href="../src/smallvec/lib.rs.html#1406-1414" title="goto source code">[src]</a></h4><div class="docblock"><p>Resizes the vector so that its length is equal to <code>len</code>.</p>
|
||
<p>If <code>len</code> is less than the current length, the vector simply truncated.</p>
|
||
<p>If <code>len</code> is greater than the current length, <code>value</code> is appended to the
|
||
vector until its length equals <code>len</code>.</p>
|
||
</div><h4 id="method.from_elem" class="method"><code>pub fn <a href="#method.from_elem" class="fnname">from_elem</a>(elem: A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>, n: usize) -> Self</code><a class="srclink" href="../src/smallvec/lib.rs.html#1423-1439" title="goto source code">[src]</a></h4><div class="docblock"><p>Creates a <code>SmallVec</code> with <code>n</code> copies of <code>elem</code>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">smallvec</span>::<span class="ident">SmallVec</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> <span class="ident">SmallVec</span>::<span class="op"><</span>[<span class="ident">char</span>; <span class="number">128</span>]<span class="op">></span>::<span class="ident">from_elem</span>(<span class="string">'d'</span>, <span class="number">2</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>, <span class="ident">SmallVec</span>::<span class="ident">from_buf</span>([<span class="string">'d'</span>, <span class="string">'d'</span>]));</pre></div>
|
||
</div></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><h3 id="impl-AsMut%3C%5B%3CA%20as%20Array%3E%3A%3AItem%5D%3E" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a><[<A as <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>>::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>]> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a href="#impl-AsMut%3C%5B%3CA%20as%20Array%3E%3A%3AItem%5D%3E" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1470-1475" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.as_mut" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html#tymethod.as_mut" class="fnname">as_mut</a>(&mut self) -> &mut [A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>]</code><a class="srclink" href="../src/smallvec/lib.rs.html#1472-1474" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id="impl-AsRef%3C%5B%3CA%20as%20Array%3E%3A%3AItem%5D%3E" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><[<A as <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>>::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>]> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a href="#impl-AsRef%3C%5B%3CA%20as%20Array%3E%3A%3AItem%5D%3E" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1463-1468" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.as_ref" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html#tymethod.as_ref" class="fnname">as_ref</a>(&self) -> &[A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>]</code><a class="srclink" href="../src/smallvec/lib.rs.html#1465-1467" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id="impl-Borrow%3C%5B%3CA%20as%20Array%3E%3A%3AItem%5D%3E" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><[<A as <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>>::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>]> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a href="#impl-Borrow%3C%5B%3CA%20as%20Array%3E%3A%3AItem%5D%3E" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1477-1482" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> &[A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>]</code><a class="srclink" href="../src/smallvec/lib.rs.html#1479-1481" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||
</div></div><h3 id="impl-BorrowMut%3C%5B%3CA%20as%20Array%3E%3A%3AItem%5D%3E" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><[<A as <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>>::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>]> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a href="#impl-BorrowMut%3C%5B%3CA%20as%20Array%3E%3A%3AItem%5D%3E" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1484-1489" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> &mut [A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>]</code><a class="srclink" href="../src/smallvec/lib.rs.html#1486-1488" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||
</div></div><h3 id="impl-Clone" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <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="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A> <span class="where fmt-newline">where<br> A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>, </span></code><a href="#impl-Clone" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1722-1730" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.clone" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fnname">clone</a>(&self) -> <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a class="srclink" href="../src/smallvec/lib.rs.html#1727-1729" title="goto source code">[src]</a></h4><div class='docblock hidden'><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 hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fnname">clone_from</a>(&mut self, source: &Self)</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#128" title="goto source code">[src]</a></h4><div class='docblock hidden'><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"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <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="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A> <span class="where fmt-newline">where<br> A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>, </span></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1678-1685" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.fmt" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class="srclink" href="../src/smallvec/lib.rs.html#1682-1684" title="goto source code">[src]</a></h4><div class='docblock hidden'><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-Default" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a href="#impl-Default" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1687-1692" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.default" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default" class="fnname">default</a>() -> <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a class="srclink" href="../src/smallvec/lib.rs.html#1689-1691" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default">Read more</a></p>
|
||
</div></div><h3 id="impl-Deref" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <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="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a href="#impl-Deref" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1442-1451" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Target" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target" class="type">Target</a> = [A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>]</code></h4><div class='docblock'><p>The resulting type after dereferencing.</p>
|
||
</div><h4 id="method.deref" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#tymethod.deref" class="fnname">deref</a>(&self) -> &[A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>]</code><a class="srclink" href="../src/smallvec/lib.rs.html#1445-1450" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Dereferences the value.</p>
|
||
</div></div><h3 id="impl-DerefMut" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <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="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a href="#impl-DerefMut" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1453-1461" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.deref_mut" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.DerefMut.html#tymethod.deref_mut" class="fnname">deref_mut</a>(&mut self) -> &mut [A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>]</code><a class="srclink" href="../src/smallvec/lib.rs.html#1455-1460" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably dereferences the value.</p>
|
||
</div></div><h3 id="impl-Drop" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a href="#impl-Drop" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1709-1720" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.drop" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop" class="fnname">drop</a>(&mut self)</code><a class="srclink" href="../src/smallvec/lib.rs.html#1710-1719" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Executes the destructor for this type. <a href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop">Read more</a></p>
|
||
</div></div><h3 id="impl-Eq" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A> <span class="where fmt-newline">where<br> A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a>, </span></code><a href="#impl-Eq" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1742" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-Extend%3C%3CA%20as%20Array%3E%3A%3AItem%3E" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a><<A as <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>>::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a href="#impl-Extend%3C%3CA%20as%20Array%3E%3A%3AItem%3E" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1653-1676" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.extend" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html#tymethod.extend" class="fnname">extend</a><I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>>>(&mut self, iterable: I)</code><a class="srclink" href="../src/smallvec/lib.rs.html#1654-1675" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Extends a collection with the contents of an iterator. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html#tymethod.extend">Read more</a></p>
|
||
</div><h4 id="method.extend_one" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html#method.extend_one" class="fnname">extend_one</a>(&mut self, item: A)</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/iter/traits/collect.rs.html#340" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>extend_one</code>)</div></div><div class='docblock hidden'><p>Extends a collection with exactly one element.</p>
|
||
</div><h4 id="method.extend_reserve" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html#method.extend_reserve" class="fnname">extend_reserve</a>(&mut self, additional: usize)</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/iter/traits/collect.rs.html#348" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>extend_one</code>)</div></div><div class='docblock hidden'><p>Reserves capacity in a collection for the given number of additional elements. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html#method.extend_reserve">Read more</a></p>
|
||
</div></div><h3 id="impl-From%3C%26%27a%20%5B%3CA%20as%20Array%3E%3A%3AItem%5D%3E" class="impl"><code class="in-band">impl<'a, A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><&'a [<A as <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>>::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>]> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A> <span class="where fmt-newline">where<br> A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>, </span></code><a href="#impl-From%3C%26%27a%20%5B%3CA%20as%20Array%3E%3A%3AItem%5D%3E" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1589-1604" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(slice: &'a [A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>]) -> <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a class="srclink" href="../src/smallvec/lib.rs.html#1595-1597" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id="impl-From%3CA%3E" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><A> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a href="#impl-From%3CA%3E" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1613-1618" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from-2" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(array: A) -> <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a class="srclink" href="../src/smallvec/lib.rs.html#1615-1617" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id="impl-From%3CVec%3C%3CA%20as%20Array%3E%3A%3AItem%2C%20Global%3E%3E" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<A as <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>>::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>>> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a href="#impl-From%3CVec%3C%3CA%20as%20Array%3E%3A%3AItem%2C%20Global%3E%3E" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1606-1611" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from-1" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(vec: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>>) -> <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a class="srclink" href="../src/smallvec/lib.rs.html#1608-1610" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id="impl-FromIterator%3C%3CA%20as%20Array%3E%3A%3AItem%3E" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html" title="trait core::iter::traits::collect::FromIterator">FromIterator</a><<A as <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>>::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a href="#impl-FromIterator%3C%3CA%20as%20Array%3E%3A%3AItem%3E" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1644-1651" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from_iter" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html#tymethod.from_iter" class="fnname">from_iter</a><I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>>>(iterable: I) -> <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a class="srclink" href="../src/smallvec/lib.rs.html#1646-1650" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates a value from an iterator. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html#tymethod.from_iter">Read more</a></p>
|
||
</div></div><h3 id="impl-Hash" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A> <span class="where fmt-newline">where<br> A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>, </span></code><a href="#impl-Hash" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1764-1771" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.hash" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#tymethod.hash" class="fnname">hash</a><H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>>(&self, state: &mut H)</code><a class="srclink" href="../src/smallvec/lib.rs.html#1768-1770" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Feeds this value into the given <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#tymethod.hash">Read more</a></p>
|
||
</div><h4 id="method.hash_slice" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice" class="fnname">hash_slice</a><H>(data: &[Self], state: &mut H) <span class="where fmt-newline">where<br> H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>, </span></code><span class="since" title="Stable since Rust version 1.3.0">1.3.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/hash/mod.rs.html#184-186" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Feeds a slice of this type into the given <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice">Read more</a></p>
|
||
</div></div><h3 id="impl-Index%3CI%3E" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>, I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a><[A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>]>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a><I> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a href="#impl-Index%3CI%3E" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1620-1626" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Output" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" class="type">Output</a> = I::<a class="type" href="https://doc.rust-lang.org/nightly/core/slice/index/trait.SliceIndex.html#associatedtype.Output" title="type core::slice::index::SliceIndex::Output">Output</a></code></h4><div class='docblock'><p>The returned type after indexing.</p>
|
||
</div><h4 id="method.index" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#tymethod.index" class="fnname">index</a>(&self, index: I) -> &I::<a class="type" href="https://doc.rust-lang.org/nightly/core/slice/index/trait.SliceIndex.html#associatedtype.Output" title="type core::slice::index::SliceIndex::Output">Output</a></code><a class="srclink" href="../src/smallvec/lib.rs.html#1623-1625" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the indexing (<code>container[index]</code>) operation.</p>
|
||
</div></div><h3 id="impl-IndexMut%3CI%3E" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>, I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a><[A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>]>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html" title="trait core::ops::index::IndexMut">IndexMut</a><I> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a href="#impl-IndexMut%3CI%3E" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1628-1632" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.index_mut" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html#tymethod.index_mut" class="fnname">index_mut</a>(&mut self, index: I) -> &mut I::<a class="type" href="https://doc.rust-lang.org/nightly/core/slice/index/trait.SliceIndex.html#associatedtype.Output" title="type core::slice::index::SliceIndex::Output">Output</a></code><a class="srclink" href="../src/smallvec/lib.rs.html#1629-1631" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the mutable indexing (<code>container[index]</code>) operation.</p>
|
||
</div></div><h3 id="impl-IntoIterator" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a href="#impl-IntoIterator" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1864-1879" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.IntoIter" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" class="type">IntoIter</a> = <a class="struct" href="../smallvec/struct.IntoIter.html" title="struct smallvec::IntoIter">IntoIter</a><A></code></h4><div class='docblock'><p>Which kind of iterator are we turning this into?</p>
|
||
</div><h4 id="associatedtype.Item" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" class="type">Item</a> = A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a></code></h4><div class='docblock'><p>The type of the elements being iterated over.</p>
|
||
</div><h4 id="method.into_iter" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter" class="fnname">into_iter</a>(self) -> Self::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a></code><a class="srclink" href="../src/smallvec/lib.rs.html#1867-1878" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates an iterator from a value. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter">Read more</a></p>
|
||
</div></div><h3 id="impl-IntoIterator-1" class="impl"><code class="in-band">impl<'a, A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> for &'a <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a href="#impl-IntoIterator-1" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1881-1887" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.IntoIter-1" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" class="type">IntoIter</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/iter/struct.Iter.html" title="struct core::slice::iter::Iter">Iter</a><'a, A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>></code></h4><div class='docblock'><p>Which kind of iterator are we turning this into?</p>
|
||
</div><h4 id="associatedtype.Item-1" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" class="type">Item</a> = &'a A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a></code></h4><div class='docblock'><p>The type of the elements being iterated over.</p>
|
||
</div><h4 id="method.into_iter-1" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter" class="fnname">into_iter</a>(self) -> Self::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a></code><a class="srclink" href="../src/smallvec/lib.rs.html#1884-1886" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates an iterator from a value. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter">Read more</a></p>
|
||
</div></div><h3 id="impl-IntoIterator-2" class="impl"><code class="in-band">impl<'a, A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> for &'a mut <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A></code><a href="#impl-IntoIterator-2" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1889-1895" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.IntoIter-2" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" class="type">IntoIter</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/iter/struct.IterMut.html" title="struct core::slice::iter::IterMut">IterMut</a><'a, A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>></code></h4><div class='docblock'><p>Which kind of iterator are we turning this into?</p>
|
||
</div><h4 id="associatedtype.Item-2" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" class="type">Item</a> = &'a mut A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a></code></h4><div class='docblock'><p>The type of the elements being iterated over.</p>
|
||
</div><h4 id="method.into_iter-2" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter" class="fnname">into_iter</a>(self) -> Self::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a></code><a class="srclink" href="../src/smallvec/lib.rs.html#1892-1894" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates an iterator from a value. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter">Read more</a></p>
|
||
</div></div><h3 id="impl-Ord" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A> <span class="where fmt-newline">where<br> A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>, </span></code><a href="#impl-Ord" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1754-1762" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.cmp" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#tymethod.cmp" class="fnname">cmp</a>(&self, other: &<a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></code><a class="srclink" href="../src/smallvec/lib.rs.html#1759-1761" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method returns an <a href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="Ordering"><code>Ordering</code></a> between <code>self</code> and <code>other</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#tymethod.cmp">Read more</a></p>
|
||
</div><h4 id="method.max" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.max" class="fnname">max</a>(self, other: Self) -> Self</code><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#723-725" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Compares and returns the maximum of two values. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.max">Read more</a></p>
|
||
</div><h4 id="method.min" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.min" class="fnname">min</a>(self, other: Self) -> Self</code><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#743-745" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Compares and returns the minimum of two values. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.min">Read more</a></p>
|
||
</div><h4 id="method.clamp" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.clamp" class="fnname">clamp</a>(self, min: Self, max: Self) -> Self</code><span class="since" title="Stable since Rust version 1.50.0">1.50.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#768-770" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Restrict a value to a certain interval. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.clamp">Read more</a></p>
|
||
</div></div><h3 id="impl-PartialEq%3CSmallVec%3CB%3E%3E" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>, B: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><B>> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A> <span class="where fmt-newline">where<br> A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><B::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>>, </span></code><a href="#impl-PartialEq%3CSmallVec%3CB%3E%3E" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1732-1740" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.eq" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq" class="fnname">eq</a>(&self, other: &<a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><B>) -> bool</code><a class="srclink" href="../src/smallvec/lib.rs.html#1737-1739" title="goto source code">[src]</a></h4><div class='docblock hidden'><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 hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne" class="fnname">ne</a>(&self, other: &Rhs) -> bool</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#213" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests for <code>!=</code>.</p>
|
||
</div></div><h3 id="impl-PartialOrd%3CSmallVec%3CA%3E%3E" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A>> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A> <span class="where fmt-newline">where<br> A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>, </span></code><a href="#impl-PartialOrd%3CSmallVec%3CA%3E%3E" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1744-1752" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.partial_cmp" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fnname">partial_cmp</a>(&self, other: &<a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></code><a class="srclink" href="../src/smallvec/lib.rs.html#1749-1751" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
|
||
</div><h4 id="method.lt" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt" class="fnname">lt</a>(&self, other: &Rhs) -> bool</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#963" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
|
||
</div><h4 id="method.le" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le" class="fnname">le</a>(&self, other: &Rhs) -> bool</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#982" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code>
|
||
operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
|
||
</div><h4 id="method.gt" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt" class="fnname">gt</a>(&self, other: &Rhs) -> bool</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#1000" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
|
||
</div><h4 id="method.ge" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge" class="fnname">ge</a>(&self, other: &Rhs) -> bool</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#1019" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code>
|
||
operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
|
||
</div></div><h3 id="impl-Send" class="impl"><code class="in-band">impl<A: <a class="trait" href="../smallvec/trait.Array.html" title="trait smallvec::Array">Array</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A> <span class="where fmt-newline">where<br> A::<a class="type" href="../smallvec/trait.Array.html#associatedtype.Item" title="type smallvec::Array::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>, </span></code><a href="#impl-Send" class="anchor"></a><a class="srclink" href="../src/smallvec/lib.rs.html#1773" title="goto source code">[src]</a></h3><div class="impl-items"></div></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><h3 id="impl-Sync" class="impl"><code class="in-band">impl<A> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A> <span class="where fmt-newline">where<br> A: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>, </span></code><a href="#impl-Sync" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Unpin" class="impl"><code class="in-band">impl<A> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../smallvec/struct.SmallVec.html" title="struct smallvec::SmallVec">SmallVec</a><A> <span class="where fmt-newline">where<br> A: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>, </span></code><a href="#impl-Unpin" class="anchor"></a></h3><div class="impl-items"></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><h3 id="impl-Any" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.type_id" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||
</div></div><h3 id="impl-Borrow%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href="#impl-Borrow%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#207-211" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow-1" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> &T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||
</div></div><h3 id="impl-BorrowMut%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href="#impl-BorrowMut%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-218" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow_mut-1" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> &mut T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#215" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||
</div></div><h3 id="impl-From%3C!%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><!> for T</code><a href="#impl-From%3C!%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#560-564" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from-3" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: !) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#561" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id="impl-From%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</code><a href="#impl-From%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#545-549" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from-4" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id="impl-Into%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></code><a href="#impl-Into%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#534-541" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#538" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id="impl-ToOwned" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>, </span></code><a href="#impl-ToOwned" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#81-93" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Owned" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="type">Owned</a> = T</code></h4><div class='docblock'><p>The resulting type after obtaining ownership.</p>
|
||
</div><h4 id="method.to_owned" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fnname">to_owned</a>(&self) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#86" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
|
||
</div><h4 id="method.clone_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fnname">clone_into</a>(&self, target: &mut T)</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#90" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><details><summary><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>toowned_clone_into</code>)</summary><p>recently added</p>
|
||
</details></div></div><div class='docblock hidden'><p>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></p>
|
||
</div></div><h3 id="impl-TryFrom%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></code><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#582-591" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||
</div><h4 id="method.try_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id="impl-TryInto%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><a href="#impl-TryInto%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#568-577" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-1" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||
</div><h4 id="method.try_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#574" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="smallvec"></div>
|
||
<script src="../main.js"></script><script defer src="../search-index.js"></script></body></html> |