mCaptcha/mcaptcha/type.ArcData.html

907 lines
197 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 `ArcData` type in crate `mcaptcha`."><title>ArcData in mcaptcha - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-fa3bb1812debf86c.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="mcaptcha" data-themes="" data-resource-suffix="" data-rustdoc-version="1.74.1 (a28077b28 2023-12-04)" data-channel="1.74.1" data-search-js="search-8be46b629f5f14a8.js" data-settings-js="settings-74424d7eec62a23e.js" ><script src="../static.files/storage-fec3eaa3851e447d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-c5bd66d33317d69f.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-5d8b3c7633ad77ba.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc type"><!--[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="logo-container" href="../mcaptcha/index.html"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a></nav><nav class="sidebar"><a class="logo-container" href="../mcaptcha/index.html"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2 class="location"><a href="#">ArcData</a></h2><div class="sidebar-elems"><section><h3><a href="#aliased-type">Aliased type</a></h3><h3><a href="#fields">Fields</a></h3><ul class="block"><li><a href="#structfield.alloc">alloc</a></li><li><a href="#structfield.phantom">phantom</a></li><li><a href="#structfield.ptr">ptr</a></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block"><li><a href="#method.allocator">allocator</a></li><li><a href="#method.as_ptr">as_ptr</a></li><li><a href="#method.decrement_strong_count">decrement_strong_count</a></li><li><a href="#method.decrement_strong_count_in">decrement_strong_count_in</a></li><li><a href="#method.downgrade">downgrade</a></li><li><a href="#method.from_raw">from_raw</a></li><li><a href="#method.from_raw_in">from_raw_in</a></li><li><a href="#method.get_mut">get_mut</a></li><li><a href="#method.get_mut_unchecked">get_mut_unchecked</a></li><li><a href="#method.increment_strong_count">increment_strong_count</a></li><li><a href="#method.increment_strong_count_in">increment_strong_count_in</a></li><li><a href="#method.into_inner">into_inner</a></li><li><a href="#method.into_raw">into_raw</a></li><li><a href="#method.make_mut">make_mut</a></li><li><a href="#method.new">new</a></li><li><a href="#method.new_cyclic">new_cyclic</a></li><li><a href="#method.new_in">new_in</a></li><li><a href="#method.new_uninit">new_uninit</a></li><li><a href="#method.new_uninit_in">new_uninit_in</a></li><li><a href="#method.new_zeroed">new_zeroed</a></li><li><a href="#method.new_zeroed_in">new_zeroed_in</a></li><li><a href="#method.pin">pin</a></li><li><a href="#method.pin_in">pin_in</a></li><li><a href="#method.ptr_eq">ptr_eq</a></li><li><a href="#method.strong_count">strong_count</a></li><li><a href="#method.try_new">try_new</a></li><li><a href="#method.try_new_in">try_new_in</a></li><li><a href="#method.try_new_uninit">try_new_uninit</a></li><li><a href="#method.try_new_uninit_in">try_new_uninit_in</a></li><li><a href="#method.try_new_zeroed">try_new_zeroed</a></li><li><a href="#method.try_new_zeroed_in">try_new_zeroed_in</a></li><li><a href="#method.try_pin">try_pin</a></li><li><a href="#method.try_pin_in">try_pin_in</a></li><li><a href="#method.try_unwrap">try_unwrap</a></li><li><a href="#method.unwrap_or_clone">unwrap_or_clone</a></li><li><a href="#method.weak_count">weak_count</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block"><li><a href="#impl-AsFd-for-Arc%3CT,+Global%3E">AsFd</a></li><li><a href="#impl-AsRawFd-for-Arc%3CT,+Global%3E">AsRawFd</a></li><li><a href="#impl-AsRef%3CT%3E-for-Arc%3CT,+A%3E">AsRef&lt;T&gt;</a></li><li><a href="#impl-Borrow%3CT%3E-for-Arc%3CT,+A%3E">Borrow&lt;T&gt;</a></li><li><a href="#impl-Clone-for-Arc%3CT,+A%3E">Clone</a></li><li><a href="#impl-CoerceUnsized%3CArc%3CU,+A%3E%3E-for-Arc%3CT,+A%3E">CoerceUnsized&lt;Arc&lt;U, A&gt;&gt;</a></li><li><a href="#impl-Debug-for-Arc%3CT,+A%3E">Debug</a></li><li><a href="#impl-Default-for-Arc%3CT,+Global%3E">Default</a></li><li><a href="#impl-Deref-for-Arc%3CT,+A%3E">Deref</a></li><li><a href="#impl-Deserialize%3C'de%3E-for-Arc%3CT,+Global%3E">Deserialize&lt;&#x27;de&gt;</a></li><li><a href="#impl-DispatchFromDyn%3CArc%3CU,+Global%3E%3E-for-Arc%3CT,+Global%3E">DispatchFromDyn&lt;Arc&lt;U, Global&gt;&gt;</a></li><li><a href="#impl-Display-for-Arc%3CT,+A%3E">Display</a></li><li><a href="#impl-Drop-for-Arc%3CT,+A%3E">Drop</a></li><li><a href="#impl-Eq-for-Arc%3CT,+A%3E">Eq</a></li><li><a href="#impl-Error-for-Arc%3CT,+Global%3E">Error</a></li><li><a href="#impl-From%3CBox%3CT,+A%3E%3E-for-Arc%3CT,+A%3E">From&lt;Box&lt;T, A&gt;&gt;</a></li><li><a href="#impl-From%3CCow%3C'a,+B%3E%3E-for-Arc%3CB,+Global%3E">From&lt;Cow&lt;&#x27;a, B&gt;&gt;</a></li><li><a href="#impl-From%3CT%3E-for-Arc%3CT,+Global%3E">From&lt;T&gt;</a></li><li><a href="#impl-Hash-for-Arc%3CT,+A%3E">Hash</a></li><li><a href="#impl-LocalSpawn-for-Arc%3CSp,+Global%3E">LocalSpawn</a></li><li><a href="#impl-Log-for-Arc%3CT,+Global%3E">Log</a></li><li><a href="#impl-Message-for-Arc%3CM,+Global%3E">Message</a></li><li><a href="#impl-MessageResponse%3CA,+M%3E-for-Arc%3CI,+Global%3E">MessageResponse&lt;A, M&gt;</a></li><li><a href="#impl-Ord-for-Arc%3CT,+A%3E">Ord</a></li><li><a href="#impl-PartialEq%3CArc%3CT,+A%3E%3E-for-Arc%3CT,+A%3E">PartialEq&lt;Arc&lt;T, A&gt;&gt;</a></li><li><a href="#impl-PartialOrd%3CArc%3CT,+A%3E%3E-for-Arc%3CT,+A%3E">PartialOrd&lt;Arc&lt;T, A&gt;&gt;</a></li><li><a href="#impl-Pointer-for-Arc%3CT,+A%3E">Pointer</a></li><li><a href="#impl-RefCnt-for-Arc%3CT,+Global%3E">RefCnt</a></li><li><a href="#impl-Render-for-Arc%3CT,+Global%3E">Render</a></li><li><a href="#impl-Send-for-Arc%3CT,+A%3E">Send</a></li><li><a href="#impl-Serialize-for-Arc%3CT,+Global%3E">Serialize</a></li><li><a href="#impl-ServiceFactory%3CReq%3E-for-Arc%3CS,+Global%3E">ServiceFactory&lt;Req&gt;</a></li><li><a href="#impl-Spawn-for-Arc%3CSp,+Global%3E">Spawn</a></li><li><a href="#impl-Subscriber-for-Arc%3CS,+Global%3E">Subscriber</a></li><li><a href="#impl-Sync-for-Arc%3CT,+A%3E">Sync</a></li><li><a href="#impl-Transform%3CS,+Req%3E-for-Arc%3CT,+Global%3E">Transform&lt;S, Req&gt;</a></li><li><a href="#impl-Unpin-for-Arc%3CT,+A%3E">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Arc%3CT,+A%3E">UnwindSafe</a></li></ul></section><h2><a href="index.html">In mcaptcha</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" 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="../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Type Alias <a href="index.html">mcaptcha</a>::<wbr><a class="type" href="#">ArcData</a><button id="copy-path" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../src/mcaptcha/main.rs.html#90">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub type ArcData = <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;<a class="struct" href="data/struct.Data.html" title="struct mcaptcha::data::Data">Data</a>&gt;;</code></pre><h2 id="aliased-type" class="small-section-header">Aliased Type<a href="#aliased-type" class="anchor">§</a></h2><pre class="rust item-decl"><code>struct ArcData {
ptr: <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.ArcInner.html" title="struct alloc::sync::ArcInner">ArcInner</a>&lt;<a class="struct" href="data/struct.Data.html" title="struct mcaptcha::data::Data">Data</a>&gt;&gt;,
phantom: <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/marker/struct.PhantomData.html" title="struct core::marker::PhantomData">PhantomData</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.ArcInner.html" title="struct alloc::sync::ArcInner">ArcInner</a>&lt;<a class="struct" href="data/struct.Data.html" title="struct mcaptcha::data::Data">Data</a>&gt;&gt;,
alloc: <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>,
}</code></pre><h2 id="fields" class="fields small-section-header">Fields<a href="#fields" class="anchor">§</a></h2><span id="structfield.ptr" class="structfield small-section-header"><a href="#structfield.ptr" class="anchor field">§</a><code>ptr: <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.ArcInner.html" title="struct alloc::sync::ArcInner">ArcInner</a>&lt;<a class="struct" href="data/struct.Data.html" title="struct mcaptcha::data::Data">Data</a>&gt;&gt;</code></span><span id="structfield.phantom" class="structfield small-section-header"><a href="#structfield.phantom" class="anchor field">§</a><code>phantom: <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/marker/struct.PhantomData.html" title="struct core::marker::PhantomData">PhantomData</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.ArcInner.html" title="struct alloc::sync::ArcInner">ArcInner</a>&lt;<a class="struct" href="data/struct.Data.html" title="struct mcaptcha::data::Data">Data</a>&gt;&gt;</code></span><span id="structfield.alloc" class="structfield small-section-header"><a href="#structfield.alloc" class="anchor field">§</a><code>alloc: <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a></code></span><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Arc%3CT,+Global%3E" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#372">source</a><a href="#impl-Arc%3CT,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#385">source</a></span><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>(data: T) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;</h4></section></summary><div class="docblock"><p>Constructs a new <code>Arc&lt;T&gt;</code>.</p>
<h5 id="examples"><a href="#examples">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>five = Arc::new(<span class="number">5</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.new_cyclic" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.60.0">1.60.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#450-452">source</a></span><h4 class="code-header">pub fn <a href="#method.new_cyclic" class="fn">new_cyclic</a>&lt;F&gt;(data_fn: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;<span class="where fmt-newline">where
F: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&amp;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Weak.html" title="struct alloc::sync::Weak">Weak</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;) -&gt; T,</span></h4></section></summary><div class="docblock"><p>Constructs a new <code>Arc&lt;T&gt;</code> while giving you a <code>Weak&lt;T&gt;</code> to the allocation,
to allow you to construct a <code>T</code> which holds a weak pointer to itself.</p>
<p>Generally, a structure circularly referencing itself, either directly or
indirectly, should not hold a strong reference to itself to prevent a memory leak.
Using this function, you get access to the weak pointer during the
initialization of <code>T</code>, before the <code>Arc&lt;T&gt;</code> is created, such that you can
clone and store it inside the <code>T</code>.</p>
<p><code>new_cyclic</code> first allocates the managed allocation for the <code>Arc&lt;T&gt;</code>,
then calls your closure, giving it a <code>Weak&lt;T&gt;</code> to this allocation,
and only afterwards completes the construction of the <code>Arc&lt;T&gt;</code> by placing
the <code>T</code> returned from your closure into the allocation.</p>
<p>Since the new <code>Arc&lt;T&gt;</code> is not fully-constructed until <code>Arc&lt;T&gt;::new_cyclic</code>
returns, calling <a href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Weak.html#method.upgrade" title="method alloc::sync::Weak::upgrade"><code>upgrade</code></a> on the weak reference inside your closure will
fail and result in a <code>None</code> value.</p>
<h5 id="panics"><a href="#panics">Panics</a></h5>
<p>If <code>data_fn</code> panics, the panic is propagated to the caller, and the
temporary <a href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Weak.html" title="struct alloc::sync::Weak"><code>Weak&lt;T&gt;</code></a> is dropped normally.</p>
<h5 id="example"><a href="#example">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::{Arc, Weak};
<span class="kw">struct </span>Gadget {
me: Weak&lt;Gadget&gt;,
}
<span class="kw">impl </span>Gadget {
<span class="doccomment">/// Construct a reference counted Gadget.
</span><span class="kw">fn </span>new() -&gt; Arc&lt;<span class="self">Self</span>&gt; {
<span class="comment">// `me` is a `Weak&lt;Gadget&gt;` pointing at the new allocation of the
// `Arc` we&#39;re constructing.
</span>Arc::new_cyclic(|me| {
<span class="comment">// Create the actual struct here.
</span>Gadget { me: me.clone() }
})
}
<span class="doccomment">/// Return a reference counted pointer to Self.
</span><span class="kw">fn </span>me(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; Arc&lt;<span class="self">Self</span>&gt; {
<span class="self">self</span>.me.upgrade().unwrap()
}
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.new_uninit" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#527">source</a><h4 class="code-header">pub fn <a href="#method.new_uninit" class="fn">new_uninit</a>() -&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;<a class="union" href="https://doc.rust-lang.org/1.74.1/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a>&lt;T&gt;, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>new_uninit</code>)</span></div></span></summary><div class="docblock"><p>Constructs a new <code>Arc</code> with uninitialized contents.</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="attr">#![feature(new_uninit)]
#![feature(get_mut_unchecked)]
</span><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span><span class="kw-2">mut </span>five = Arc::&lt;u32&gt;::new_uninit();
<span class="comment">// Deferred initialization:
</span>Arc::get_mut(<span class="kw-2">&amp;mut </span>five).unwrap().write(<span class="number">5</span>);
<span class="kw">let </span>five = <span class="kw">unsafe </span>{ five.assume_init() };
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>five, <span class="number">5</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.new_zeroed" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#561">source</a><h4 class="code-header">pub fn <a href="#method.new_zeroed" class="fn">new_zeroed</a>() -&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;<a class="union" href="https://doc.rust-lang.org/1.74.1/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a>&lt;T&gt;, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>new_uninit</code>)</span></div></span></summary><div class="docblock"><p>Constructs a new <code>Arc</code> with uninitialized contents, with the memory
being filled with <code>0</code> bytes.</p>
<p>See <a href="https://doc.rust-lang.org/1.74.1/core/mem/maybe_uninit/union.MaybeUninit.html#method.zeroed" title="associated function core::mem::maybe_uninit::MaybeUninit::zeroed"><code>MaybeUninit::zeroed</code></a> for examples of correct and incorrect usage
of this method.</p>
<h5 id="examples-2"><a href="#examples-2">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(new_uninit)]
</span><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>zero = Arc::&lt;u32&gt;::new_zeroed();
<span class="kw">let </span>zero = <span class="kw">unsafe </span>{ zero.assume_init() };
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>zero, <span class="number">0</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.pin" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.33.0">1.33.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#576">source</a></span><h4 class="code-header">pub fn <a href="#method.pin" class="fn">pin</a>(data: T) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Constructs a new <code>Pin&lt;Arc&lt;T&gt;&gt;</code>. If <code>T</code> does not implement <code>Unpin</code>, then
<code>data</code> will be pinned in memory and unable to be moved.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_pin" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#583">source</a><h4 class="code-header">pub fn <a href="#method.try_pin" class="fn">try_pin</a>(data: T) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;&gt;, <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/alloc/struct.AllocError.html" title="struct core::alloc::AllocError">AllocError</a>&gt;</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Constructs a new <code>Pin&lt;Arc&lt;T&gt;&gt;</code>, return an error if allocation fails.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_new" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#600">source</a><h4 class="code-header">pub fn <a href="#method.try_new" class="fn">try_new</a>(data: T) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;, <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/alloc/struct.AllocError.html" title="struct core::alloc::AllocError">AllocError</a>&gt;</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Constructs a new <code>Arc&lt;T&gt;</code>, returning an error if allocation fails.</p>
<h5 id="examples-3"><a href="#examples-3">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(allocator_api)]
</span><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>five = Arc::try_new(<span class="number">5</span>)<span class="question-mark">?</span>;</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_new_uninit" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#634">source</a><h4 class="code-header">pub fn <a href="#method.try_new_uninit" class="fn">try_new_uninit</a>() -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;<a class="union" href="https://doc.rust-lang.org/1.74.1/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a>&lt;T&gt;, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;, <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/alloc/struct.AllocError.html" title="struct core::alloc::AllocError">AllocError</a>&gt;</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Constructs a new <code>Arc</code> with uninitialized contents, returning an error
if allocation fails.</p>
<h5 id="examples-4"><a href="#examples-4">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(new_uninit, allocator_api)]
#![feature(get_mut_unchecked)]
</span><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span><span class="kw-2">mut </span>five = Arc::&lt;u32&gt;::try_new_uninit()<span class="question-mark">?</span>;
<span class="comment">// Deferred initialization:
</span>Arc::get_mut(<span class="kw-2">&amp;mut </span>five).unwrap().write(<span class="number">5</span>);
<span class="kw">let </span>five = <span class="kw">unsafe </span>{ five.assume_init() };
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>five, <span class="number">5</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_new_zeroed" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#667">source</a><h4 class="code-header">pub fn <a href="#method.try_new_zeroed" class="fn">try_new_zeroed</a>() -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;<a class="union" href="https://doc.rust-lang.org/1.74.1/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a>&lt;T&gt;, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;, <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/alloc/struct.AllocError.html" title="struct core::alloc::AllocError">AllocError</a>&gt;</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Constructs a new <code>Arc</code> with uninitialized contents, with the memory
being filled with <code>0</code> bytes, returning an error if allocation fails.</p>
<p>See <a href="https://doc.rust-lang.org/1.74.1/core/mem/maybe_uninit/union.MaybeUninit.html#method.zeroed" title="associated function core::mem::maybe_uninit::MaybeUninit::zeroed"><code>MaybeUninit::zeroed</code></a> for examples of correct and incorrect usage
of this method.</p>
<h5 id="examples-5"><a href="#examples-5">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(new_uninit, allocator_api)]
</span><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>zero = Arc::&lt;u32&gt;::try_new_zeroed()<span class="question-mark">?</span>;
<span class="kw">let </span>zero = <span class="kw">unsafe </span>{ zero.assume_init() };
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>zero, <span class="number">0</span>);</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Arc%3CT,+A%3E" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#678">source</a><a href="#impl-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.allocator" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#686">source</a><h4 class="code-header">pub fn <a href="#method.allocator" class="fn">allocator</a>(this: &amp;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.reference.html">&amp;A</a></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Returns a reference to the underlying allocator.</p>
<p>Note: this is an associated function, which means that you have
to call it as <code>Arc::allocator(&amp;a)</code> instead of <code>a.allocator()</code>. This
is so that there is no conflict with a method on the inner type.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.new_in" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#704">source</a><h4 class="code-header">pub fn <a href="#method.new_in" class="fn">new_in</a>(data: T, alloc: A) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Constructs a new <code>Arc&lt;T&gt;</code> in the provided allocator.</p>
<h5 id="examples-6"><a href="#examples-6">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(allocator_api)]
</span><span class="kw">use </span>std::sync::Arc;
<span class="kw">use </span>std::alloc::System;
<span class="kw">let </span>five = Arc::new_in(<span class="number">5</span>, System);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.new_uninit_in" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#746">source</a><h4 class="code-header">pub fn <a href="#method.new_uninit_in" class="fn">new_uninit_in</a>(alloc: A) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;<a class="union" href="https://doc.rust-lang.org/1.74.1/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a>&lt;T&gt;, A&gt;</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Constructs a new <code>Arc</code> with uninitialized contents in the provided allocator.</p>
<h5 id="examples-7"><a href="#examples-7">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(new_uninit)]
#![feature(get_mut_unchecked)]
#![feature(allocator_api)]
</span><span class="kw">use </span>std::sync::Arc;
<span class="kw">use </span>std::alloc::System;
<span class="kw">let </span><span class="kw-2">mut </span>five = Arc::&lt;u32, <span class="kw">_</span>&gt;::new_uninit_in(System);
<span class="kw">let </span>five = <span class="kw">unsafe </span>{
<span class="comment">// Deferred initialization:
</span>Arc::get_mut_unchecked(<span class="kw-2">&amp;mut </span>five).as_mut_ptr().write(<span class="number">5</span>);
five.assume_init()
};
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>five, <span class="number">5</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.new_zeroed_in" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#785">source</a><h4 class="code-header">pub fn <a href="#method.new_zeroed_in" class="fn">new_zeroed_in</a>(alloc: A) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;<a class="union" href="https://doc.rust-lang.org/1.74.1/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a>&lt;T&gt;, A&gt;</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Constructs a new <code>Arc</code> with uninitialized contents, with the memory
being filled with <code>0</code> bytes, in the provided allocator.</p>
<p>See <a href="https://doc.rust-lang.org/1.74.1/core/mem/maybe_uninit/union.MaybeUninit.html#method.zeroed" title="associated function core::mem::maybe_uninit::MaybeUninit::zeroed"><code>MaybeUninit::zeroed</code></a> for examples of correct and incorrect usage
of this method.</p>
<h5 id="examples-8"><a href="#examples-8">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(new_uninit)]
#![feature(allocator_api)]
</span><span class="kw">use </span>std::sync::Arc;
<span class="kw">use </span>std::alloc::System;
<span class="kw">let </span>zero = Arc::&lt;u32, <span class="kw">_</span>&gt;::new_zeroed_in(System);
<span class="kw">let </span>zero = <span class="kw">unsafe </span>{ zero.assume_init() };
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>zero, <span class="number">0</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.pin_in" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#803">source</a><h4 class="code-header">pub fn <a href="#method.pin_in" class="fn">pin_in</a>(data: T, alloc: A) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;&gt;</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Constructs a new <code>Pin&lt;Arc&lt;T, A&gt;&gt;</code> in the provided allocator. If <code>T</code> does not implement <code>Unpin</code>,
then <code>data</code> will be pinned in memory and unable to be moved.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_pin_in" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#811">source</a><h4 class="code-header">pub fn <a href="#method.try_pin_in" class="fn">try_pin_in</a>(data: T, alloc: A) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;&gt;, <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/alloc/struct.AllocError.html" title="struct core::alloc::AllocError">AllocError</a>&gt;</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Constructs a new <code>Pin&lt;Arc&lt;T, A&gt;&gt;</code> in the provided allocator, return an error if allocation
fails.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_new_in" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#831">source</a><h4 class="code-header">pub fn <a href="#method.try_new_in" class="fn">try_new_in</a>(data: T, alloc: A) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;, <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/alloc/struct.AllocError.html" title="struct core::alloc::AllocError">AllocError</a>&gt;</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Constructs a new <code>Arc&lt;T, A&gt;</code> in the provided allocator, returning an error if allocation fails.</p>
<h5 id="examples-9"><a href="#examples-9">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(allocator_api)]
</span><span class="kw">use </span>std::sync::Arc;
<span class="kw">use </span>std::alloc::System;
<span class="kw">let </span>five = Arc::try_new_in(<span class="number">5</span>, System)<span class="question-mark">?</span>;</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_new_uninit_in" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#873">source</a><h4 class="code-header">pub fn <a href="#method.try_new_uninit_in" class="fn">try_new_uninit_in</a>(alloc: A) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;<a class="union" href="https://doc.rust-lang.org/1.74.1/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a>&lt;T&gt;, A&gt;, <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/alloc/struct.AllocError.html" title="struct core::alloc::AllocError">AllocError</a>&gt;</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Constructs a new <code>Arc</code> with uninitialized contents, in the provided allocator, returning an
error if allocation fails.</p>
<h5 id="examples-10"><a href="#examples-10">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(new_uninit, allocator_api)]
#![feature(get_mut_unchecked)]
</span><span class="kw">use </span>std::sync::Arc;
<span class="kw">use </span>std::alloc::System;
<span class="kw">let </span><span class="kw-2">mut </span>five = Arc::&lt;u32, <span class="kw">_</span>&gt;::try_new_uninit_in(System)<span class="question-mark">?</span>;
<span class="kw">let </span>five = <span class="kw">unsafe </span>{
<span class="comment">// Deferred initialization:
</span>Arc::get_mut_unchecked(<span class="kw-2">&amp;mut </span>five).as_mut_ptr().write(<span class="number">5</span>);
five.assume_init()
};
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>five, <span class="number">5</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_new_zeroed_in" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#912">source</a><h4 class="code-header">pub fn <a href="#method.try_new_zeroed_in" class="fn">try_new_zeroed_in</a>(alloc: A) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;<a class="union" href="https://doc.rust-lang.org/1.74.1/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a>&lt;T&gt;, A&gt;, <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/alloc/struct.AllocError.html" title="struct core::alloc::AllocError">AllocError</a>&gt;</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Constructs a new <code>Arc</code> with uninitialized contents, with the memory
being filled with <code>0</code> bytes, in the provided allocator, returning an error if allocation
fails.</p>
<p>See <a href="https://doc.rust-lang.org/1.74.1/core/mem/maybe_uninit/union.MaybeUninit.html#method.zeroed" title="associated function core::mem::maybe_uninit::MaybeUninit::zeroed"><code>MaybeUninit::zeroed</code></a> for examples of correct and incorrect usage
of this method.</p>
<h5 id="examples-11"><a href="#examples-11">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(new_uninit, allocator_api)]
</span><span class="kw">use </span>std::sync::Arc;
<span class="kw">use </span>std::alloc::System;
<span class="kw">let </span>zero = Arc::&lt;u32, <span class="kw">_</span>&gt;::try_new_zeroed_in(System)<span class="question-mark">?</span>;
<span class="kw">let </span>zero = <span class="kw">unsafe </span>{ zero.assume_init() };
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>zero, <span class="number">0</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_unwrap" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.4.0">1.4.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#956">source</a></span><h4 class="code-header">pub fn <a href="#method.try_unwrap" class="fn">try_unwrap</a>(this: <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;&gt;</h4></section></summary><div class="docblock"><p>Returns the inner value, if the <code>Arc</code> has exactly one strong reference.</p>
<p>Otherwise, an <a href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html#variant.Err" title="variant core::result::Result::Err"><code>Err</code></a> is returned with the same <code>Arc</code> that was
passed in.</p>
<p>This will succeed even if there are outstanding weak references.</p>
<p>It is strongly recommended to use <a href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html#method.into_inner" title="associated function alloc::sync::Arc::into_inner"><code>Arc::into_inner</code></a> instead if you dont
want to keep the <code>Arc</code> in the <a href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html#variant.Err" title="variant core::result::Result::Err"><code>Err</code></a> case.
Immediately dropping the <a href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html#variant.Err" title="variant core::result::Result::Err"><code>Err</code></a> payload, like in the expression
<code>Arc::try_unwrap(this).ok()</code>, can still cause the strong count to
drop to zero and the inner value of the <code>Arc</code> to be dropped:
For instance if two threads each execute this expression in parallel, then
there is a race condition. The threads could first both check whether they
have the last clone of their <code>Arc</code> via <code>Arc::try_unwrap</code>, and then
both drop their <code>Arc</code> in the call to <a href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html#method.ok" title="method core::result::Result::ok"><code>ok</code></a>,
taking the strong count from two down to zero.</p>
<h5 id="examples-12"><a href="#examples-12">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>x = Arc::new(<span class="number">3</span>);
<span class="macro">assert_eq!</span>(Arc::try_unwrap(x), <span class="prelude-val">Ok</span>(<span class="number">3</span>));
<span class="kw">let </span>x = Arc::new(<span class="number">4</span>);
<span class="kw">let </span>_y = Arc::clone(<span class="kw-2">&amp;</span>x);
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>Arc::try_unwrap(x).unwrap_err(), <span class="number">4</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_inner" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.70.0">1.70.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#1067">source</a></span><h4 class="code-header">pub fn <a href="#method.into_inner" class="fn">into_inner</a>(this: <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;T&gt;</h4></section></summary><div class="docblock"><p>Returns the inner value, if the <code>Arc</code> has exactly one strong reference.</p>
<p>Otherwise, <a href="https://doc.rust-lang.org/1.74.1/core/option/enum.Option.html#variant.None" title="variant core::option::Option::None"><code>None</code></a> is returned and the <code>Arc</code> is dropped.</p>
<p>This will succeed even if there are outstanding weak references.</p>
<p>If <code>Arc::into_inner</code> is called on every clone of this <code>Arc</code>,
it is guaranteed that exactly one of the calls returns the inner value.
This means in particular that the inner value is not dropped.</p>
<p>The similar expression <code>Arc::try_unwrap(this).ok()</code> does not
offer such a guarantee. See the last example below
and the documentation of <a href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html#method.try_unwrap" title="associated function alloc::sync::Arc::try_unwrap"><code>Arc::try_unwrap</code></a>.</p>
<h5 id="examples-13"><a href="#examples-13">Examples</a></h5>
<p>Minimal example demonstrating the guarantee that <code>Arc::into_inner</code> gives.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>x = Arc::new(<span class="number">3</span>);
<span class="kw">let </span>y = Arc::clone(<span class="kw-2">&amp;</span>x);
<span class="comment">// Two threads calling `Arc::into_inner` on both clones of an `Arc`:
</span><span class="kw">let </span>x_thread = std::thread::spawn(|| Arc::into_inner(x));
<span class="kw">let </span>y_thread = std::thread::spawn(|| Arc::into_inner(y));
<span class="kw">let </span>x_inner_value = x_thread.join().unwrap();
<span class="kw">let </span>y_inner_value = y_thread.join().unwrap();
<span class="comment">// One of the threads is guaranteed to receive the inner value:
</span><span class="macro">assert!</span>(<span class="macro">matches!</span>(
(x_inner_value, y_inner_value),
(<span class="prelude-val">None</span>, <span class="prelude-val">Some</span>(<span class="number">3</span>)) | (<span class="prelude-val">Some</span>(<span class="number">3</span>), <span class="prelude-val">None</span>)
));
<span class="comment">// The result could also be `(None, None)` if the threads called
// `Arc::try_unwrap(x).ok()` and `Arc::try_unwrap(y).ok()` instead.</span></code></pre></div>
<p>A more practical example demonstrating the need for <code>Arc::into_inner</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="comment">// Definition of a simple singly linked list using `Arc`:
</span><span class="attr">#[derive(Clone)]
</span><span class="kw">struct </span>LinkedList&lt;T&gt;(<span class="prelude-ty">Option</span>&lt;Arc&lt;Node&lt;T&gt;&gt;&gt;);
<span class="kw">struct </span>Node&lt;T&gt;(T, <span class="prelude-ty">Option</span>&lt;Arc&lt;Node&lt;T&gt;&gt;&gt;);
<span class="comment">// Dropping a long `LinkedList&lt;T&gt;` relying on the destructor of `Arc`
// can cause a stack overflow. To prevent this, we can provide a
// manual `Drop` implementation that does the destruction in a loop:
</span><span class="kw">impl</span>&lt;T&gt; Drop <span class="kw">for </span>LinkedList&lt;T&gt; {
<span class="kw">fn </span>drop(<span class="kw-2">&amp;mut </span><span class="self">self</span>) {
<span class="kw">let </span><span class="kw-2">mut </span>link = <span class="self">self</span>.<span class="number">0</span>.take();
<span class="kw">while let </span><span class="prelude-val">Some</span>(arc_node) = link.take() {
<span class="kw">if let </span><span class="prelude-val">Some</span>(Node(_value, next)) = Arc::into_inner(arc_node) {
link = next;
}
}
}
}
<span class="comment">// Implementation of `new` and `push` omitted
</span><span class="kw">impl</span>&lt;T&gt; LinkedList&lt;T&gt; {
<span class="comment">/* ... */
</span>}
<span class="comment">// The following code could have still caused a stack overflow
// despite the manual `Drop` impl if that `Drop` impl had used
// `Arc::try_unwrap(arc).ok()` instead of `Arc::into_inner(arc)`.
// Create a long list and clone it
</span><span class="kw">let </span><span class="kw-2">mut </span>x = LinkedList::new();
<span class="kw">for </span>i <span class="kw">in </span><span class="number">0</span>..<span class="number">100000 </span>{
x.push(i); <span class="comment">// Adds i to the front of x
</span>}
<span class="kw">let </span>y = x.clone();
<span class="comment">// Drop the clones in parallel
</span><span class="kw">let </span>x_thread = std::thread::spawn(|| drop(x));
<span class="kw">let </span>y_thread = std::thread::spawn(|| drop(y));
x_thread.join().unwrap();
y_thread.join().unwrap();</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Arc%3CT,+Global%3E-1" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#1327">source</a><a href="#impl-Arc%3CT,+Global%3E-1" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;<span class="where fmt-newline">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from_raw" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.17.0">1.17.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#1367">source</a></span><h4 class="code-header">pub unsafe fn <a href="#method.from_raw" class="fn">from_raw</a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.pointer.html">*const T</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;</h4></section></summary><div class="docblock"><p>Constructs an <code>Arc&lt;T&gt;</code> from a raw pointer.</p>
<p>The raw pointer must have been previously returned by a call to
<a href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html#method.into_raw" title="associated function alloc::sync::Arc::into_raw"><code>Arc&lt;U&gt;::into_raw</code></a> where <code>U</code> must have the same size and
alignment as <code>T</code>. This is trivially true if <code>U</code> is <code>T</code>.
Note that if <code>U</code> is not <code>T</code> but has the same size and alignment, this is
basically like transmuting references of different types. See
<a href="https://doc.rust-lang.org/1.74.1/core/intrinsics/fn.transmute.html" title="fn core::intrinsics::transmute"><code>mem::transmute</code></a> for more information on what
restrictions apply in this case.</p>
<p>The user of <code>from_raw</code> has to make sure a specific value of <code>T</code> is only
dropped once.</p>
<p>This function is unsafe because improper use may lead to memory unsafety,
even if the returned <code>Arc&lt;T&gt;</code> is never accessed.</p>
<h5 id="examples-14"><a href="#examples-14">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>x = Arc::new(<span class="string">&quot;hello&quot;</span>.to_owned());
<span class="kw">let </span>x_ptr = Arc::into_raw(x);
<span class="kw">unsafe </span>{
<span class="comment">// Convert back to an `Arc` to prevent leak.
</span><span class="kw">let </span>x = Arc::from_raw(x_ptr);
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;*</span>x, <span class="string">&quot;hello&quot;</span>);
<span class="comment">// Further calls to `Arc::from_raw(x_ptr)` would be memory-unsafe.
</span>}
<span class="comment">// The memory was freed when `x` went out of scope above, so `x_ptr` is now dangling!</span></code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.increment_strong_count" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.51.0">1.51.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#1399">source</a></span><h4 class="code-header">pub unsafe fn <a href="#method.increment_strong_count" class="fn">increment_strong_count</a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.pointer.html">*const T</a>)</h4></section></summary><div class="docblock"><p>Increments the strong reference count on the <code>Arc&lt;T&gt;</code> associated with the
provided pointer by one.</p>
<h5 id="safety"><a href="#safety">Safety</a></h5>
<p>The pointer must have been obtained through <code>Arc::into_raw</code>, and the
associated <code>Arc</code> instance must be valid (i.e. the strong count must be at
least 1) for the duration of this method.</p>
<h5 id="examples-15"><a href="#examples-15">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>five = Arc::new(<span class="number">5</span>);
<span class="kw">unsafe </span>{
<span class="kw">let </span>ptr = Arc::into_raw(five);
Arc::increment_strong_count(ptr);
<span class="comment">// This assertion is deterministic because we haven&#39;t shared
// the `Arc` between threads.
</span><span class="kw">let </span>five = Arc::from_raw(ptr);
<span class="macro">assert_eq!</span>(<span class="number">2</span>, Arc::strong_count(<span class="kw-2">&amp;</span>five));
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.decrement_strong_count" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.51.0">1.51.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#1435">source</a></span><h4 class="code-header">pub unsafe fn <a href="#method.decrement_strong_count" class="fn">decrement_strong_count</a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.pointer.html">*const T</a>)</h4></section></summary><div class="docblock"><p>Decrements the strong reference count on the <code>Arc&lt;T&gt;</code> associated with the
provided pointer by one.</p>
<h5 id="safety-1"><a href="#safety-1">Safety</a></h5>
<p>The pointer must have been obtained through <code>Arc::into_raw</code>, and the
associated <code>Arc</code> instance must be valid (i.e. the strong count must be at
least 1) when invoking this method. This method can be used to release the final
<code>Arc</code> and backing storage, but <strong>should not</strong> be called after the final <code>Arc</code> has been
released.</p>
<h5 id="examples-16"><a href="#examples-16">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>five = Arc::new(<span class="number">5</span>);
<span class="kw">unsafe </span>{
<span class="kw">let </span>ptr = Arc::into_raw(five);
Arc::increment_strong_count(ptr);
<span class="comment">// Those assertions are deterministic because we haven&#39;t shared
// the `Arc` between threads.
</span><span class="kw">let </span>five = Arc::from_raw(ptr);
<span class="macro">assert_eq!</span>(<span class="number">2</span>, Arc::strong_count(<span class="kw-2">&amp;</span>five));
Arc::decrement_strong_count(ptr);
<span class="macro">assert_eq!</span>(<span class="number">1</span>, Arc::strong_count(<span class="kw-2">&amp;</span>five));
}</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Arc%3CT,+A%3E-1" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#1440">source</a><a href="#impl-Arc%3CT,+A%3E-1" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,
T: ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into_raw" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.17.0">1.17.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#1458">source</a></span><h4 class="code-header">pub fn <a href="#method.into_raw" class="fn">into_raw</a>(this: <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.pointer.html">*const T</a></h4></section></summary><div class="docblock"><p>Consumes the <code>Arc</code>, returning the wrapped pointer.</p>
<p>To avoid a memory leak the pointer must be converted back to an <code>Arc</code> using
<a href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html#method.from_raw" title="associated function alloc::sync::Arc::from_raw"><code>Arc::from_raw</code></a>.</p>
<h5 id="examples-17"><a href="#examples-17">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>x = Arc::new(<span class="string">&quot;hello&quot;</span>.to_owned());
<span class="kw">let </span>x_ptr = Arc::into_raw(x);
<span class="macro">assert_eq!</span>(<span class="kw">unsafe </span>{ <span class="kw-2">&amp;*</span>x_ptr }, <span class="string">&quot;hello&quot;</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_ptr" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.45.0">1.45.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#1483">source</a></span><h4 class="code-header">pub fn <a href="#method.as_ptr" class="fn">as_ptr</a>(this: &amp;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.pointer.html">*const T</a></h4></section></summary><div class="docblock"><p>Provides a raw pointer to the data.</p>
<p>The counts are not affected in any way and the <code>Arc</code> is not consumed. The pointer is valid for
as long as there are strong counts in the <code>Arc</code>.</p>
<h5 id="examples-18"><a href="#examples-18">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>x = Arc::new(<span class="string">&quot;hello&quot;</span>.to_owned());
<span class="kw">let </span>y = Arc::clone(<span class="kw-2">&amp;</span>x);
<span class="kw">let </span>x_ptr = Arc::as_ptr(<span class="kw-2">&amp;</span>x);
<span class="macro">assert_eq!</span>(x_ptr, Arc::as_ptr(<span class="kw-2">&amp;</span>y));
<span class="macro">assert_eq!</span>(<span class="kw">unsafe </span>{ <span class="kw-2">&amp;*</span>x_ptr }, <span class="string">&quot;hello&quot;</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_raw_in" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#1535">source</a><h4 class="code-header">pub unsafe fn <a href="#method.from_raw_in" class="fn">from_raw_in</a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.pointer.html">*const T</a>, alloc: A) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Constructs an <code>Arc&lt;T, A&gt;</code> from a raw pointer.</p>
<p>The raw pointer must have been previously returned by a call to
<a href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html#method.into_raw" title="associated function alloc::sync::Arc::into_raw"><code>Arc&lt;U, A&gt;::into_raw</code></a> where <code>U</code> must have the same size and
alignment as <code>T</code>. This is trivially true if <code>U</code> is <code>T</code>.
Note that if <code>U</code> is not <code>T</code> but has the same size and alignment, this is
basically like transmuting references of different types. See
<a href="https://doc.rust-lang.org/1.74.1/core/intrinsics/fn.transmute.html" title="fn core::intrinsics::transmute"><code>mem::transmute</code></a> for more information on what
restrictions apply in this case.</p>
<p>The raw pointer must point to a block of memory allocated by <code>alloc</code></p>
<p>The user of <code>from_raw</code> has to make sure a specific value of <code>T</code> is only
dropped once.</p>
<p>This function is unsafe because improper use may lead to memory unsafety,
even if the returned <code>Arc&lt;T&gt;</code> is never accessed.</p>
<h5 id="examples-19"><a href="#examples-19">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(allocator_api)]
</span><span class="kw">use </span>std::sync::Arc;
<span class="kw">use </span>std::alloc::System;
<span class="kw">let </span>x = Arc::new_in(<span class="string">&quot;hello&quot;</span>.to_owned(), System);
<span class="kw">let </span>x_ptr = Arc::into_raw(x);
<span class="kw">unsafe </span>{
<span class="comment">// Convert back to an `Arc` to prevent leak.
</span><span class="kw">let </span>x = Arc::from_raw_in(x_ptr, System);
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;*</span>x, <span class="string">&quot;hello&quot;</span>);
<span class="comment">// Further calls to `Arc::from_raw(x_ptr)` would be memory-unsafe.
</span>}
<span class="comment">// The memory was freed when `x` went out of scope above, so `x_ptr` is now dangling!</span></code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.downgrade" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.4.0">1.4.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#1560-1562">source</a></span><h4 class="code-header">pub fn <a href="#method.downgrade" class="fn">downgrade</a>(this: &amp;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Weak.html" title="struct alloc::sync::Weak">Weak</a>&lt;T, A&gt;<span class="where fmt-newline">where
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</span></h4></section></summary><div class="docblock"><p>Creates a new <a href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Weak.html" title="struct alloc::sync::Weak"><code>Weak</code></a> pointer to this allocation.</p>
<h5 id="examples-20"><a href="#examples-20">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>five = Arc::new(<span class="number">5</span>);
<span class="kw">let </span>weak_five = Arc::downgrade(<span class="kw-2">&amp;</span>five);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.weak_count" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.15.0">1.15.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#1620">source</a></span><h4 class="code-header">pub fn <a href="#method.weak_count" class="fn">weak_count</a>(this: &amp;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Gets the number of <a href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Weak.html" title="struct alloc::sync::Weak"><code>Weak</code></a> pointers to this allocation.</p>
<h5 id="safety-2"><a href="#safety-2">Safety</a></h5>
<p>This method by itself is safe, but using it correctly requires extra care.
Another thread can change the weak count at any time,
including potentially between calling this method and acting on the result.</p>
<h5 id="examples-21"><a href="#examples-21">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>five = Arc::new(<span class="number">5</span>);
<span class="kw">let </span>_weak_five = Arc::downgrade(<span class="kw-2">&amp;</span>five);
<span class="comment">// This assertion is deterministic because we haven&#39;t shared
// the `Arc` or `Weak` between threads.
</span><span class="macro">assert_eq!</span>(<span class="number">1</span>, Arc::weak_count(<span class="kw-2">&amp;</span>five));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.strong_count" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.15.0">1.15.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#1650">source</a></span><h4 class="code-header">pub fn <a href="#method.strong_count" class="fn">strong_count</a>(this: &amp;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Gets the number of strong (<code>Arc</code>) pointers to this allocation.</p>
<h5 id="safety-3"><a href="#safety-3">Safety</a></h5>
<p>This method by itself is safe, but using it correctly requires extra care.
Another thread can change the strong count at any time,
including potentially between calling this method and acting on the result.</p>
<h5 id="examples-22"><a href="#examples-22">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>five = Arc::new(<span class="number">5</span>);
<span class="kw">let </span>_also_five = Arc::clone(<span class="kw-2">&amp;</span>five);
<span class="comment">// This assertion is deterministic because we haven&#39;t shared
// the `Arc` between threads.
</span><span class="macro">assert_eq!</span>(<span class="number">2</span>, Arc::strong_count(<span class="kw-2">&amp;</span>five));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.increment_strong_count_in" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#1686-1688">source</a><h4 class="code-header">pub unsafe fn <a href="#method.increment_strong_count_in" class="fn">increment_strong_count_in</a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.pointer.html">*const T</a>, alloc: A)<span class="where fmt-newline">where
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</span></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Increments the strong reference count on the <code>Arc&lt;T&gt;</code> associated with the
provided pointer by one.</p>
<h5 id="safety-4"><a href="#safety-4">Safety</a></h5>
<p>The pointer must have been obtained through <code>Arc::into_raw</code>, and the
associated <code>Arc</code> instance must be valid (i.e. the strong count must be at
least 1) for the duration of this method,, and <code>ptr</code> must point to a block of memory
allocated by <code>alloc</code>.</p>
<h5 id="examples-23"><a href="#examples-23">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(allocator_api)]
</span><span class="kw">use </span>std::sync::Arc;
<span class="kw">use </span>std::alloc::System;
<span class="kw">let </span>five = Arc::new_in(<span class="number">5</span>, System);
<span class="kw">unsafe </span>{
<span class="kw">let </span>ptr = Arc::into_raw(five);
Arc::increment_strong_count_in(ptr, System);
<span class="comment">// This assertion is deterministic because we haven&#39;t shared
// the `Arc` between threads.
</span><span class="kw">let </span>five = Arc::from_raw_in(ptr, System);
<span class="macro">assert_eq!</span>(<span class="number">2</span>, Arc::strong_count(<span class="kw-2">&amp;</span>five));
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.decrement_strong_count_in" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#1732">source</a><h4 class="code-header">pub unsafe fn <a href="#method.decrement_strong_count_in" class="fn">decrement_strong_count_in</a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.pointer.html">*const T</a>, alloc: A)</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Decrements the strong reference count on the <code>Arc&lt;T&gt;</code> associated with the
provided pointer by one.</p>
<h5 id="safety-5"><a href="#safety-5">Safety</a></h5>
<p>The pointer must have been obtained through <code>Arc::into_raw</code>, the
associated <code>Arc</code> instance must be valid (i.e. the strong count must be at
least 1) when invoking this method, and <code>ptr</code> must point to a block of memory
allocated by <code>alloc</code>. This method can be used to release the final
<code>Arc</code> and backing storage, but <strong>should not</strong> be called after the final <code>Arc</code> has been
released.</p>
<h5 id="examples-24"><a href="#examples-24">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(allocator_api)]
</span><span class="kw">use </span>std::sync::Arc;
<span class="kw">use </span>std::alloc::System;
<span class="kw">let </span>five = Arc::new_in(<span class="number">5</span>, System);
<span class="kw">unsafe </span>{
<span class="kw">let </span>ptr = Arc::into_raw(five);
Arc::increment_strong_count_in(ptr, System);
<span class="comment">// Those assertions are deterministic because we haven&#39;t shared
// the `Arc` between threads.
</span><span class="kw">let </span>five = Arc::from_raw_in(ptr, System);
<span class="macro">assert_eq!</span>(<span class="number">2</span>, Arc::strong_count(<span class="kw-2">&amp;</span>five));
Arc::decrement_strong_count_in(ptr, System);
<span class="macro">assert_eq!</span>(<span class="number">1</span>, Arc::strong_count(<span class="kw-2">&amp;</span>five));
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.ptr_eq" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.17.0">1.17.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#1780">source</a></span><h4 class="code-header">pub fn <a href="#method.ptr_eq" class="fn">ptr_eq</a>(this: &amp;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;, other: &amp;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if the two <code>Arc</code>s point to the same allocation in a vein similar to
<a href="https://doc.rust-lang.org/1.74.1/core/ptr/fn.eq.html" title="ptr::eq"><code>ptr::eq</code></a>. This function ignores the metadata of <code>dyn Trait</code> pointers.</p>
<h5 id="examples-25"><a href="#examples-25">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>five = Arc::new(<span class="number">5</span>);
<span class="kw">let </span>same_five = Arc::clone(<span class="kw-2">&amp;</span>five);
<span class="kw">let </span>other_five = Arc::new(<span class="number">5</span>);
<span class="macro">assert!</span>(Arc::ptr_eq(<span class="kw-2">&amp;</span>five, <span class="kw-2">&amp;</span>same_five));
<span class="macro">assert!</span>(!Arc::ptr_eq(<span class="kw-2">&amp;</span>five, <span class="kw-2">&amp;</span>other_five));</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Arc%3CT,+A%3E-2" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#2060">source</a><a href="#impl-Arc%3CT,+A%3E-2" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
T: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a> + <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.make_mut" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.4.0">1.4.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#2114">source</a></span><h4 class="code-header">pub fn <a href="#method.make_mut" class="fn">make_mut</a>(this: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.reference.html">&amp;mut T</a></h4></section></summary><div class="docblock"><p>Makes a mutable reference into the given <code>Arc</code>.</p>
<p>If there are other <code>Arc</code> pointers to the same allocation, then <code>make_mut</code> will
<a href="https://doc.rust-lang.org/1.74.1/core/clone/trait.Clone.html#tymethod.clone" title="method core::clone::Clone::clone"><code>clone</code></a> the inner value to a new allocation to ensure unique ownership. This is also
referred to as clone-on-write.</p>
<p>However, if there are no other <code>Arc</code> pointers to this allocation, but some <a href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Weak.html" title="struct alloc::sync::Weak"><code>Weak</code></a>
pointers, then the <a href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Weak.html" title="struct alloc::sync::Weak"><code>Weak</code></a> pointers will be dissociated and the inner value will not
be cloned.</p>
<p>See also <a href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html#method.get_mut" title="associated function alloc::sync::Arc::get_mut"><code>get_mut</code></a>, which will fail rather than cloning the inner value
or dissociating <a href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Weak.html" title="struct alloc::sync::Weak"><code>Weak</code></a> pointers.</p>
<h5 id="examples-26"><a href="#examples-26">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span><span class="kw-2">mut </span>data = Arc::new(<span class="number">5</span>);
<span class="kw-2">*</span>Arc::make_mut(<span class="kw-2">&amp;mut </span>data) += <span class="number">1</span>; <span class="comment">// Won&#39;t clone anything
</span><span class="kw">let </span><span class="kw-2">mut </span>other_data = Arc::clone(<span class="kw-2">&amp;</span>data); <span class="comment">// Won&#39;t clone inner data
</span><span class="kw-2">*</span>Arc::make_mut(<span class="kw-2">&amp;mut </span>data) += <span class="number">1</span>; <span class="comment">// Clones inner data
</span><span class="kw-2">*</span>Arc::make_mut(<span class="kw-2">&amp;mut </span>data) += <span class="number">1</span>; <span class="comment">// Won&#39;t clone anything
</span><span class="kw-2">*</span>Arc::make_mut(<span class="kw-2">&amp;mut </span>other_data) <span class="kw-2">*</span>= <span class="number">2</span>; <span class="comment">// Won&#39;t clone anything
// Now `data` and `other_data` point to different allocations.
</span><span class="macro">assert_eq!</span>(<span class="kw-2">*</span>data, <span class="number">8</span>);
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>other_data, <span class="number">12</span>);</code></pre></div>
<p><a href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Weak.html" title="struct alloc::sync::Weak"><code>Weak</code></a> pointers will be dissociated:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span><span class="kw-2">mut </span>data = Arc::new(<span class="number">75</span>);
<span class="kw">let </span>weak = Arc::downgrade(<span class="kw-2">&amp;</span>data);
<span class="macro">assert!</span>(<span class="number">75 </span>== <span class="kw-2">*</span>data);
<span class="macro">assert!</span>(<span class="number">75 </span>== <span class="kw-2">*</span>weak.upgrade().unwrap());
<span class="kw-2">*</span>Arc::make_mut(<span class="kw-2">&amp;mut </span>data) += <span class="number">1</span>;
<span class="macro">assert!</span>(<span class="number">76 </span>== <span class="kw-2">*</span>data);
<span class="macro">assert!</span>(weak.upgrade().is_none());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.unwrap_or_clone" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#2198">source</a><h4 class="code-header">pub fn <a href="#method.unwrap_or_clone" class="fn">unwrap_or_clone</a>(this: <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; T</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>arc_unwrap_or_clone</code>)</span></div></span></summary><div class="docblock"><p>If we have the only reference to <code>T</code> then unwrap it. Otherwise, clone <code>T</code> and return the
clone.</p>
<p>Assuming <code>arc_t</code> is of type <code>Arc&lt;T&gt;</code>, this function is functionally equivalent to
<code>(*arc_t).clone()</code>, but will avoid cloning the inner value where possible.</p>
<h5 id="examples-27"><a href="#examples-27">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(arc_unwrap_or_clone)]
</span><span class="kw">let </span>inner = String::from(<span class="string">&quot;test&quot;</span>);
<span class="kw">let </span>ptr = inner.as_ptr();
<span class="kw">let </span>arc = Arc::new(inner);
<span class="kw">let </span>inner = Arc::unwrap_or_clone(arc);
<span class="comment">// The inner value was not cloned
</span><span class="macro">assert!</span>(ptr::eq(ptr, inner.as_ptr()));
<span class="kw">let </span>arc = Arc::new(inner);
<span class="kw">let </span>arc2 = arc.clone();
<span class="kw">let </span>inner = Arc::unwrap_or_clone(arc);
<span class="comment">// Because there were 2 references, we had to clone the inner value.
</span><span class="macro">assert!</span>(!ptr::eq(ptr, inner.as_ptr()));
<span class="comment">// `arc2` is the last reference, so when we unwrap it we get back
// the original `String`.
</span><span class="kw">let </span>inner = Arc::unwrap_or_clone(arc2);
<span class="macro">assert!</span>(ptr::eq(ptr, inner.as_ptr()));</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Arc%3CT,+A%3E-3" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#2203">source</a><a href="#impl-Arc%3CT,+A%3E-3" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,
T: ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.get_mut" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.4.0">1.4.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#2230">source</a></span><h4 class="code-header">pub fn <a href="#method.get_mut" class="fn">get_mut</a>(this: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.reference.html">&amp;mut T</a>&gt;</h4></section></summary><div class="docblock"><p>Returns a mutable reference into the given <code>Arc</code>, if there are
no other <code>Arc</code> or <a href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Weak.html" title="struct alloc::sync::Weak"><code>Weak</code></a> pointers to the same allocation.</p>
<p>Returns <a href="https://doc.rust-lang.org/1.74.1/core/option/enum.Option.html#variant.None" title="variant core::option::Option::None"><code>None</code></a> otherwise, because it is not safe to
mutate a shared value.</p>
<p>See also <a href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html#method.make_mut" title="associated function alloc::sync::Arc::make_mut"><code>make_mut</code></a>, which will <a href="https://doc.rust-lang.org/1.74.1/core/clone/trait.Clone.html#tymethod.clone" title="method core::clone::Clone::clone"><code>clone</code></a>
the inner value when there are other <code>Arc</code> pointers.</p>
<h5 id="examples-28"><a href="#examples-28">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span><span class="kw-2">mut </span>x = Arc::new(<span class="number">3</span>);
<span class="kw-2">*</span>Arc::get_mut(<span class="kw-2">&amp;mut </span>x).unwrap() = <span class="number">4</span>;
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>x, <span class="number">4</span>);
<span class="kw">let </span>_y = Arc::clone(<span class="kw-2">&amp;</span>x);
<span class="macro">assert!</span>(Arc::get_mut(<span class="kw-2">&amp;mut </span>x).is_none());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_mut_unchecked" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#2305">source</a><h4 class="code-header">pub unsafe fn <a href="#method.get_mut_unchecked" class="fn">get_mut_unchecked</a>(this: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.reference.html">&amp;mut T</a></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>get_mut_unchecked</code>)</span></div></span></summary><div class="docblock"><p>Returns a mutable reference into the given <code>Arc</code>,
without any check.</p>
<p>See also <a href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html#method.get_mut" title="associated function alloc::sync::Arc::get_mut"><code>get_mut</code></a>, which is safe and does appropriate checks.</p>
<h5 id="safety-6"><a href="#safety-6">Safety</a></h5>
<p>If any other <code>Arc</code> or <a href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Weak.html" title="struct alloc::sync::Weak"><code>Weak</code></a> pointers to the same allocation exist, then
they must not be dereferenced or have active borrows for the duration
of the returned borrow, and their inner type must be exactly the same as the
inner type of this Rc (including lifetimes). This is trivially the case if no
such pointers exist, for example immediately after <code>Arc::new</code>.</p>
<h5 id="examples-29"><a href="#examples-29">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(get_mut_unchecked)]
</span><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span><span class="kw-2">mut </span>x = Arc::new(String::new());
<span class="kw">unsafe </span>{
Arc::get_mut_unchecked(<span class="kw-2">&amp;mut </span>x).push_str(<span class="string">&quot;foo&quot;</span>)
}
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>x, <span class="string">&quot;foo&quot;</span>);</code></pre></div>
<p>Other <code>Arc</code> pointers to the same allocation must be to the same type.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(get_mut_unchecked)]
</span><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>x: Arc&lt;str&gt; = Arc::from(<span class="string">&quot;Hello, world!&quot;</span>);
<span class="kw">let </span><span class="kw-2">mut </span>y: Arc&lt;[u8]&gt; = x.clone().into();
<span class="kw">unsafe </span>{
<span class="comment">// this is Undefined Behavior, because x&#39;s inner type is str, not [u8]
</span>Arc::get_mut_unchecked(<span class="kw-2">&amp;mut </span>y).fill(<span class="number">0xff</span>); <span class="comment">// 0xff is invalid in UTF-8
</span>}
<span class="macro">println!</span>(<span class="string">&quot;{}&quot;</span>, <span class="kw-2">&amp;*</span>x); <span class="comment">// Invalid UTF-8 in a str</span></code></pre></div>
<p>Other <code>Arc</code> pointers to the same allocation must be to the exact same type, including lifetimes.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(get_mut_unchecked)]
</span><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>x: Arc&lt;<span class="kw-2">&amp;</span>str&gt; = Arc::new(<span class="string">&quot;Hello, world!&quot;</span>);
{
<span class="kw">let </span>s = String::from(<span class="string">&quot;Oh, no!&quot;</span>);
<span class="kw">let </span><span class="kw-2">mut </span>y: Arc&lt;<span class="kw-2">&amp;</span>str&gt; = x.clone().into();
<span class="kw">unsafe </span>{
<span class="comment">// this is Undefined Behavior, because x&#39;s inner type
// is &amp;&#39;long str, not &amp;&#39;short str
</span><span class="kw-2">*</span>Arc::get_mut_unchecked(<span class="kw-2">&amp;mut </span>y) = <span class="kw-2">&amp;</span>s;
}
}
<span class="macro">println!</span>(<span class="string">&quot;{}&quot;</span>, <span class="kw-2">&amp;*</span>x); <span class="comment">// Use-after-free</span></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="toggle implementors-toggle" open><summary><section id="impl-AsFd-for-Arc%3CT,+Global%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.64.0">1.64.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/std/os/fd/owned.rs.html#399">source</a></span><a href="#impl-AsFd-for-Arc%3CT,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/std/os/fd/owned/trait.AsFd.html" title="trait std::os::fd::owned::AsFd">AsFd</a> for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;<span class="where fmt-newline">where
T: <a class="trait" href="https://doc.rust-lang.org/1.74.1/std/os/fd/owned/trait.AsFd.html" title="trait std::os::fd::owned::AsFd">AsFd</a>,</span></h3></section></summary><div class="docblock"><p>This impl allows implementing traits that require <code>AsFd</code> on Arc.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::net::UdpSocket;
<span class="kw">use </span>std::sync::Arc;
<span class="kw">trait </span>MyTrait: AsFd {}
<span class="kw">impl </span>MyTrait <span class="kw">for </span>Arc&lt;UdpSocket&gt; {}
<span class="kw">impl </span>MyTrait <span class="kw">for </span>Box&lt;UdpSocket&gt; {}</code></pre></div>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_fd" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/std/os/fd/owned.rs.html#401">source</a><a href="#method.as_fd" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/std/os/fd/owned/trait.AsFd.html#tymethod.as_fd" class="fn">as_fd</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/std/os/fd/owned/struct.BorrowedFd.html" title="struct std::os::fd::owned::BorrowedFd">BorrowedFd</a>&lt;'_&gt;</h4></section></summary><div class='docblock'>Borrows the file descriptor. <a href="https://doc.rust-lang.org/1.74.1/std/os/fd/owned/trait.AsFd.html#tymethod.as_fd">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AsRawFd-for-Arc%3CT,+Global%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.63.0">1.63.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/std/os/fd/raw.rs.html#253">source</a></span><a href="#impl-AsRawFd-for-Arc%3CT,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/std/os/fd/raw/trait.AsRawFd.html" title="trait std::os::fd::raw::AsRawFd">AsRawFd</a> for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;<span class="where fmt-newline">where
T: <a class="trait" href="https://doc.rust-lang.org/1.74.1/std/os/fd/raw/trait.AsRawFd.html" title="trait std::os::fd::raw::AsRawFd">AsRawFd</a>,</span></h3></section></summary><div class="docblock"><p>This impl allows implementing traits that require <code>AsRawFd</code> on Arc.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::net::UdpSocket;
<span class="kw">use </span>std::sync::Arc;
<span class="kw">trait </span>MyTrait: AsRawFd {
}
<span class="kw">impl </span>MyTrait <span class="kw">for </span>Arc&lt;UdpSocket&gt; {}
<span class="kw">impl </span>MyTrait <span class="kw">for </span>Box&lt;UdpSocket&gt; {}</code></pre></div>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_raw_fd" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/std/os/fd/raw.rs.html#255">source</a><a href="#method.as_raw_fd" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/std/os/fd/raw/trait.AsRawFd.html#tymethod.as_raw_fd" class="fn">as_raw_fd</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.i32.html">i32</a></h4></section></summary><div class='docblock'>Extracts the raw file descriptor. <a href="https://doc.rust-lang.org/1.74.1/std/os/fd/raw/trait.AsRawFd.html#tymethod.as_raw_fd">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AsRef%3CT%3E-for-Arc%3CT,+A%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.5.0">1.5.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3552">source</a></span><a href="#impl-AsRef%3CT%3E-for-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;T&gt; for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,
T: ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_ref" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3553">source</a><a href="#method.as_ref" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/convert/trait.AsRef.html#tymethod.as_ref" class="fn">as_ref</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.reference.html">&amp;T</a></h4></section></summary><div class='docblock'>Converts this type into a shared reference of the (usually inferred) input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Borrow%3CT%3E-for-Arc%3CT,+A%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3545">source</a></span><a href="#impl-Borrow%3CT%3E-for-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,
T: ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3546">source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.reference.html">&amp;T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.74.1/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Clone-for-Arc%3CT,+A%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#1994">source</a></span><a href="#impl-Clone-for-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a> + <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
T: ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#2010">source</a><a href="#method.clone" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;</h4></section></summary><div class="docblock"><p>Makes a clone of the <code>Arc</code> pointer.</p>
<p>This creates another pointer to the same allocation, increasing the
strong reference count.</p>
<h5 id="examples-40"><a href="#examples-40">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>five = Arc::new(<span class="number">5</span>);
<span class="kw">let _ </span>= Arc::clone(<span class="kw-2">&amp;</span>five);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/core/clone.rs.html#169">source</a></span><a href="#method.clone_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/clone/trait.Clone.html#method.clone_from" class="fn">clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.reference.html">&amp;Self</a>)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/1.74.1/core/clone/trait.Clone.html#method.clone_from">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-Arc%3CT,+A%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3212">source</a></span><a href="#impl-Debug-for-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
T: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt-1" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3213">source</a><a href="#method.fmt-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.74.1/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-Arc%3CT,+Global%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3227">source</a></span><a href="#impl-Default-for-Arc%3CT,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;<span class="where fmt-newline">where
T: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/default/trait.Default.html" title="trait core::default::Default">Default</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3238">source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;</h4></section></summary><div class="docblock"><p>Creates a new <code>Arc&lt;T&gt;</code>, with the <code>Default</code> value for <code>T</code>.</p>
<h5 id="examples-39"><a href="#examples-39">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>x: Arc&lt;i32&gt; = Default::default();
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>x, <span class="number">0</span>);</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Deref-for-Arc%3CT,+A%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#2048">source</a></span><a href="#impl-Deref-for-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a> for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,
T: ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Target" class="associatedtype trait-impl"><a href="#associatedtype.Target" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.74.1/core/ops/deref/trait.Deref.html#associatedtype.Target" class="associatedtype">Target</a> = T</h4></section></summary><div class='docblock'>The resulting type after dereferencing.</div></details><details class="toggle method-toggle" open><summary><section id="method.deref" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#2052">source</a><a href="#method.deref" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/ops/deref/trait.Deref.html#tymethod.deref" class="fn">deref</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.reference.html">&amp;T</a></h4></section></summary><div class='docblock'>Dereferences the value.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Deserialize%3C'de%3E-for-Arc%3CT,+Global%3E" class="impl"><a class="src rightside" href="https://docs.rs/serde/1.0.147/src/serde/de/impls.rs.html#1922-1931">source</a><a href="#impl-Deserialize%3C'de%3E-for-Arc%3CT,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'de, T&gt; <a class="trait" href="https://docs.rs/serde/1.0.147/serde/de/trait.Deserialize.html" title="trait serde::de::Deserialize">Deserialize</a>&lt;'de&gt; for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;<span class="where fmt-newline">where
<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;: <a class="trait" href="https://docs.rs/serde/1.0.147/serde/de/trait.Deserialize.html" title="trait serde::de::Deserialize">Deserialize</a>&lt;'de&gt;,
T: ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="docblock"><p>This impl requires the <a href="https://serde.rs/feature-flags.html#-features-rc"><code>&quot;rc&quot;</code></a> Cargo feature of Serde.</p>
<p>Deserializing a data structure containing <code>Arc</code> will not attempt to
deduplicate <code>Arc</code> references to the same data. Every deserialized <code>Arc</code>
will end up with a strong count of 1.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.deserialize" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.147/src/serde/de/impls.rs.html#1922-1931">source</a><a href="#method.deserialize" class="anchor">§</a><h4 class="code-header">fn <a href="https://docs.rs/serde/1.0.147/serde/de/trait.Deserialize.html#tymethod.deserialize" class="fn">deserialize</a>&lt;D&gt;(
deserializer: D
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;, &lt;D as <a class="trait" href="https://docs.rs/serde/1.0.147/serde/de/trait.Deserializer.html" title="trait serde::de::Deserializer">Deserializer</a>&lt;'de&gt;&gt;::<a class="associatedtype" href="https://docs.rs/serde/1.0.147/serde/de/trait.Deserializer.html#associatedtype.Error" title="type serde::de::Deserializer::Error">Error</a>&gt;<span class="where fmt-newline">where
D: <a class="trait" href="https://docs.rs/serde/1.0.147/serde/de/trait.Deserializer.html" title="trait serde::de::Deserializer">Deserializer</a>&lt;'de&gt;,</span></h4></section></summary><div class='docblock'>Deserialize this value from the given Serde deserializer. <a href="https://docs.rs/serde/1.0.147/serde/de/trait.Deserialize.html#tymethod.deserialize">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Display-for-Arc%3CT,+A%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3205">source</a></span><a href="#impl-Display-for-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
T: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3206">source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/fmt/trait.Display.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.74.1/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Drop-for-Arc%3CT,+A%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#2341">source</a></span><a href="#impl-Drop-for-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,
T: ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.drop" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#2368">source</a><a href="#method.drop" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/ops/drop/trait.Drop.html#tymethod.drop" class="fn">drop</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Drops the <code>Arc</code>.</p>
<p>This will decrement the strong reference count. If the strong reference
count reaches zero then the only other references (if any) are
<a href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Weak.html" title="struct alloc::sync::Weak"><code>Weak</code></a>, so we <code>drop</code> the inner value.</p>
<h5 id="examples-32"><a href="#examples-32">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">struct </span>Foo;
<span class="kw">impl </span>Drop <span class="kw">for </span>Foo {
<span class="kw">fn </span>drop(<span class="kw-2">&amp;mut </span><span class="self">self</span>) {
<span class="macro">println!</span>(<span class="string">&quot;dropped!&quot;</span>);
}
}
<span class="kw">let </span>foo = Arc::new(Foo);
<span class="kw">let </span>foo2 = Arc::clone(<span class="kw-2">&amp;</span>foo);
drop(foo); <span class="comment">// Doesn&#39;t print anything
</span>drop(foo2); <span class="comment">// Prints &quot;dropped!&quot;</span></code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Error-for-Arc%3CT,+Global%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.52.0">1.52.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3584">source</a></span><a href="#impl-Error-for-Arc%3CT,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/error/trait.Error.html" title="trait core::error::Error">Error</a> for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;<span class="where fmt-newline">where
T: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/error/trait.Error.html" title="trait core::error::Error">Error</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.description" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3586">source</a><a href="#method.description" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/error/trait.Error.html#method.description" class="fn">description</a>(&amp;self) -&gt; &amp;<a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.str.html">str</a></h4></section></summary><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 1.42.0: use the Display impl or to_string()</span></div></span><div class='docblock'> <a href="https://doc.rust-lang.org/1.74.1/core/error/trait.Error.html#method.description">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.cause" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3591">source</a><a href="#method.cause" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/error/trait.Error.html#method.cause" class="fn">cause</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;dyn <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/error/trait.Error.html" title="trait core::error::Error">Error</a>&gt;</h4></section></summary><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 1.33.0: replaced by Error::source, which can support downcasting</span></div></span></details><details class="toggle method-toggle" open><summary><section id="method.source" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3595">source</a><a href="#method.source" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/error/trait.Error.html#method.source" class="fn">source</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;(dyn <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/error/trait.Error.html" title="trait core::error::Error">Error</a> + 'static)&gt;</h4></section></summary><div class='docblock'>The lower-level source of this error, if any. <a href="https://doc.rust-lang.org/1.74.1/core/error/trait.Error.html#method.source">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.provide" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3599">source</a><a href="#method.provide" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/error/trait.Error.html#method.provide" class="fn">provide</a>&lt;'a&gt;(&amp;'a self, req: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/error/struct.Request.html" title="struct core::error::Request">Request</a>&lt;'a&gt;)</h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>error_generic_member_access</code>)</span></div></span><div class='docblock'>Provides type based access to context intended for error reports. <a href="https://doc.rust-lang.org/1.74.1/core/error/trait.Error.html#method.provide">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CBox%3CT,+A%3E%3E-for-Arc%3CT,+A%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3352">source</a></span><a href="#impl-From%3CBox%3CT,+A%3E%3E-for-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;T, A&gt;&gt; for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,
T: ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-1" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3364">source</a><a href="#method.from-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(v: <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;T, A&gt;) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;</h4></section></summary><div class="docblock"><p>Move a boxed object to a new, reference-counted allocation.</p>
<h5 id="example-2"><a href="#example-2">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>unique: Box&lt;str&gt; = Box::from(<span class="string">&quot;eggplant&quot;</span>);
<span class="kw">let </span>shared: Arc&lt;str&gt; = Arc::from(unique);
<span class="macro">assert_eq!</span>(<span class="string">&quot;eggplant&quot;</span>, <span class="kw-2">&amp;</span>shared[..]);</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CCow%3C'a,+B%3E%3E-for-Arc%3CB,+Global%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.45.0">1.45.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3400">source</a></span><a href="#impl-From%3CCow%3C'a,+B%3E%3E-for-Arc%3CB,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a, B&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.74.1/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, B&gt;&gt; for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;B, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;<span class="where fmt-newline">where
B: <a class="trait" href="https://doc.rust-lang.org/1.74.1/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;B, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.reference.html">&amp;'a B</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;&lt;B as <a class="trait" href="https://doc.rust-lang.org/1.74.1/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.74.1/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" title="type alloc::borrow::ToOwned::Owned">Owned</a>&gt;,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3418">source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(cow: <a class="enum" href="https://doc.rust-lang.org/1.74.1/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a>&lt;'a, B&gt;) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;B, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;</h4></section></summary><div class="docblock"><p>Create an atomically reference-counted pointer from
a clone-on-write pointer by copying its content.</p>
<h5 id="example-1"><a href="#example-1">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>cow: Cow&lt;<span class="lifetime">&#39;_</span>, str&gt; = Cow::Borrowed(<span class="string">&quot;eggplant&quot;</span>);
<span class="kw">let </span>shared: Arc&lt;str&gt; = Arc::from(cow);
<span class="macro">assert_eq!</span>(<span class="string">&quot;eggplant&quot;</span>, <span class="kw-2">&amp;</span>shared[..]);</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CT%3E-for-Arc%3CT,+Global%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.6.0">1.6.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3252">source</a></span><a href="#impl-From%3CT%3E-for-Arc%3CT,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-2" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3267">source</a><a href="#method.from-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;</h4></section></summary><div class="docblock"><p>Converts a <code>T</code> into an <code>Arc&lt;T&gt;</code></p>
<p>The conversion moves the value into a
newly allocated <code>Arc</code>. It is equivalent to
calling <code>Arc::new(t)</code>.</p>
<h5 id="example-3"><a href="#example-3">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="number">5</span>;
<span class="kw">let </span>arc = Arc::new(<span class="number">5</span>);
<span class="macro">assert_eq!</span>(Arc::from(x), arc);</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Hash-for-Arc%3CT,+A%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3244">source</a></span><a href="#impl-Hash-for-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
T: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.hash" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3245">source</a><a href="#method.hash" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/hash/trait.Hash.html#tymethod.hash" class="fn">hash</a>&lt;H&gt;(&amp;self, state: <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.reference.html">&amp;mut H</a>)<span class="where fmt-newline">where
H: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>,</span></h4></section></summary><div class='docblock'>Feeds this value into the given <a href="https://doc.rust-lang.org/1.74.1/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/1.74.1/core/hash/trait.Hash.html#tymethod.hash">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.hash_slice" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.3.0">1.3.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/core/hash/mod.rs.html#242-244">source</a></span><a href="#method.hash_slice" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/hash/trait.Hash.html#method.hash_slice" class="fn">hash_slice</a>&lt;H&gt;(data: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.slice.html">[Self]</a>, state: <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.reference.html">&amp;mut H</a>)<span class="where fmt-newline">where
H: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>,
Self: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h4></section></summary><div class='docblock'>Feeds a slice of this type into the given <a href="https://doc.rust-lang.org/1.74.1/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/1.74.1/core/hash/trait.Hash.html#method.hash_slice">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-LocalSpawn-for-Arc%3CSp,+Global%3E" class="impl"><a href="#impl-LocalSpawn-for-Arc%3CSp,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;Sp&gt; LocalSpawn for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;Sp, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;<span class="where fmt-newline">where
Sp: LocalSpawn + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.spawn_local_obj" class="method trait-impl"><a href="#method.spawn_local_obj" class="anchor">§</a><h4 class="code-header">fn <a class="fn">spawn_local_obj</a>(
&amp;self,
future: LocalFutureObj&lt;'static, <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.unit.html">()</a>&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.unit.html">()</a>, SpawnError&gt;</h4></section></summary><div class='docblock'>Spawns a future that will be run to completion. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.status_local" class="method trait-impl"><a href="#method.status_local" class="anchor">§</a><h4 class="code-header">fn <a class="fn">status_local</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.unit.html">()</a>, SpawnError&gt;</h4></section></summary><div class='docblock'>Determines whether the executor is able to spawn new tasks. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Log-for-Arc%3CT,+Global%3E" class="impl"><a class="src rightside" href="https://docs.rs/log/0.4.19/src/log/lib.rs.html#1200">source</a><a href="#impl-Log-for-Arc%3CT,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://docs.rs/log/0.4.19/log/trait.Log.html" title="trait log::Log">Log</a> for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;<span class="where fmt-newline">where
T: <a class="trait" href="https://docs.rs/log/0.4.19/log/trait.Log.html" title="trait log::Log">Log</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.enabled" class="method trait-impl"><a class="src rightside" href="https://docs.rs/log/0.4.19/src/log/lib.rs.html#1204">source</a><a href="#method.enabled" class="anchor">§</a><h4 class="code-header">fn <a href="https://docs.rs/log/0.4.19/log/trait.Log.html#tymethod.enabled" class="fn">enabled</a>(&amp;self, metadata: &amp;<a class="struct" href="https://docs.rs/log/0.4.19/log/struct.Metadata.html" title="struct log::Metadata">Metadata</a>&lt;'_&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Determines if a log message with the specified metadata would be
logged. <a href="https://docs.rs/log/0.4.19/log/trait.Log.html#tymethod.enabled">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.log" class="method trait-impl"><a class="src rightside" href="https://docs.rs/log/0.4.19/src/log/lib.rs.html#1208">source</a><a href="#method.log" class="anchor">§</a><h4 class="code-header">fn <a href="https://docs.rs/log/0.4.19/log/trait.Log.html#tymethod.log" class="fn">log</a>(&amp;self, record: &amp;<a class="struct" href="https://docs.rs/log/0.4.19/log/struct.Record.html" title="struct log::Record">Record</a>&lt;'_&gt;)</h4></section></summary><div class='docblock'>Logs the <code>Record</code>. <a href="https://docs.rs/log/0.4.19/log/trait.Log.html#tymethod.log">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.flush" class="method trait-impl"><a class="src rightside" href="https://docs.rs/log/0.4.19/src/log/lib.rs.html#1211">source</a><a href="#method.flush" class="anchor">§</a><h4 class="code-header">fn <a href="https://docs.rs/log/0.4.19/log/trait.Log.html#tymethod.flush" class="fn">flush</a>(&amp;self)</h4></section></summary><div class='docblock'>Flushes any buffered records.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Message-for-Arc%3CM,+Global%3E" class="impl"><a href="#impl-Message-for-Arc%3CM,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;M&gt; Message for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;M, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;<span class="where fmt-newline">where
M: Message,</span></h3></section></summary><div class="docblock"><p>Allow users to use <code>Arc&lt;M&gt;</code> as a message without having to re-impl <code>Message</code></p>
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Result" class="associatedtype trait-impl"><a href="#associatedtype.Result" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Result</a> = &lt;M as Message&gt;::Result</h4></section></summary><div class='docblock'>The type of value that this message will resolved with if it is
successful.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-MessageResponse%3CA,+M%3E-for-Arc%3CI,+Global%3E" class="impl"><a href="#impl-MessageResponse%3CA,+M%3E-for-Arc%3CI,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;A, M, I&gt; MessageResponse&lt;A, M&gt; for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;I, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;<span class="where fmt-newline">where
A: Actor,
M: Message&lt;Result = <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;I, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;&gt;,
I: 'static,</span></h3></section></summary><div class="impl-items"><section id="method.handle" class="method trait-impl"><a href="#method.handle" class="anchor">§</a><h4 class="code-header">fn <a class="fn">handle</a>(
self,
_: &amp;mut &lt;A as Actor&gt;::Context,
tx: <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Sender&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;I, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;&gt;&gt;
)</h4></section></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Ord-for-Arc%3CT,+A%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3182">source</a></span><a href="#impl-Ord-for-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
T: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.cmp" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3197">source</a><a href="#method.cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.Ord.html#tymethod.cmp" class="fn">cmp</a>(&amp;self, other: &amp;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></h4></section></summary><div class="docblock"><p>Comparison for two <code>Arc</code>s.</p>
<p>The two are compared by calling <code>cmp()</code> on their inner values.</p>
<h5 id="examples-33"><a href="#examples-33">Examples</a></h5>
<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::cmp::Ordering;
<span class="kw">let </span>five = Arc::new(<span class="number">5</span>);
<span class="macro">assert_eq!</span>(Ordering::Less, five.cmp(<span class="kw-2">&amp;</span>Arc::new(<span class="number">6</span>)));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.max" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/core/cmp.rs.html#808-810">source</a></span><a href="#method.max" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.Ord.html#method.max" class="fn">max</a>(self, other: Self) -&gt; Self<span class="where fmt-newline">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h4></section></summary><div class='docblock'>Compares and returns the maximum of two values. <a href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.Ord.html#method.max">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.min" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/core/cmp.rs.html#828-830">source</a></span><a href="#method.min" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.Ord.html#method.min" class="fn">min</a>(self, other: Self) -&gt; Self<span class="where fmt-newline">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h4></section></summary><div class='docblock'>Compares and returns the minimum of two values. <a href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.Ord.html#method.min">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clamp" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.50.0">1.50.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/core/cmp.rs.html#853-856">source</a></span><a href="#method.clamp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.Ord.html#method.clamp" class="fn">clamp</a>(self, min: Self, max: Self) -&gt; Self<span class="where fmt-newline">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;Self&gt;,</span></h4></section></summary><div class='docblock'>Restrict a value to a certain interval. <a href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.Ord.html#method.clamp">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CArc%3CT,+A%3E%3E-for-Arc%3CT,+A%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3048">source</a></span><a href="#impl-PartialEq%3CArc%3CT,+A%3E%3E-for-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;&gt; for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
T: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;T&gt; + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3067">source</a><a href="#method.eq" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&amp;self, other: &amp;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Equality for two <code>Arc</code>s.</p>
<p>Two <code>Arc</code>s are equal if their inner values are equal, even if they are
stored in different allocation.</p>
<p>If <code>T</code> also implements <code>Eq</code> (implying reflexivity of equality),
two <code>Arc</code>s that point to the same allocation are always equal.</p>
<h5 id="examples-30"><a href="#examples-30">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>five = Arc::new(<span class="number">5</span>);
<span class="macro">assert!</span>(five == Arc::new(<span class="number">5</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.ne" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3088">source</a><a href="#method.ne" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&amp;self, other: &amp;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Inequality for two <code>Arc</code>s.</p>
<p>Two <code>Arc</code>s are not equal if their inner values are not equal.</p>
<p>If <code>T</code> also implements <code>Eq</code> (implying reflexivity of equality),
two <code>Arc</code>s that point to the same value are always equal.</p>
<h5 id="examples-31"><a href="#examples-31">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>five = Arc::new(<span class="number">5</span>);
<span class="macro">assert!</span>(five != Arc::new(<span class="number">6</span>));</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CArc%3CT,+A%3E%3E-for-Arc%3CT,+A%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3094">source</a></span><a href="#impl-PartialOrd%3CArc%3CT,+A%3E%3E-for-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;&gt; for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
T: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;T&gt; + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3109">source</a><a href="#method.partial_cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&amp;self, other: &amp;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.74.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>&gt;</h4></section></summary><div class="docblock"><p>Partial comparison for two <code>Arc</code>s.</p>
<p>The two are compared by calling <code>partial_cmp()</code> on their inner values.</p>
<h5 id="examples-34"><a href="#examples-34">Examples</a></h5>
<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::cmp::Ordering;
<span class="kw">let </span>five = Arc::new(<span class="number">5</span>);
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(Ordering::Less), five.partial_cmp(<span class="kw-2">&amp;</span>Arc::new(<span class="number">6</span>)));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.lt" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3126">source</a><a href="#method.lt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&amp;self, other: &amp;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Less-than comparison for two <code>Arc</code>s.</p>
<p>The two are compared by calling <code>&lt;</code> on their inner values.</p>
<h5 id="examples-35"><a href="#examples-35">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>five = Arc::new(<span class="number">5</span>);
<span class="macro">assert!</span>(five &lt; Arc::new(<span class="number">6</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.le" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3143">source</a><a href="#method.le" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&amp;self, other: &amp;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Less than or equal to comparison for two <code>Arc</code>s.</p>
<p>The two are compared by calling <code>&lt;=</code> on their inner values.</p>
<h5 id="examples-36"><a href="#examples-36">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>five = Arc::new(<span class="number">5</span>);
<span class="macro">assert!</span>(five &lt;= Arc::new(<span class="number">5</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.gt" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3160">source</a><a href="#method.gt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&amp;self, other: &amp;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Greater-than comparison for two <code>Arc</code>s.</p>
<p>The two are compared by calling <code>&gt;</code> on their inner values.</p>
<h5 id="examples-37"><a href="#examples-37">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>five = Arc::new(<span class="number">5</span>);
<span class="macro">assert!</span>(five &gt; Arc::new(<span class="number">4</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.ge" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3177">source</a><a href="#method.ge" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&amp;self, other: &amp;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Greater than or equal to comparison for two <code>Arc</code>s.</p>
<p>The two are compared by calling <code>&gt;=</code> on their inner values.</p>
<h5 id="examples-38"><a href="#examples-38">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::Arc;
<span class="kw">let </span>five = Arc::new(<span class="number">5</span>);
<span class="macro">assert!</span>(five &gt;= Arc::new(<span class="number">5</span>));</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Pointer-for-Arc%3CT,+A%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3219">source</a></span><a href="#impl-Pointer-for-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/fmt/trait.Pointer.html" title="trait core::fmt::Pointer">Pointer</a> for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,
T: ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt-2" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3220">source</a><a href="#method.fmt-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.74.1/core/fmt/trait.Pointer.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Formats the value using the given formatter.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-RefCnt-for-Arc%3CT,+Global%3E" class="impl"><a href="#impl-RefCnt-for-Arc%3CT,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; RefCnt for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;</h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Base" class="associatedtype trait-impl"><a href="#associatedtype.Base" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Base</a> = T</h4></section></summary><div class='docblock'>The base type the pointer points to.</div></details><details class="toggle method-toggle" open><summary><section id="method.into_ptr" class="method trait-impl"><a href="#method.into_ptr" class="anchor">§</a><h4 class="code-header">fn <a class="fn">into_ptr</a>(me: <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.pointer.html">*mut T</a></h4></section></summary><div class='docblock'>Converts the smart pointer into a raw pointer, without affecting the reference count. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.as_ptr-1" class="method trait-impl"><a href="#method.as_ptr-1" class="anchor">§</a><h4 class="code-header">fn <a class="fn">as_ptr</a>(me: &amp;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.pointer.html">*mut T</a></h4></section></summary><div class='docblock'>Provides a view into the smart pointer as a raw pointer. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.from_ptr" class="method trait-impl"><a href="#method.from_ptr" class="anchor">§</a><h4 class="code-header">unsafe fn <a class="fn">from_ptr</a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.pointer.html">*const T</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;</h4></section></summary><div class='docblock'>Converts a raw pointer back into the smart pointer, without affecting the reference count. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.inc" class="method trait-impl"><a href="#method.inc" class="anchor">§</a><h4 class="code-header">fn <a class="fn">inc</a>(me: <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.reference.html">&amp;Self</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.pointer.html">*mut </a>Self::Base</h4></section></summary><div class='docblock'>Increments the reference count by one. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.dec" class="method trait-impl"><a href="#method.dec" class="anchor">§</a><h4 class="code-header">unsafe fn <a class="fn">dec</a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.pointer.html">*const </a>Self::Base)</h4></section></summary><div class='docblock'>Decrements the reference count by one. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Render-for-Arc%3CT,+Global%3E" class="impl"><a href="#impl-Render-for-Arc%3CT,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; Render for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;<span class="where fmt-newline">where
T: Render + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.render" class="method trait-impl"><a href="#method.render" class="anchor">§</a><h4 class="code-header">fn <a class="fn">render</a>(&amp;self, b: &amp;mut Buffer) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.unit.html">()</a>, RenderError&gt;</h4></section></summary><div class='docblock'>render to <code>Buffer</code> without escaping</div></details><details class="toggle method-toggle" open><summary><section id="method.render_escaped" class="method trait-impl"><a href="#method.render_escaped" class="anchor">§</a><h4 class="code-header">fn <a class="fn">render_escaped</a>(&amp;self, b: &amp;mut Buffer) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.unit.html">()</a>, RenderError&gt;</h4></section></summary><div class='docblock'>render to <code>Buffer</code> with HTML escaping</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Serialize-for-Arc%3CT,+Global%3E" class="impl"><a class="src rightside" href="https://docs.rs/serde/1.0.147/src/serde/ser/impls.rs.html#416-426">source</a><a href="#impl-Serialize-for-Arc%3CT,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://docs.rs/serde/1.0.147/serde/ser/trait.Serialize.html" title="trait serde::ser::Serialize">Serialize</a> for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;<span class="where fmt-newline">where
T: <a class="trait" href="https://docs.rs/serde/1.0.147/serde/ser/trait.Serialize.html" title="trait serde::ser::Serialize">Serialize</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="docblock"><p>This impl requires the <a href="https://serde.rs/feature-flags.html#-features-rc"><code>&quot;rc&quot;</code></a> Cargo feature of Serde.</p>
<p>Serializing a data structure containing <code>Arc</code> will serialize a copy of
the contents of the <code>Arc</code> each time the <code>Arc</code> is referenced within the
data structure. Serialization will not attempt to deduplicate these
repeated data.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.serialize" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.147/src/serde/ser/impls.rs.html#416-426">source</a><a href="#method.serialize" class="anchor">§</a><h4 class="code-header">fn <a href="https://docs.rs/serde/1.0.147/serde/ser/trait.Serialize.html#tymethod.serialize" class="fn">serialize</a>&lt;S&gt;(
&amp;self,
serializer: S
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;S as <a class="trait" href="https://docs.rs/serde/1.0.147/serde/ser/trait.Serializer.html" title="trait serde::ser::Serializer">Serializer</a>&gt;::<a class="associatedtype" href="https://docs.rs/serde/1.0.147/serde/ser/trait.Serializer.html#associatedtype.Ok" title="type serde::ser::Serializer::Ok">Ok</a>, &lt;S as <a class="trait" href="https://docs.rs/serde/1.0.147/serde/ser/trait.Serializer.html" title="trait serde::ser::Serializer">Serializer</a>&gt;::<a class="associatedtype" href="https://docs.rs/serde/1.0.147/serde/ser/trait.Serializer.html#associatedtype.Error" title="type serde::ser::Serializer::Error">Error</a>&gt;<span class="where fmt-newline">where
S: <a class="trait" href="https://docs.rs/serde/1.0.147/serde/ser/trait.Serializer.html" title="trait serde::ser::Serializer">Serializer</a>,</span></h4></section></summary><div class='docblock'>Serialize this value into the given Serde serializer. <a href="https://docs.rs/serde/1.0.147/serde/ser/trait.Serialize.html#tymethod.serialize">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-ServiceFactory%3CReq%3E-for-Arc%3CS,+Global%3E" class="impl"><a href="#impl-ServiceFactory%3CReq%3E-for-Arc%3CS,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;S, Req&gt; ServiceFactory&lt;Req&gt; for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;S, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;<span class="where fmt-newline">where
S: ServiceFactory&lt;Req&gt;,</span></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Response" class="associatedtype trait-impl"><a href="#associatedtype.Response" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Response</a> = &lt;S as ServiceFactory&lt;Req&gt;&gt;::Response</h4></section></summary><div class='docblock'>Responses given by the created services.</div></details><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Error</a> = &lt;S as ServiceFactory&lt;Req&gt;&gt;::Error</h4></section></summary><div class='docblock'>Errors produced by the created services.</div></details><details class="toggle" open><summary><section id="associatedtype.Config" class="associatedtype trait-impl"><a href="#associatedtype.Config" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Config</a> = &lt;S as ServiceFactory&lt;Req&gt;&gt;::Config</h4></section></summary><div class='docblock'>Service factory configuration.</div></details><details class="toggle" open><summary><section id="associatedtype.Service" class="associatedtype trait-impl"><a href="#associatedtype.Service" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Service</a> = &lt;S as ServiceFactory&lt;Req&gt;&gt;::Service</h4></section></summary><div class='docblock'>The kind of <code>Service</code> created by this factory.</div></details><details class="toggle" open><summary><section id="associatedtype.InitError" class="associatedtype trait-impl"><a href="#associatedtype.InitError" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">InitError</a> = &lt;S as ServiceFactory&lt;Req&gt;&gt;::InitError</h4></section></summary><div class='docblock'>Errors potentially raised while building a service.</div></details><details class="toggle" open><summary><section id="associatedtype.Future" class="associatedtype trait-impl"><a href="#associatedtype.Future" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Future</a> = &lt;S as ServiceFactory&lt;Req&gt;&gt;::Future</h4></section></summary><div class='docblock'>The future of the <code>Service</code> instance.g</div></details><details class="toggle method-toggle" open><summary><section id="method.new_service" class="method trait-impl"><a href="#method.new_service" class="anchor">§</a><h4 class="code-header">fn <a class="fn">new_service</a>(
&amp;self,
cfg: &lt;S as ServiceFactory&lt;Req&gt;&gt;::Config
) -&gt; &lt;S as ServiceFactory&lt;Req&gt;&gt;::Future</h4></section></summary><div class='docblock'>Create and return a new service asynchronously.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Spawn-for-Arc%3CSp,+Global%3E" class="impl"><a href="#impl-Spawn-for-Arc%3CSp,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;Sp&gt; Spawn for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;Sp, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;<span class="where fmt-newline">where
Sp: Spawn + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.spawn_obj" class="method trait-impl"><a href="#method.spawn_obj" class="anchor">§</a><h4 class="code-header">fn <a class="fn">spawn_obj</a>(&amp;self, future: FutureObj&lt;'static, <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.unit.html">()</a>&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.unit.html">()</a>, SpawnError&gt;</h4></section></summary><div class='docblock'>Spawns a future that will be run to completion. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.status" class="method trait-impl"><a href="#method.status" class="anchor">§</a><h4 class="code-header">fn <a class="fn">status</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.unit.html">()</a>, SpawnError&gt;</h4></section></summary><div class='docblock'>Determines whether the executor is able to spawn new tasks. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Subscriber-for-Arc%3CS,+Global%3E" class="impl"><a href="#impl-Subscriber-for-Arc%3CS,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;S&gt; Subscriber for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;S, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;<span class="where fmt-newline">where
S: Subscriber + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.register_callsite" class="method trait-impl"><a href="#method.register_callsite" class="anchor">§</a><h4 class="code-header">fn <a class="fn">register_callsite</a>(&amp;self, metadata: &amp;'static Metadata&lt;'static&gt;) -&gt; Interest</h4></section></summary><div class='docblock'>Registers a new <a href="crate::callsite">callsite</a> with this subscriber, returning whether or not
the subscriber is interested in being notified about the callsite. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.enabled-1" class="method trait-impl"><a href="#method.enabled-1" class="anchor">§</a><h4 class="code-header">fn <a class="fn">enabled</a>(&amp;self, metadata: &amp;Metadata&lt;'_&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Returns true if a span or event with the specified <a href="super::metadata::Metadata">metadata</a> would be
recorded. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.max_level_hint" class="method trait-impl"><a href="#method.max_level_hint" class="anchor">§</a><h4 class="code-header">fn <a class="fn">max_level_hint</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;LevelFilter&gt;</h4></section></summary><div class='docblock'>Returns the highest <a href="super::Level">verbosity level</a> that this <code>Subscriber</code> will
enable, or <code>None</code>, if the subscriber does not implement level-based
filtering or chooses not to implement this method. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.new_span" class="method trait-impl"><a href="#method.new_span" class="anchor">§</a><h4 class="code-header">fn <a class="fn">new_span</a>(&amp;self, span: &amp;Attributes&lt;'_&gt;) -&gt; Id</h4></section></summary><div class='docblock'>Visit the construction of a new span, returning a new <a href="super::span::Id">span ID</a> for the
span being constructed. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.record" class="method trait-impl"><a href="#method.record" class="anchor">§</a><h4 class="code-header">fn <a class="fn">record</a>(&amp;self, span: &amp;Id, values: &amp;Record&lt;'_&gt;)</h4></section></summary><div class='docblock'>Record a set of values on a span. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.record_follows_from" class="method trait-impl"><a href="#method.record_follows_from" class="anchor">§</a><h4 class="code-header">fn <a class="fn">record_follows_from</a>(&amp;self, span: &amp;Id, follows: &amp;Id)</h4></section></summary><div class='docblock'>Adds an indication that <code>span</code> follows from the span with the id
<code>follows</code>. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.event_enabled" class="method trait-impl"><a href="#method.event_enabled" class="anchor">§</a><h4 class="code-header">fn <a class="fn">event_enabled</a>(&amp;self, event: &amp;Event&lt;'_&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Determine if an [<code>Event</code>] should be recorded. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.event" class="method trait-impl"><a href="#method.event" class="anchor">§</a><h4 class="code-header">fn <a class="fn">event</a>(&amp;self, event: &amp;Event&lt;'_&gt;)</h4></section></summary><div class='docblock'>Records that an <a href="super::event::Event"><code>Event</code></a> has occurred. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.enter" class="method trait-impl"><a href="#method.enter" class="anchor">§</a><h4 class="code-header">fn <a class="fn">enter</a>(&amp;self, span: &amp;Id)</h4></section></summary><div class='docblock'>Records that a span has been entered. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.exit" class="method trait-impl"><a href="#method.exit" class="anchor">§</a><h4 class="code-header">fn <a class="fn">exit</a>(&amp;self, span: &amp;Id)</h4></section></summary><div class='docblock'>Records that a span has been exited. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_span" class="method trait-impl"><a href="#method.clone_span" class="anchor">§</a><h4 class="code-header">fn <a class="fn">clone_span</a>(&amp;self, id: &amp;Id) -&gt; Id</h4></section></summary><div class='docblock'>Notifies the subscriber that a <a href="super::span::Id">span ID</a> has been cloned. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_close" class="method trait-impl"><a href="#method.try_close" class="anchor">§</a><h4 class="code-header">fn <a class="fn">try_close</a>(&amp;self, id: Id) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Notifies the subscriber that a <a href="super::span::Id">span ID</a> has been dropped, and returns
<code>true</code> if there are now 0 IDs that refer to that span. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.drop_span" class="method trait-impl"><a href="#method.drop_span" class="anchor">§</a><h4 class="code-header">fn <a class="fn">drop_span</a>(&amp;self, id: Id)</h4></section></summary><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.1.2: use <code>Subscriber::try_close</code> instead</span></div></span><div class='docblock'><strong>This method is deprecated.</strong> <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.current_span" class="method trait-impl"><a href="#method.current_span" class="anchor">§</a><h4 class="code-header">fn <a class="fn">current_span</a>(&amp;self) -&gt; Current</h4></section></summary><div class='docblock'>Returns a type representing this subscribers view of the current span. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.downcast_raw" class="method trait-impl"><a href="#method.downcast_raw" class="anchor">§</a><h4 class="code-header">unsafe fn <a class="fn">downcast_raw</a>(&amp;self, id: <a class="struct" href="https://doc.rust-lang.org/1.74.1/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.74.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.pointer.html">*const </a><a class="primitive" href="https://doc.rust-lang.org/1.74.1/std/primitive.unit.html">()</a>&gt;</h4></section></summary><div class='docblock'>If <code>self</code> is the same type as the provided <code>TypeId</code>, returns an untyped
<code>*const</code> pointer to that type. Otherwise, returns <code>None</code>. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.on_register_dispatch" class="method trait-impl"><a href="#method.on_register_dispatch" class="anchor">§</a><h4 class="code-header">fn <a class="fn">on_register_dispatch</a>(&amp;self, subscriber: &amp;Dispatch)</h4></section></summary><div class='docblock'>Invoked when this subscriber becomes a [<code>Dispatch</code>]. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Transform%3CS,+Req%3E-for-Arc%3CT,+Global%3E" class="impl"><a href="#impl-Transform%3CS,+Req%3E-for-Arc%3CT,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, S, Req&gt; Transform&lt;S, Req&gt; for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;<span class="where fmt-newline">where
T: Transform&lt;S, Req&gt;,</span></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Response-1" class="associatedtype trait-impl"><a href="#associatedtype.Response-1" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Response</a> = &lt;T as Transform&lt;S, Req&gt;&gt;::Response</h4></section></summary><div class='docblock'>Responses produced by the service.</div></details><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Error</a> = &lt;T as Transform&lt;S, Req&gt;&gt;::Error</h4></section></summary><div class='docblock'>Errors produced by the service.</div></details><details class="toggle" open><summary><section id="associatedtype.Transform" class="associatedtype trait-impl"><a href="#associatedtype.Transform" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Transform</a> = &lt;T as Transform&lt;S, Req&gt;&gt;::Transform</h4></section></summary><div class='docblock'>The <code>TransformService</code> value created by this factory</div></details><details class="toggle" open><summary><section id="associatedtype.InitError-1" class="associatedtype trait-impl"><a href="#associatedtype.InitError-1" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">InitError</a> = &lt;T as Transform&lt;S, Req&gt;&gt;::InitError</h4></section></summary><div class='docblock'>Errors produced while building a transform service.</div></details><details class="toggle" open><summary><section id="associatedtype.Future-1" class="associatedtype trait-impl"><a href="#associatedtype.Future-1" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Future</a> = &lt;T as Transform&lt;S, Req&gt;&gt;::Future</h4></section></summary><div class='docblock'>The future response value.</div></details><details class="toggle method-toggle" open><summary><section id="method.new_transform" class="method trait-impl"><a href="#method.new_transform" class="anchor">§</a><h4 class="code-header">fn <a class="fn">new_transform</a>(&amp;self, service: S) -&gt; &lt;T as Transform&lt;S, Req&gt;&gt;::Future</h4></section></summary><div class='docblock'>Creates and returns a new Transform component, asynchronously</div></details></div></details><section id="impl-CoerceUnsized%3CArc%3CU,+A%3E%3E-for-Arc%3CT,+A%3E" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#266">source</a><a href="#impl-CoerceUnsized%3CArc%3CU,+A%3E%3E-for-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, U, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/ops/unsize/trait.CoerceUnsized.html" title="trait core::ops::unsize::CoerceUnsized">CoerceUnsized</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;U, A&gt;&gt; for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
T: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Unsize.html" title="trait core::marker::Unsize">Unsize</a>&lt;U&gt; + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,
U: ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section><section id="impl-DispatchFromDyn%3CArc%3CU,+Global%3E%3E-for-Arc%3CT,+Global%3E" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#269">source</a><a href="#impl-DispatchFromDyn%3CArc%3CU,+Global%3E%3E-for-Arc%3CT,+Global%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/ops/unsize/trait.DispatchFromDyn.html" title="trait core::ops::unsize::DispatchFromDyn">DispatchFromDyn</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;U, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;&gt; for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;<span class="where fmt-newline">where
T: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Unsize.html" title="trait core::marker::Unsize">Unsize</a>&lt;U&gt; + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
U: ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section><section id="impl-Eq-for-Arc%3CT,+A%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3202">source</a></span><a href="#impl-Eq-for-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
T: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,</span></h3></section><section id="impl-Send-for-Arc%3CT,+A%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#258">source</a></span><a href="#impl-Send-for-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
T: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a> + <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</span></h3></section><section id="impl-Sync-for-Arc%3CT,+A%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#260">source</a></span><a href="#impl-Sync-for-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
T: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a> + <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,</span></h3></section><section id="impl-Unpin-for-Arc%3CT,+A%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.33.0">1.33.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#3559">source</a></span><a href="#impl-Unpin-for-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,
T: ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section><section id="impl-UnwindSafe-for-Arc%3CT,+A%3E" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.9.0">1.9.0</span> · <a class="src" href="https://doc.rust-lang.org/1.74.1/src/alloc/sync.rs.html#263">source</a></span><a href="#impl-UnwindSafe-for-Arc%3CT,+A%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, A&gt; <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="https://doc.rust-lang.org/1.74.1/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T, A&gt;<span class="where fmt-newline">where
T: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.74.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
A: <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a> + <a class="trait" href="https://doc.rust-lang.org/1.74.1/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a>,</span></h3></section></div></section></div></main></body></html>