blob: 811b920996323890dc363419ed4a9300878672e8 [file] [log] [blame]
<!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="Caching handle for [`ArcSwapAny`][ArcSwapAny]."><meta name="keywords" content="rust, rustlang, rust-lang, Cache"><title>Cache in arc_swap::cache - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../../normalize.css"><link rel="stylesheet" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../../ayu.css" disabled><link rel="stylesheet" href="../../dark.css" disabled><link rel="stylesheet" href="../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../main.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../favicon.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../../arc_swap/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../arc_swap/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Cache</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block"><li><a href="#method.arc_swap">arc_swap</a></li><li><a href="#method.load">load</a></li><li><a href="#method.map">map</a></li><li><a href="#method.new">new</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block"><li><a href="#impl-Access%3C%3CT%20as%20Deref%3E%3A%3ATarget%3E-for-Cache%3CA%2C%20T%3E">Access&lt;&lt;T as Deref&gt;::Target&gt;</a></li><li><a href="#impl-Clone-for-Cache%3CA%2C%20T%3E">Clone</a></li><li><a href="#impl-Debug-for-Cache%3CA%2C%20T%3E">Debug</a></li><li><a href="#impl-From%3CA%3E-for-Cache%3CA%2C%20T%3E">From&lt;A&gt;</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block"><li><a href="#impl-RefUnwindSafe-for-Cache%3CA%2C%20T%3E">RefUnwindSafe</a></li><li><a href="#impl-Send-for-Cache%3CA%2C%20T%3E">Send</a></li><li><a href="#impl-Sync-for-Cache%3CA%2C%20T%3E">Sync</a></li><li><a href="#impl-Unpin-for-Cache%3CA%2C%20T%3E">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Cache%3CA%2C%20T%3E">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block"><li><a href="#impl-Any-for-Cache%3CA%2C%20T%3E">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-Cache%3CA%2C%20T%3E">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-Cache%3CA%2C%20T%3E">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-From%3CT%3E-for-Cache%3CA%2C%20T%3E">From&lt;T&gt;</a></li><li><a href="#impl-Into%3CU%3E-for-Cache%3CA%2C%20T%3E">Into&lt;U&gt;</a></li><li><a href="#impl-ToOwned-for-Cache%3CA%2C%20T%3E">ToOwned</a></li><li><a href="#impl-TryFrom%3CU%3E-for-Cache%3CA%2C%20T%3E">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-Cache%3CA%2C%20T%3E">TryInto&lt;U&gt;</a></li></ul></section><h2><a href="index.html">In arc_swap::cache</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Struct <a href="../index.html">arc_swap</a>::<wbr><a href="index.html">cache</a>::<wbr><a class="struct" href="#">Cache</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/arc_swap/cache.rs.html#110-113">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="item-decl"><pre class="rust struct"><code>pub struct Cache&lt;A, T&gt; { /* private fields */ }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Caching handle for <a href="../struct.ArcSwapAny.html" title="ArcSwapAny"><code>ArcSwapAny</code></a>.</p>
<p>Instead of loading the <a href="std::sync::Arc"><code>Arc</code></a> on every request from the shared storage, this keeps
another copy inside itself. Upon request it only cheaply revalidates it is up to
date. If it is, access is significantly faster. If it is stale, the <a href="../struct.ArcSwapAny.html#method.load_full">load_full</a> is done and the
cache value is replaced. Under a read-heavy loads, the measured speedup are 10-25 times,
depending on the architecture.</p>
<p>There are, however, downsides:</p>
<ul>
<li>The handle needs to be kept around by the caller (usually, one per thread). This is fine if
there’s one global <code>ArcSwapAny</code>, but starts being tricky with eg. data structures build from
them.</li>
<li>As it keeps a copy of the <a href="std::sync::Arc">Arc</a> inside the cache, the old value may be kept alive for longer
period of time ‒ it is replaced by the new value on <a href="struct.Cache.html#method.load" title="Cache::load">load</a>. You may not want to
use this if dropping the old value in timely manner is important (possibly because of
releasing large amount of RAM or because of closing file handles).</li>
</ul>
<h2 id="examples"><a href="#examples">Examples</a></h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">use </span>std::sync::atomic::{AtomicBool, Ordering};
<span class="kw">use </span>arc_swap::{ArcSwap, Cache};
<span class="kw">let </span>shared = Arc::new(ArcSwap::from_pointee(<span class="number">42</span>));
<span class="kw">let </span>terminate = Arc::new(AtomicBool::new(<span class="bool-val">false</span>));
<span class="comment">// Start 10 worker threads...
</span><span class="kw">for _ in </span><span class="number">0</span>..<span class="number">10 </span>{
<span class="kw">let </span><span class="kw-2">mut </span>cache = Cache::new(Arc::clone(<span class="kw-2">&amp;</span>shared));
<span class="kw">let </span>terminate = Arc::clone(<span class="kw-2">&amp;</span>terminate);
std::thread::spawn(<span class="kw">move </span>|| {
<span class="comment">// Keep loading it like mad..
</span><span class="kw">while </span>!terminate.load(Ordering::Relaxed) {
<span class="kw">let </span>value = cache.load();
do_something(value);
}
});
}
shared.store(Arc::new(<span class="number">12</span>));</code></pre></div>
<p>Another one with using a thread local storage and explicit types:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">static </span>CURRENT_CONFIG: Lazy&lt;ArcSwap&lt;Config&gt;&gt; = Lazy::new(|| ArcSwap::from_pointee(Config::default()));
<span class="macro">thread_local! </span>{
<span class="kw">static </span>CACHE: RefCell&lt;Cache&lt;<span class="kw-2">&amp;</span><span class="lifetime">&#39;static </span>ArcSwap&lt;Config&gt;, Arc&lt;Config&gt;&gt;&gt; = RefCell::new(Cache::from(CURRENT_CONFIG.deref()));
}
CACHE.with(|c| {
<span class="comment">// * RefCell needed, because load on cache is `&amp;mut`.
// * You want to operate inside the `with` ‒ cloning the Arc is comparably expensive as
// ArcSwap::load itself and whatever you&#39;d save by the cache would be lost on that.
</span><span class="macro">println!</span>(<span class="string">&quot;{:?}&quot;</span>, c.borrow_mut().load());
});</code></pre></div>
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><div id="implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Cache%3CA%2C%20T%3E" class="impl has-srclink"><a class="srclink rightside" href="../../src/arc_swap/cache.rs.html#115-227">source</a><a href="#impl-Cache%3CA%2C%20T%3E" class="anchor"></a><h3 class="code-header">impl&lt;A, T, S&gt; <a class="struct" href="struct.Cache.html" title="struct arc_swap::cache::Cache">Cache</a>&lt;A, T&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;A: Deref&lt;Target = <a class="struct" href="../struct.ArcSwapAny.html" title="struct arc_swap::ArcSwapAny">ArcSwapAny</a>&lt;T, S&gt;&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../trait.RefCnt.html" title="trait arc_swap::RefCnt">RefCnt</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="../strategy/trait.Strategy.html" title="trait arc_swap::strategy::Strategy">Strategy</a>&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.new" class="method has-srclink"><a class="srclink rightside" href="../../src/arc_swap/cache.rs.html#130-133">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fnname">new</a>(arc_swap: A) -&gt; Self</h4></section></summary><div class="docblock"><p>Creates a new caching handle.</p>
<p>The parameter is something dereferencing into an <a href="../struct.ArcSwapAny.html" title="ArcSwapAny"><code>ArcSwapAny</code></a> (eg. either to <a href="../type.ArcSwap.html"><code>ArcSwap</code></a>
or <a href="../type.ArcSwapOption.html"><code>ArcSwapOption</code></a>). That can be <a href="../struct.ArcSwapAny.html" title="ArcSwapAny"><code>ArcSwapAny</code></a> itself, but that’s not very useful. But
it also can be a reference to it or <code>Arc</code>, which makes it possible to share the
<a href="../struct.ArcSwapAny.html" title="ArcSwapAny"><code>ArcSwapAny</code></a> with multiple caches or access it in non-cached way too.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.arc_swap" class="method has-srclink"><a class="srclink rightside" href="../../src/arc_swap/cache.rs.html#136-138">source</a><h4 class="code-header">pub fn <a href="#method.arc_swap" class="fnname">arc_swap</a>(&amp;self) -&gt; &amp;A::Target</h4></section></summary><div class="docblock"><p>Gives access to the (possibly shared) cached <a href="../struct.ArcSwapAny.html" title="ArcSwapAny"><code>ArcSwapAny</code></a>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.load" class="method has-srclink"><a class="srclink rightside" href="../../src/arc_swap/cache.rs.html#148-151">source</a><h4 class="code-header">pub fn <a href="#method.load" class="fnname">load</a>(&amp;mut self) -&gt; &amp;T</h4></section></summary><div class="docblock"><p>Loads the currently held value.</p>
<p>This first checks if the cached value is up to date. This check is very cheap.</p>
<p>If it is up to date, the cached value is simply returned without additional costs. If it is
outdated, a load is done on the underlying shared storage. The newly loaded value is then
stored in the cache and returned.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.map" class="method has-srclink"><a class="srclink rightside" href="../../src/arc_swap/cache.rs.html#218-226">source</a><h4 class="code-header">pub fn <a href="#method.map" class="fnname">map</a>&lt;F, U&gt;(self, f: F) -&gt; <a class="struct" href="struct.MapCache.html" title="struct arc_swap::cache::MapCache">MapCache</a>&lt;A, T, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: FnMut(&amp;T) -&gt; &amp;U,</span></h4></section></summary><div class="docblock"><p>Turns this cache into a cache with a projection inside the cached value.</p>
<p>You’d use this in case when some part of code needs access to fresh values of <code>U</code>, however
a bigger structure containing <code>U</code> is provided by this cache. The possibility of giving the
whole structure to the part of the code falls short in terms of reusability (the part of
the code could be used within multiple contexts, each with a bigger different structure
containing <code>U</code>) and code separation (the code shouldn’t needs to know about the big
structure).</p>
<h5 id="warning"><a href="#warning">Warning</a></h5>
<p>As the provided <code>f</code> is called inside every <a href="trait.Access.html#tymethod.load" title="Access::load"><code>load</code></a>, this one should be
cheap. Most often it is expected to be just a closure taking reference of some inner field.</p>
<p>For the same reasons, it should not have side effects and should never panic (these will
not break Rust’s safety rules, but might produce behaviour you don’t expect).</p>
<h5 id="examples-1"><a href="#examples-1">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>arc_swap::ArcSwap;
<span class="kw">use </span>arc_swap::cache::{Access, Cache};
<span class="kw">struct </span>InnerCfg {
answer: usize,
}
<span class="kw">struct </span>FullCfg {
inner: InnerCfg,
}
<span class="kw">fn </span>use_inner&lt;A: Access&lt;InnerCfg&gt;&gt;(cache: <span class="kw-2">&amp;mut </span>A) {
<span class="kw">let </span>value = cache.load();
<span class="macro">println!</span>(<span class="string">&quot;The answer is: {}&quot;</span>, value.answer);
}
<span class="kw">let </span>full_cfg = ArcSwap::from_pointee(FullCfg {
inner: InnerCfg {
answer: <span class="number">42</span>,
}
});
<span class="kw">let </span>cache = Cache::new(<span class="kw-2">&amp;</span>full_cfg);
use_inner(<span class="kw-2">&amp;mut </span>cache.map(|full| <span class="kw-2">&amp;</span>full.inner));
<span class="kw">let </span>inner_cfg = ArcSwap::from_pointee(InnerCfg { answer: <span class="number">24 </span>});
<span class="kw">let </span><span class="kw-2">mut </span>inner_cache = Cache::new(<span class="kw-2">&amp;</span>inner_cfg);
use_inner(<span class="kw-2">&amp;mut </span>inner_cache);</code></pre></div>
</div></details></div></details></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Access%3C%3CT%20as%20Deref%3E%3A%3ATarget%3E-for-Cache%3CA%2C%20T%3E" class="impl has-srclink"><a class="srclink rightside" href="../../src/arc_swap/cache.rs.html#229-238">source</a><a href="#impl-Access%3C%3CT%20as%20Deref%3E%3A%3ATarget%3E-for-Cache%3CA%2C%20T%3E" class="anchor"></a><h3 class="code-header">impl&lt;A, T, S&gt; <a class="trait" href="trait.Access.html" title="trait arc_swap::cache::Access">Access</a>&lt;&lt;T as Deref&gt;::Target&gt; for <a class="struct" href="struct.Cache.html" title="struct arc_swap::cache::Cache">Cache</a>&lt;A, T&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;A: Deref&lt;Target = <a class="struct" href="../struct.ArcSwapAny.html" title="struct arc_swap::ArcSwapAny">ArcSwapAny</a>&lt;T, S&gt;&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;T: Deref&lt;Target = &lt;T as <a class="trait" href="../trait.RefCnt.html" title="trait arc_swap::RefCnt">RefCnt</a>&gt;::<a class="associatedtype" href="../trait.RefCnt.html#associatedtype.Base" title="type arc_swap::RefCnt::Base">Base</a>&gt; + <a class="trait" href="../trait.RefCnt.html" title="trait arc_swap::RefCnt">RefCnt</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="../strategy/trait.Strategy.html" title="trait arc_swap::strategy::Strategy">Strategy</a>&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.load-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/arc_swap/cache.rs.html#235-237">source</a><a href="#method.load-1" class="anchor"></a><h4 class="code-header">fn <a href="trait.Access.html#tymethod.load" class="fnname">load</a>(&amp;mut self) -&gt; &amp;T::Target</h4></section></summary><div class='docblock'>Loads the value from cache. <a href="trait.Access.html#tymethod.load">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Clone-for-Cache%3CA%2C%20T%3E" class="impl has-srclink"><a class="srclink rightside" href="../../src/arc_swap/cache.rs.html#109">source</a><a href="#impl-Clone-for-Cache%3CA%2C%20T%3E" class="anchor"></a><h3 class="code-header">impl&lt;A:&nbsp;Clone, T:&nbsp;Clone&gt; Clone for <a class="struct" href="struct.Cache.html" title="struct arc_swap::cache::Cache">Cache</a>&lt;A, T&gt;</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/arc_swap/cache.rs.html#109">source</a><a href="#method.clone" class="anchor"></a><h4 class="code-header">fn <a class="fnname">clone</a>(&amp;self) -&gt; <a class="struct" href="struct.Cache.html" title="struct arc_swap::cache::Cache">Cache</a>&lt;A, T&gt;</h4></section></summary><div class='docblock'>Returns a copy of the value. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.clone_from" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">clone_from</a>(&amp;mut self, source: &amp;Self)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Debug-for-Cache%3CA%2C%20T%3E" class="impl has-srclink"><a class="srclink rightside" href="../../src/arc_swap/cache.rs.html#109">source</a><a href="#impl-Debug-for-Cache%3CA%2C%20T%3E" class="anchor"></a><h3 class="code-header">impl&lt;A:&nbsp;Debug, T:&nbsp;Debug&gt; Debug for <a class="struct" href="struct.Cache.html" title="struct arc_swap::cache::Cache">Cache</a>&lt;A, T&gt;</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/arc_swap/cache.rs.html#109">source</a><a href="#method.fmt" class="anchor"></a><h4 class="code-header">fn <a class="fnname">fmt</a>(&amp;self, f: &amp;mut Formatter&lt;'_&gt;) -&gt; Result</h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-From%3CA%3E-for-Cache%3CA%2C%20T%3E" class="impl has-srclink"><a class="srclink rightside" href="../../src/arc_swap/cache.rs.html#240-249">source</a><a href="#impl-From%3CA%3E-for-Cache%3CA%2C%20T%3E" class="anchor"></a><h3 class="code-header">impl&lt;A, T, S&gt; From&lt;A&gt; for <a class="struct" href="struct.Cache.html" title="struct arc_swap::cache::Cache">Cache</a>&lt;A, T&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;A: Deref&lt;Target = <a class="struct" href="../struct.ArcSwapAny.html" title="struct arc_swap::ArcSwapAny">ArcSwapAny</a>&lt;T, S&gt;&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../trait.RefCnt.html" title="trait arc_swap::RefCnt">RefCnt</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="../strategy/trait.Strategy.html" title="trait arc_swap::strategy::Strategy">Strategy</a>&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/arc_swap/cache.rs.html#246-248">source</a><a href="#method.from" class="anchor"></a><h4 class="code-header">fn <a class="fnname">from</a>(arc_swap: A) -&gt; Self</h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details></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"><section id="impl-RefUnwindSafe-for-Cache%3CA%2C%20T%3E" class="impl has-srclink"><a href="#impl-RefUnwindSafe-for-Cache%3CA%2C%20T%3E" class="anchor"></a><h3 class="code-header">impl&lt;A, T&gt; RefUnwindSafe for <a class="struct" href="struct.Cache.html" title="struct arc_swap::cache::Cache">Cache</a>&lt;A, T&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;A: RefUnwindSafe,<br>&nbsp;&nbsp;&nbsp;&nbsp;T: RefUnwindSafe,</span></h3></section><section id="impl-Send-for-Cache%3CA%2C%20T%3E" class="impl has-srclink"><a href="#impl-Send-for-Cache%3CA%2C%20T%3E" class="anchor"></a><h3 class="code-header">impl&lt;A, T&gt; Send for <a class="struct" href="struct.Cache.html" title="struct arc_swap::cache::Cache">Cache</a>&lt;A, T&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;A: Send,<br>&nbsp;&nbsp;&nbsp;&nbsp;T: Send,</span></h3></section><section id="impl-Sync-for-Cache%3CA%2C%20T%3E" class="impl has-srclink"><a href="#impl-Sync-for-Cache%3CA%2C%20T%3E" class="anchor"></a><h3 class="code-header">impl&lt;A, T&gt; Sync for <a class="struct" href="struct.Cache.html" title="struct arc_swap::cache::Cache">Cache</a>&lt;A, T&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;A: Sync,<br>&nbsp;&nbsp;&nbsp;&nbsp;T: Sync,</span></h3></section><section id="impl-Unpin-for-Cache%3CA%2C%20T%3E" class="impl has-srclink"><a href="#impl-Unpin-for-Cache%3CA%2C%20T%3E" class="anchor"></a><h3 class="code-header">impl&lt;A, T&gt; Unpin for <a class="struct" href="struct.Cache.html" title="struct arc_swap::cache::Cache">Cache</a>&lt;A, T&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;A: Unpin,<br>&nbsp;&nbsp;&nbsp;&nbsp;T: Unpin,</span></h3></section><section id="impl-UnwindSafe-for-Cache%3CA%2C%20T%3E" class="impl has-srclink"><a href="#impl-UnwindSafe-for-Cache%3CA%2C%20T%3E" class="anchor"></a><h3 class="code-header">impl&lt;A, T&gt; UnwindSafe for <a class="struct" href="struct.Cache.html" title="struct arc_swap::cache::Cache">Cache</a>&lt;A, T&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;A: UnwindSafe,<br>&nbsp;&nbsp;&nbsp;&nbsp;T: UnwindSafe,</span></h3></section></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Any-for-Cache%3CA%2C%20T%3E" class="impl has-srclink"><a href="#impl-Any-for-Cache%3CA%2C%20T%3E" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; Any for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl has-srclink"><a href="#method.type_id" class="anchor"></a><h4 class="code-header">fn <a class="fnname">type_id</a>(&amp;self) -&gt; TypeId</h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-Cache%3CA%2C%20T%3E" class="impl has-srclink"><a href="#impl-Borrow%3CT%3E-for-Cache%3CA%2C%20T%3E" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; Borrow&lt;T&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span><a href="#method.borrow" class="anchor"></a><h4 class="code-header">fn <a class="fnname">borrow</a>(&amp;self) -&gt; &amp;T</h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-Cache%3CA%2C%20T%3E" class="impl has-srclink"><a href="#impl-BorrowMut%3CT%3E-for-Cache%3CA%2C%20T%3E" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; BorrowMut&lt;T&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">fn <a class="fnname">borrow_mut</a>(&amp;mut self) -&gt; &amp;mut T</h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-Cache%3CA%2C%20T%3E" class="impl has-srclink"><a href="#impl-From%3CT%3E-for-Cache%3CA%2C%20T%3E" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; From&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from-1" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.from-1" class="anchor"></a><h4 class="code-header">fn <a class="fnname">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-Cache%3CA%2C%20T%3E" class="impl has-srclink"><a href="#impl-Into%3CU%3E-for-Cache%3CA%2C%20T%3E" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; Into&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: From&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code>[From]&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ToOwned-for-Cache%3CA%2C%20T%3E" class="impl has-srclink"><a href="#impl-ToOwned-for-Cache%3CA%2C%20T%3E" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; ToOwned for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: Clone,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Owned" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl has-srclink"><a href="#method.to_owned" class="anchor"></a><h4 class="code-header">fn <a class="fnname">to_owned</a>(&amp;self) -&gt; T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl has-srclink"><a href="#method.clone_into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">clone_into</a>(&amp;self, target: &amp;mut T)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-Cache%3CA%2C%20T%3E" class="impl has-srclink"><a href="#impl-TryFrom%3CU%3E-for-Cache%3CA%2C%20T%3E" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; TryFrom&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: Into&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = Infallible</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.try_from" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_from</a>(value: U) -&gt; Result&lt;T, &lt;T as TryFrom&lt;U&gt;&gt;::Error&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-Cache%3CA%2C%20T%3E" class="impl has-srclink"><a href="#impl-TryInto%3CU%3E-for-Cache%3CA%2C%20T%3E" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; TryInto&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: TryFrom&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = &lt;U as TryFrom&lt;T&gt;&gt;::Error</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.try_into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_into</a>(self) -&gt; Result&lt;U, &lt;U as TryFrom&lt;T&gt;&gt;::Error&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-current-crate="arc_swap" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>