mentat/lru_cache/struct.LruCache.html
2018-08-22 17:04:13 +00:00

328 lines
No EOL
56 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

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

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `LruCache` struct in crate `lru_cache`.">
<meta name="keywords" content="rust, rustlang, rust-lang, LruCache">
<title>lru_cache::LruCache - Rust</title>
<link rel="stylesheet" type="text/css" href="../normalize.css">
<link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle">
<link rel="stylesheet" type="text/css" href="../dark.css">
<link rel="stylesheet" type="text/css" href="../main.css" id="themeStyle">
<script src="../storage.js"></script>
</head>
<body class="rustdoc struct">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<div class="sidebar-menu">&#9776;</div>
<p class='location'>Struct LruCache</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.new">new</a><a href="#method.with_hasher">with_hasher</a><a href="#method.contains_key">contains_key</a><a href="#method.insert">insert</a><a href="#method.get_mut">get_mut</a><a href="#method.remove">remove</a><a href="#method.capacity">capacity</a><a href="#method.set_capacity">set_capacity</a><a href="#method.remove_lru">remove_lru</a><a href="#method.len">len</a><a href="#method.is_empty">is_empty</a><a href="#method.clear">clear</a><a href="#method.iter">iter</a><a href="#method.iter_mut">iter_mut</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Extend%3C(K%2C%20V)%3E">Extend&lt;(K, V)&gt;</a><a href="#impl-Debug">Debug</a><a href="#impl-IntoIterator">IntoIterator</a></div></div><p class='location'><a href='index.html'>lru_cache</a></p><script>window.sidebarCurrent = {name: 'LruCache', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div>
</nav>
<div class="theme-picker">
<button id="theme-picker" aria-label="Pick another theme!">
<img src="../brush.svg" width="18" alt="Pick another theme!">
</button>
<div id="theme-choices"></div>
</div>
<script src="../theme.js"></script>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>lru_cache</a>::<wbr><a class="struct" href=''>LruCache</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>&#x2212;</span>]
</a>
</span><a class='srclink' href='../src/lru_cache/lib.rs.html#56-59' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct LruCache&lt;K:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>, V, S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>&nbsp;=&nbsp;<a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.RandomState.html" title="struct std::collections::hash::map::RandomState">RandomState</a>&gt; { /* fields omitted */ }</pre><div class='docblock'><p>An LRU cache.</p>
</div>
<h2 id='methods' class='small-section-header'>
Methods<a href='#methods' class='anchor'></a>
</h2>
<h3 id='impl' class='impl'><span class='in-band'><code>impl&lt;K:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>, V&gt; <a class="struct" href="../lru_cache/struct.LruCache.html" title="struct lru_cache::LruCache">LruCache</a>&lt;K, V&gt;</code><a href='#impl' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#61-76' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>pub fn <a href='#method.new' class='fnname'>new</a>(capacity: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#70-75' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Creates an empty cache that can hold at most <code>capacity</code> items.</p>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">lru_cache</span>::<span class="ident">LruCache</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cache</span>: <span class="ident">LruCache</span><span class="op">&lt;</span><span class="ident">i32</span>, <span class="kw-2">&amp;</span><span class="ident">str</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">LruCache</span>::<span class="ident">new</span>(<span class="number">10</span>);</pre>
</div></div><h3 id='impl-1' class='impl'><span class='in-band'><code>impl&lt;K:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>, V, S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>&gt; <a class="struct" href="../lru_cache/struct.LruCache.html" title="struct lru_cache::LruCache">LruCache</a>&lt;K, V, S&gt;</code><a href='#impl-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#78-305' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.with_hasher' class="method"><span id='with_hasher.v' class='invisible'><code>pub fn <a href='#method.with_hasher' class='fnname'>with_hasher</a>(capacity: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, hash_builder: S) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#80-82' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Creates an empty cache that can hold at most <code>capacity</code> items with the given hash builder.</p>
</div><h4 id='method.contains_key' class="method"><span id='contains_key.v' class='invisible'><code>pub fn <a href='#method.contains_key' class='fnname'>contains_key</a>&lt;Q:&nbsp;?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt;(&amp;mut self, key: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Q) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;Q&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;Q: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a>,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#96-101' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Checks if the map contains the given key.</p>
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">lru_cache</span>::<span class="ident">LruCache</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cache</span> <span class="op">=</span> <span class="ident">LruCache</span>::<span class="ident">new</span>(<span class="number">1</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">1</span>, <span class="string">&quot;a&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">contains_key</span>(<span class="kw-2">&amp;</span><span class="number">1</span>), <span class="bool-val">true</span>);</pre>
</div><h4 id='method.insert' class="method"><span id='insert.v' class='invisible'><code>pub fn <a href='#method.insert' class='fnname'>insert</a>(&amp;mut self, k: K, v: V) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;V&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#118-124' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Inserts a key-value pair into the cache. If the key already existed, the old value is
returned.</p>
<h1 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">lru_cache</span>::<span class="ident">LruCache</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cache</span> <span class="op">=</span> <span class="ident">LruCache</span>::<span class="ident">new</span>(<span class="number">2</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">1</span>, <span class="string">&quot;a&quot;</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">2</span>, <span class="string">&quot;b&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">get_mut</span>(<span class="kw-2">&amp;</span><span class="number">1</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="string">&quot;a&quot;</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">get_mut</span>(<span class="kw-2">&amp;</span><span class="number">2</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="string">&quot;b&quot;</span>));</pre>
</div><h4 id='method.get_mut' class="method"><span id='get_mut.v' class='invisible'><code>pub fn <a href='#method.get_mut' class='fnname'>get_mut</a>&lt;Q:&nbsp;?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt;(&amp;mut self, k: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Q) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>V&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;Q&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;Q: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a>,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#144-149' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns a mutable reference to the value corresponding to the given key in the cache, if
any.</p>
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">lru_cache</span>::<span class="ident">LruCache</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cache</span> <span class="op">=</span> <span class="ident">LruCache</span>::<span class="ident">new</span>(<span class="number">2</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">1</span>, <span class="string">&quot;a&quot;</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">2</span>, <span class="string">&quot;b&quot;</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">2</span>, <span class="string">&quot;c&quot;</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">3</span>, <span class="string">&quot;d&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">get_mut</span>(<span class="kw-2">&amp;</span><span class="number">1</span>), <span class="prelude-val">None</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">get_mut</span>(<span class="kw-2">&amp;</span><span class="number">2</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="string">&quot;c&quot;</span>));</pre>
</div><h4 id='method.remove' class="method"><span id='remove.v' class='invisible'><code>pub fn <a href='#method.remove' class='fnname'>remove</a>&lt;Q:&nbsp;?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt;(&amp;mut self, k: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Q) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;V&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;Q&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;Q: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a>,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#167-172' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Removes the given key from the cache and returns its corresponding value.</p>
<h1 id="examples-4" class="section-header"><a href="#examples-4">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">lru_cache</span>::<span class="ident">LruCache</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cache</span> <span class="op">=</span> <span class="ident">LruCache</span>::<span class="ident">new</span>(<span class="number">2</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">2</span>, <span class="string">&quot;a&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">remove</span>(<span class="kw-2">&amp;</span><span class="number">1</span>), <span class="prelude-val">None</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">remove</span>(<span class="kw-2">&amp;</span><span class="number">2</span>), <span class="prelude-val">Some</span>(<span class="string">&quot;a&quot;</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">remove</span>(<span class="kw-2">&amp;</span><span class="number">2</span>), <span class="prelude-val">None</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">len</span>(), <span class="number">0</span>);</pre>
</div><h4 id='method.capacity' class="method"><span id='capacity.v' class='invisible'><code>pub fn <a href='#method.capacity' class='fnname'>capacity</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#183-185' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns the maximum number of key-value pairs the cache can hold.</p>
<h1 id="examples-5" class="section-header"><a href="#examples-5">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">lru_cache</span>::<span class="ident">LruCache</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cache</span>: <span class="ident">LruCache</span><span class="op">&lt;</span><span class="ident">i32</span>, <span class="kw-2">&amp;</span><span class="ident">str</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">LruCache</span>::<span class="ident">new</span>(<span class="number">2</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">capacity</span>(), <span class="number">2</span>);</pre>
</div><h4 id='method.set_capacity' class="method"><span id='set_capacity.v' class='invisible'><code>pub fn <a href='#method.set_capacity' class='fnname'>set_capacity</a>(&amp;mut self, capacity: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#219-224' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Sets the number of key-value pairs the cache can hold. Removes
least-recently-used key-value pairs if necessary.</p>
<h1 id="examples-6" class="section-header"><a href="#examples-6">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">lru_cache</span>::<span class="ident">LruCache</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cache</span> <span class="op">=</span> <span class="ident">LruCache</span>::<span class="ident">new</span>(<span class="number">2</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">1</span>, <span class="string">&quot;a&quot;</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">2</span>, <span class="string">&quot;b&quot;</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">3</span>, <span class="string">&quot;c&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">get_mut</span>(<span class="kw-2">&amp;</span><span class="number">1</span>), <span class="prelude-val">None</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">get_mut</span>(<span class="kw-2">&amp;</span><span class="number">2</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="string">&quot;b&quot;</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">get_mut</span>(<span class="kw-2">&amp;</span><span class="number">3</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="string">&quot;c&quot;</span>));
<span class="ident">cache</span>.<span class="ident">set_capacity</span>(<span class="number">3</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">1</span>, <span class="string">&quot;a&quot;</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">2</span>, <span class="string">&quot;b&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">get_mut</span>(<span class="kw-2">&amp;</span><span class="number">1</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="string">&quot;a&quot;</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">get_mut</span>(<span class="kw-2">&amp;</span><span class="number">2</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="string">&quot;b&quot;</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">get_mut</span>(<span class="kw-2">&amp;</span><span class="number">3</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="string">&quot;c&quot;</span>));
<span class="ident">cache</span>.<span class="ident">set_capacity</span>(<span class="number">1</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">get_mut</span>(<span class="kw-2">&amp;</span><span class="number">1</span>), <span class="prelude-val">None</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">get_mut</span>(<span class="kw-2">&amp;</span><span class="number">2</span>), <span class="prelude-val">None</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">get_mut</span>(<span class="kw-2">&amp;</span><span class="number">3</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="string">&quot;c&quot;</span>));</pre>
</div><h4 id='method.remove_lru' class="method"><span id='remove_lru.v' class='invisible'><code>pub fn <a href='#method.remove_lru' class='fnname'>remove_lru</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>K, V<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#242-244' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Removes and returns the least recently used key-value pair as a tuple.</p>
<h1 id="examples-7" class="section-header"><a href="#examples-7">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">lru_cache</span>::<span class="ident">LruCache</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cache</span> <span class="op">=</span> <span class="ident">LruCache</span>::<span class="ident">new</span>(<span class="number">2</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">1</span>, <span class="string">&quot;a&quot;</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">2</span>, <span class="string">&quot;b&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">remove_lru</span>(), <span class="prelude-val">Some</span>((<span class="number">1</span>, <span class="string">&quot;a&quot;</span>)));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">len</span>(), <span class="number">1</span>);</pre>
</div><h4 id='method.len' class="method"><span id='len.v' class='invisible'><code>pub fn <a href='#method.len' class='fnname'>len</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#247' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns the number of key-value pairs in the cache.</p>
</div><h4 id='method.is_empty' class="method"><span id='is_empty.v' class='invisible'><code>pub fn <a href='#method.is_empty' class='fnname'>is_empty</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#250' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns <code>true</code> if the cache contains no key-value pairs.</p>
</div><h4 id='method.clear' class="method"><span id='clear.v' class='invisible'><code>pub fn <a href='#method.clear' class='fnname'>clear</a>(&amp;mut self)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#253' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Removes all key-value pairs from the cache.</p>
</div><h4 id='method.iter' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../lru_cache/struct.Iter.html" title="struct lru_cache::Iter">Iter</a>&lt;'a, K, V&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../lru_cache/struct.Iter.html" title="struct lru_cache::Iter">Iter</a>&lt;'a, K, V&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, K, V&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../lru_cache/struct.Iter.html" title="struct lru_cache::Iter">Iter</a>&lt;'a, K, V&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a </a>K, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a </a>V<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>;</span></code></div></div><span id='iter.v' class='invisible'><code>pub fn <a href='#method.iter' class='fnname'>iter</a>(&amp;self) -&gt; <a class="struct" href="../lru_cache/struct.Iter.html" title="struct lru_cache::Iter">Iter</a>&lt;K, V&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#273' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns an iterator over the cache's key-value pairs in least- to most-recently-used order.</p>
<p>Accessing the cache through the iterator does <em>not</em> affect the cache's LRU state.</p>
<h1 id="examples-8" class="section-header"><a href="#examples-8">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">lru_cache</span>::<span class="ident">LruCache</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cache</span> <span class="op">=</span> <span class="ident">LruCache</span>::<span class="ident">new</span>(<span class="number">2</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">1</span>, <span class="number">10</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">2</span>, <span class="number">20</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">3</span>, <span class="number">30</span>);
<span class="kw">let</span> <span class="ident">kvs</span>: <span class="ident">Vec</span><span class="op">&lt;</span>_<span class="op">&gt;</span> <span class="op">=</span> <span class="ident">cache</span>.<span class="ident">iter</span>().<span class="ident">collect</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">kvs</span>, [(<span class="kw-2">&amp;</span><span class="number">2</span>, <span class="kw-2">&amp;</span><span class="number">20</span>), (<span class="kw-2">&amp;</span><span class="number">3</span>, <span class="kw-2">&amp;</span><span class="number">30</span>)]);</pre>
</div><h4 id='method.iter_mut' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../lru_cache/struct.IterMut.html" title="struct lru_cache::IterMut">IterMut</a>&lt;'a, K, V&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../lru_cache/struct.IterMut.html" title="struct lru_cache::IterMut">IterMut</a>&lt;'a, K, V&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, K, V&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../lru_cache/struct.IterMut.html" title="struct lru_cache::IterMut">IterMut</a>&lt;'a, K, V&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a </a>K, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>V<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>;</span></code></div></div><span id='iter_mut.v' class='invisible'><code>pub fn <a href='#method.iter_mut' class='fnname'>iter_mut</a>(&amp;mut self) -&gt; <a class="struct" href="../lru_cache/struct.IterMut.html" title="struct lru_cache::IterMut">IterMut</a>&lt;K, V&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#304' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns an iterator over the cache's key-value pairs in least- to most-recently-used order,
with mutable references to the values.</p>
<p>Accessing the cache through the iterator does <em>not</em> affect the cache's LRU state.</p>
<h1 id="examples-9" class="section-header"><a href="#examples-9">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">lru_cache</span>::<span class="ident">LruCache</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cache</span> <span class="op">=</span> <span class="ident">LruCache</span>::<span class="ident">new</span>(<span class="number">2</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">1</span>, <span class="number">10</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">2</span>, <span class="number">20</span>);
<span class="ident">cache</span>.<span class="ident">insert</span>(<span class="number">3</span>, <span class="number">30</span>);
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">n</span> <span class="op">=</span> <span class="number">2</span>;
<span class="kw">for</span> (<span class="ident">k</span>, <span class="ident">v</span>) <span class="kw">in</span> <span class="ident">cache</span>.<span class="ident">iter_mut</span>() {
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">*</span><span class="ident">k</span>, <span class="ident">n</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">*</span><span class="ident">v</span>, <span class="ident">n</span> <span class="op">*</span> <span class="number">10</span>);
<span class="kw-2">*</span><span class="ident">v</span> <span class="op">*=</span> <span class="number">10</span>;
<span class="ident">n</span> <span class="op">+=</span> <span class="number">1</span>;
}
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">n</span>, <span class="number">4</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">get_mut</span>(<span class="kw-2">&amp;</span><span class="number">2</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="number">200</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cache</span>.<span class="ident">get_mut</span>(<span class="kw-2">&amp;</span><span class="number">3</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="number">300</span>));</pre>
</div></div>
<h2 id='implementations' class='small-section-header'>
Trait Implementations<a href='#implementations' class='anchor'></a>
</h2>
<h3 id='impl-Clone' class='impl'><span class='in-band'><code>impl&lt;K:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>, V:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>, S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>&gt; <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="../lru_cache/struct.LruCache.html" title="struct lru_cache::LruCache">LruCache</a>&lt;K, V, S&gt;</code><a href='#impl-Clone' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#55' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.clone' class="method"><span id='clone.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&amp;self) -&gt; <a class="struct" href="../lru_cache/struct.LruCache.html" title="struct lru_cache::LruCache">LruCache</a>&lt;K, V, S&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#55' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id='method.clone_from' class="method"><span id='clone_from.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/clone.rs.html#112-114' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div><h3 id='impl-Extend%3C(K%2C%20V)%3E' class='impl'><span class='in-band'><code>impl&lt;K:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>, V, S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.Extend.html" title="trait core::iter::traits::Extend">Extend</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>K, V<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>&gt; for <a class="struct" href="../lru_cache/struct.LruCache.html" title="struct lru_cache::LruCache">LruCache</a>&lt;K, V, S&gt;</code><a href='#impl-Extend%3C(K%2C%20V)%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#307-313' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.extend' class="method"><span id='extend.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.Extend.html#tymethod.extend' class='fnname'>extend</a>&lt;I:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html" title="trait core::iter::traits::IntoIterator">IntoIterator</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>K, V<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>&gt;&gt;(&amp;mut self, iter: I)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#308-312' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Extends a collection with the contents of an iterator. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.Extend.html#tymethod.extend">Read more</a></p>
</div></div><h3 id='impl-Debug' class='impl'><span class='in-band'><code>impl&lt;K:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>, V:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>, S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>&gt; <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="../lru_cache/struct.LruCache.html" title="struct lru_cache::LruCache">LruCache</a>&lt;K, V, S&gt;</code><a href='#impl-Debug' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#315-319' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#316-318' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
</div></div><h3 id='impl-IntoIterator' class='impl'><span class='in-band'><code>impl&lt;K:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>, V, S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html" title="trait core::iter::traits::IntoIterator">IntoIterator</a> for <a class="struct" href="../lru_cache/struct.LruCache.html" title="struct lru_cache::LruCache">LruCache</a>&lt;K, V, S&gt;</code><a href='#impl-IntoIterator' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#321-328' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.Item' class="type"><span id='Item.t' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>K, V<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span></h4>
<div class='docblock'><p>The type of the elements being iterated over.</p>
</div><h4 id='associatedtype.IntoIter' class="type"><span id='IntoIter.t' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#associatedtype.IntoIter' class="type">IntoIter</a> = <a class="struct" href="../lru_cache/struct.IntoIter.html" title="struct lru_cache::IntoIter">IntoIter</a>&lt;K, V&gt;</code></span></h4>
<div class='docblock'><p>Which kind of iterator are we turning this into?</p>
</div><h4 id='method.into_iter' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../lru_cache/struct.IntoIter.html" title="struct lru_cache::IntoIter">IntoIter</a>&lt;K, V&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../lru_cache/struct.IntoIter.html" title="struct lru_cache::IntoIter">IntoIter</a>&lt;K, V&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;K, V&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../lru_cache/struct.IntoIter.html" title="struct lru_cache::IntoIter">IntoIter</a>&lt;K, V&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>K, V<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>;</span></code></div></div><span id='into_iter.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#tymethod.into_iter' class='fnname'>into_iter</a>(self) -&gt; <a class="struct" href="../lru_cache/struct.IntoIter.html" title="struct lru_cache::IntoIter">IntoIter</a>&lt;K, V&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#325-327' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Creates an iterator from a value. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#tymethod.into_iter">Read more</a></p>
</div></div><h3 id='impl-IntoIterator-1' class='impl'><span class='in-band'><code>impl&lt;'a, K:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>, V, S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html" title="trait core::iter::traits::IntoIterator">IntoIterator</a> for &amp;'a <a class="struct" href="../lru_cache/struct.LruCache.html" title="struct lru_cache::LruCache">LruCache</a>&lt;K, V, S&gt;</code><a href='#impl-IntoIterator-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#330-334' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.Item-1' class="type"><span id='Item.t-1' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a </a>K, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a </a>V<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span></h4>
<div class='docblock'><p>The type of the elements being iterated over.</p>
</div><h4 id='associatedtype.IntoIter-1' class="type"><span id='IntoIter.t-1' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#associatedtype.IntoIter' class="type">IntoIter</a> = <a class="struct" href="../lru_cache/struct.Iter.html" title="struct lru_cache::Iter">Iter</a>&lt;'a, K, V&gt;</code></span></h4>
<div class='docblock'><p>Which kind of iterator are we turning this into?</p>
</div><h4 id='method.into_iter-1' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../lru_cache/struct.Iter.html" title="struct lru_cache::Iter">Iter</a>&lt;'a, K, V&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../lru_cache/struct.Iter.html" title="struct lru_cache::Iter">Iter</a>&lt;'a, K, V&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, K, V&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../lru_cache/struct.Iter.html" title="struct lru_cache::Iter">Iter</a>&lt;'a, K, V&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a </a>K, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a </a>V<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>;</span></code></div></div><span id='into_iter.v-1' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#tymethod.into_iter' class='fnname'>into_iter</a>(self) -&gt; <a class="struct" href="../lru_cache/struct.Iter.html" title="struct lru_cache::Iter">Iter</a>&lt;'a, K, V&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#333' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Creates an iterator from a value. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#tymethod.into_iter">Read more</a></p>
</div></div><h3 id='impl-IntoIterator-2' class='impl'><span class='in-band'><code>impl&lt;'a, K:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>, V, S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html" title="trait core::iter::traits::IntoIterator">IntoIterator</a> for &amp;'a mut <a class="struct" href="../lru_cache/struct.LruCache.html" title="struct lru_cache::LruCache">LruCache</a>&lt;K, V, S&gt;</code><a href='#impl-IntoIterator-2' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#336-340' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.Item-2' class="type"><span id='Item.t-2' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a </a>K, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>V<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span></h4>
<div class='docblock'><p>The type of the elements being iterated over.</p>
</div><h4 id='associatedtype.IntoIter-2' class="type"><span id='IntoIter.t-2' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#associatedtype.IntoIter' class="type">IntoIter</a> = <a class="struct" href="../lru_cache/struct.IterMut.html" title="struct lru_cache::IterMut">IterMut</a>&lt;'a, K, V&gt;</code></span></h4>
<div class='docblock'><p>Which kind of iterator are we turning this into?</p>
</div><h4 id='method.into_iter-2' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../lru_cache/struct.IterMut.html" title="struct lru_cache::IterMut">IterMut</a>&lt;'a, K, V&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../lru_cache/struct.IterMut.html" title="struct lru_cache::IterMut">IterMut</a>&lt;'a, K, V&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, K, V&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="../lru_cache/struct.IterMut.html" title="struct lru_cache::IterMut">IterMut</a>&lt;'a, K, V&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a </a>K, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>V<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>;</span></code></div></div><span id='into_iter.v-2' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#tymethod.into_iter' class='fnname'>into_iter</a>(self) -&gt; <a class="struct" href="../lru_cache/struct.IterMut.html" title="struct lru_cache::IterMut">IterMut</a>&lt;'a, K, V&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/lru_cache/lib.rs.html#339' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Creates an iterator from a value. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#tymethod.into_iter">Read more</a></p>
</div></div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt><kbd>?</kbd></dt>
<dd>Show this help dialog</dd>
<dt><kbd>S</kbd></dt>
<dd>Focus the search field</dd>
<dt><kbd></kbd></dt>
<dd>Move up in search results</dd>
<dt><kbd></kbd></dt>
<dd>Move down in search results</dd>
<dt><kbd></kbd></dt>
<dd>Switch tab</dd>
<dt><kbd>&#9166;</kbd></dt>
<dd>Go to active search result</dd>
<dt><kbd>+</kbd></dt>
<dd>Expand all sections</dd>
<dt><kbd>-</kbd></dt>
<dd>Collapse all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../";
window.currentCrate = "lru_cache";
</script>
<script src="../main.js"></script>
<script defer src="../search-index.js"></script>
</body>
</html>