difftastic/rustdoc/crossbeam_epoch/struct.Atomic.html

417 lines
88 KiB
HTML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!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="An atomic pointer that can be safely shared between threads."><title>Atomic in crossbeam_epoch - 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/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-ac92e1bbe349e143.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="crossbeam_epoch" data-themes="" data-resource-suffix="" data-rustdoc-version="1.76.0 (07dca489a 2024-02-04)" data-channel="1.76.0" data-search-js="search-2b6ce74ff89ae146.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-f2adc0d6ca4d09fb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-305769736d49e732.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-feafe1bb7466e4bd.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 struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../crossbeam_epoch/index.html">crossbeam_epoch</a><span class="version">0.9.18</span></h2></div><h2 class="location"><a href="#">Atomic</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.compare_and_set">compare_and_set</a></li><li><a href="#method.compare_and_set_weak">compare_and_set_weak</a></li><li><a href="#method.compare_exchange">compare_exchange</a></li><li><a href="#method.compare_exchange_weak">compare_exchange_weak</a></li><li><a href="#method.fetch_and">fetch_and</a></li><li><a href="#method.fetch_or">fetch_or</a></li><li><a href="#method.fetch_update">fetch_update</a></li><li><a href="#method.fetch_xor">fetch_xor</a></li><li><a href="#method.init">init</a></li><li><a href="#method.into_owned">into_owned</a></li><li><a href="#method.load">load</a></li><li><a href="#method.load_consume">load_consume</a></li><li><a href="#method.new">new</a></li><li><a href="#method.null">null</a></li><li><a href="#method.store">store</a></li><li><a href="#method.swap">swap</a></li><li><a href="#method.try_into_owned">try_into_owned</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Clone-for-Atomic%3CT%3E">Clone</a></li><li><a href="#impl-Debug-for-Atomic%3CT%3E">Debug</a></li><li><a href="#impl-Default-for-Atomic%3CT%3E">Default</a></li><li><a href="#impl-From%3C*const+T%3E-for-Atomic%3CT%3E">From&lt;*const T&gt;</a></li><li><a href="#impl-From%3CBox%3CT%3E%3E-for-Atomic%3CT%3E">From&lt;Box&lt;T&gt;&gt;</a></li><li><a href="#impl-From%3COwned%3CT%3E%3E-for-Atomic%3CT%3E">From&lt;Owned&lt;T&gt;&gt;</a></li><li><a href="#impl-From%3CShared%3C'g,+T%3E%3E-for-Atomic%3CT%3E">From&lt;Shared&lt;&#x27;g, T&gt;&gt;</a></li><li><a href="#impl-From%3CT%3E-for-Atomic%3CT%3E">From&lt;T&gt;</a></li><li><a href="#impl-Pointer-for-Atomic%3CT%3E">Pointer</a></li><li><a href="#impl-Send-for-Atomic%3CT%3E">Send</a></li><li><a href="#impl-Sync-for-Atomic%3CT%3E">Sync</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-Atomic%3CT%3E">RefUnwindSafe</a></li><li><a href="#impl-Unpin-for-Atomic%3CT%3E">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Atomic%3CT%3E">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-From%3C!%3E-for-T">From&lt;!&gt;</a></li><li><a href="#impl-From%3CT%3E-for-T">From&lt;T&gt;</a></li><li><a href="#impl-Into%3CU%3E-for-T">Into&lt;U&gt;</a></li><li><a href="#impl-Pointable-for-T">Pointable</a></li><li><a href="#impl-ToOwned-for-T">ToOwned</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto&lt;U&gt;</a></li></ul></section><h2><a href="index.html">In crate crossbeam_epoch</a></h2></div></nav><div class="sidebar-resizer"></div>
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../crossbeam_epoch/all.html" title="show sidebar"></a></div><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" tabindex="-1"><a href="../help.html" title="help">?</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>Struct <a href="index.html">crossbeam_epoch</a>::<wbr><a class="struct" href="#">Atomic</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/crossbeam_epoch/atomic.rs.html#294-297">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub struct Atomic&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.Pointable.html" title="trait crossbeam_epoch::Pointable">Pointable</a>&gt; { <span class="comment">/* private fields */</span> }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An atomic pointer that can be safely shared between threads.</p>
<p>The pointer must be properly aligned. Since it is aligned, a tag can be stored into the unused
least significant bits of the address. For example, the tag for a pointer to a sized type <code>T</code>
should be less than <code>(1 &lt;&lt; mem::align_of::&lt;T&gt;().trailing_zeros())</code>.</p>
<p>Any method that loads the pointer must be passed a reference to a <a href="struct.Guard.html" title="struct crossbeam_epoch::Guard"><code>Guard</code></a>.</p>
<p>Crossbeam supports dynamically sized types. See <a href="trait.Pointable.html" title="trait crossbeam_epoch::Pointable"><code>Pointable</code></a> for details.</p>
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Atomic%3CT%3E" class="impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#302-316">source</a><a href="#impl-Atomic%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="struct" href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic">Atomic</a>&lt;T&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#313-315">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>(init: T) -&gt; <a class="struct" href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic">Atomic</a>&lt;T&gt;</h4></section></summary><div class="docblock"><p>Allocates <code>value</code> on the heap and returns a new atomic pointer pointing to it.</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>crossbeam_epoch::Atomic;
<span class="kw">let </span>a = Atomic::new(<span class="number">1234</span>);</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Atomic%3CT%3E-1" class="impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#318-928">source</a><a href="#impl-Atomic%3CT%3E-1" class="anchor">§</a><h3 class="code-header">impl&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.Pointable.html" title="trait crossbeam_epoch::Pointable">Pointable</a>&gt; <a class="struct" href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic">Atomic</a>&lt;T&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.init" class="method"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#329-331">source</a><h4 class="code-header">pub fn <a href="#method.init" class="fn">init</a>(init: T::<a class="associatedtype" href="trait.Pointable.html#associatedtype.Init" title="type crossbeam_epoch::Pointable::Init">Init</a>) -&gt; <a class="struct" href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic">Atomic</a>&lt;T&gt;</h4></section></summary><div class="docblock"><p>Allocates <code>value</code> on the heap and returns a new atomic pointer pointing to it.</p>
<h5 id="examples-1"><a href="#examples-1">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_epoch::Atomic;
<span class="kw">let </span>a = Atomic::&lt;i32&gt;::init(<span class="number">1234</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.null" class="method"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#351-356">source</a><h4 class="code-header">pub const fn <a href="#method.null" class="fn">null</a>() -&gt; <a class="struct" href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic">Atomic</a>&lt;T&gt;</h4></section></summary><div class="docblock"><p>Returns a new null atomic pointer.</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="kw">use </span>crossbeam_epoch::Atomic;
<span class="kw">let </span>a = Atomic::&lt;i32&gt;::null();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.load" class="method"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#382-384">source</a><h4 class="code-header">pub fn <a href="#method.load" class="fn">load</a>&lt;'g&gt;(&amp;self, ord: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a>, _: &amp;'g <a class="struct" href="struct.Guard.html" title="struct crossbeam_epoch::Guard">Guard</a>) -&gt; <a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'g, T&gt;</h4></section></summary><div class="docblock"><p>Loads a <code>Shared</code> from the atomic pointer.</p>
<p>This method takes an <a href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering"><code>Ordering</code></a> argument which describes the memory ordering of this
operation.</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="kw">use </span>crossbeam_epoch::{<span class="self">self </span><span class="kw">as </span>epoch, Atomic};
<span class="kw">use </span>std::sync::atomic::Ordering::SeqCst;
<span class="kw">let </span>a = Atomic::new(<span class="number">1234</span>);
<span class="kw">let </span>guard = <span class="kw-2">&amp;</span>epoch::pin();
<span class="kw">let </span>p = a.load(SeqCst, guard);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.load_consume" class="method"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#408-410">source</a><h4 class="code-header">pub fn <a href="#method.load_consume" class="fn">load_consume</a>&lt;'g&gt;(&amp;self, _: &amp;'g <a class="struct" href="struct.Guard.html" title="struct crossbeam_epoch::Guard">Guard</a>) -&gt; <a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'g, T&gt;</h4></section></summary><div class="docblock"><p>Loads a <code>Shared</code> from the atomic pointer using a “consume” memory ordering.</p>
<p>This is similar to the “acquire” ordering, except that an ordering is
only guaranteed with operations that “depend on” the result of the load.
However consume loads are usually much faster than acquire loads on
architectures with a weak memory model since they dont require memory
fence instructions.</p>
<p>The exact definition of “depend on” is a bit vague, but it works as you
would expect in practice since a lot of software, especially the Linux
kernel, rely on this behavior.</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="kw">use </span>crossbeam_epoch::{<span class="self">self </span><span class="kw">as </span>epoch, Atomic};
<span class="kw">let </span>a = Atomic::new(<span class="number">1234</span>);
<span class="kw">let </span>guard = <span class="kw-2">&amp;</span>epoch::pin();
<span class="kw">let </span>p = a.load_consume(guard);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.store" class="method"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#429-431">source</a><h4 class="code-header">pub fn <a href="#method.store" class="fn">store</a>&lt;P: <a class="trait" href="trait.Pointer.html" title="trait crossbeam_epoch::Pointer">Pointer</a>&lt;T&gt;&gt;(&amp;self, new: P, ord: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a>)</h4></section></summary><div class="docblock"><p>Stores a <code>Shared</code> or <code>Owned</code> pointer into the atomic pointer.</p>
<p>This method takes an <a href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering"><code>Ordering</code></a> argument which describes the memory ordering of this
operation.</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="kw">use </span>crossbeam_epoch::{Atomic, Owned, Shared};
<span class="kw">use </span>std::sync::atomic::Ordering::SeqCst;
<span class="kw">let </span>a = Atomic::new(<span class="number">1234</span>);
a.store(Shared::null(), SeqCst);
a.store(Owned::new(<span class="number">1234</span>), SeqCst);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.swap" class="method"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#450-452">source</a><h4 class="code-header">pub fn <a href="#method.swap" class="fn">swap</a>&lt;'g, P: <a class="trait" href="trait.Pointer.html" title="trait crossbeam_epoch::Pointer">Pointer</a>&lt;T&gt;&gt;(
&amp;self,
new: P,
ord: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a>,
_: &amp;'g <a class="struct" href="struct.Guard.html" title="struct crossbeam_epoch::Guard">Guard</a>
) -&gt; <a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'g, T&gt;</h4></section></summary><div class="docblock"><p>Stores a <code>Shared</code> or <code>Owned</code> pointer into the atomic pointer, returning the previous
<code>Shared</code>.</p>
<p>This method takes an <a href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering"><code>Ordering</code></a> argument which describes the memory ordering of this
operation.</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="kw">use </span>crossbeam_epoch::{<span class="self">self </span><span class="kw">as </span>epoch, Atomic, Shared};
<span class="kw">use </span>std::sync::atomic::Ordering::SeqCst;
<span class="kw">let </span>a = Atomic::new(<span class="number">1234</span>);
<span class="kw">let </span>guard = <span class="kw-2">&amp;</span>epoch::pin();
<span class="kw">let </span>p = a.swap(Shared::null(), SeqCst, guard);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.compare_exchange" class="method"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#485-506">source</a><h4 class="code-header">pub fn <a href="#method.compare_exchange" class="fn">compare_exchange</a>&lt;'g, P&gt;(
&amp;self,
current: <a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'_, T&gt;,
new: P,
success: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a>,
failure: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a>,
_: &amp;'g <a class="struct" href="struct.Guard.html" title="struct crossbeam_epoch::Guard">Guard</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'g, T&gt;, <a class="struct" href="struct.CompareExchangeError.html" title="struct crossbeam_epoch::CompareExchangeError">CompareExchangeError</a>&lt;'g, T, P&gt;&gt;<div class="where">where
P: <a class="trait" href="trait.Pointer.html" title="trait crossbeam_epoch::Pointer">Pointer</a>&lt;T&gt;,</div></h4></section></summary><div class="docblock"><p>Stores the pointer <code>new</code> (either <code>Shared</code> or <code>Owned</code>) into the atomic pointer if the current
value is the same as <code>current</code>. The tag is also taken into account, so two pointers to the
same object, but with different tags, will not be considered equal.</p>
<p>The return value is a result indicating whether the new pointer was written. On success the
pointer that was written is returned. On failure the actual current value and <code>new</code> are
returned.</p>
<p>This method takes two <code>Ordering</code> arguments to describe the memory
ordering of this operation. <code>success</code> describes the required ordering for the
read-modify-write operation that takes place if the comparison with <code>current</code> succeeds.
<code>failure</code> describes the required ordering for the load operation that takes place when
the comparison fails. Using <code>Acquire</code> as success ordering makes the store part
of this operation <code>Relaxed</code>, and using <code>Release</code> makes the successful load
<code>Relaxed</code>. The failure ordering can only be <code>SeqCst</code>, <code>Acquire</code> or <code>Relaxed</code>
and must be equivalent to or weaker than the success ordering.</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="kw">use </span>crossbeam_epoch::{<span class="self">self </span><span class="kw">as </span>epoch, Atomic, Owned, Shared};
<span class="kw">use </span>std::sync::atomic::Ordering::SeqCst;
<span class="kw">let </span>a = Atomic::new(<span class="number">1234</span>);
<span class="kw">let </span>guard = <span class="kw-2">&amp;</span>epoch::pin();
<span class="kw">let </span>curr = a.load(SeqCst, guard);
<span class="kw">let </span>res1 = a.compare_exchange(curr, Shared::null(), SeqCst, SeqCst, guard);
<span class="kw">let </span>res2 = a.compare_exchange(curr, Owned::new(<span class="number">5678</span>), SeqCst, SeqCst, guard);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.compare_exchange_weak" class="method"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#562-583">source</a><h4 class="code-header">pub fn <a href="#method.compare_exchange_weak" class="fn">compare_exchange_weak</a>&lt;'g, P&gt;(
&amp;self,
current: <a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'_, T&gt;,
new: P,
success: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a>,
failure: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a>,
_: &amp;'g <a class="struct" href="struct.Guard.html" title="struct crossbeam_epoch::Guard">Guard</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'g, T&gt;, <a class="struct" href="struct.CompareExchangeError.html" title="struct crossbeam_epoch::CompareExchangeError">CompareExchangeError</a>&lt;'g, T, P&gt;&gt;<div class="where">where
P: <a class="trait" href="trait.Pointer.html" title="trait crossbeam_epoch::Pointer">Pointer</a>&lt;T&gt;,</div></h4></section></summary><div class="docblock"><p>Stores the pointer <code>new</code> (either <code>Shared</code> or <code>Owned</code>) into the atomic pointer if the current
value is the same as <code>current</code>. The tag is also taken into account, so two pointers to the
same object, but with different tags, will not be considered equal.</p>
<p>Unlike <a href="struct.Atomic.html#method.compare_exchange" title="method crossbeam_epoch::Atomic::compare_exchange"><code>compare_exchange</code></a>, this method is allowed to spuriously fail even when comparison
succeeds, which can result in more efficient code on some platforms. The return value is a
result indicating whether the new pointer was written. On success the pointer that was
written is returned. On failure the actual current value and <code>new</code> are returned.</p>
<p>This method takes two <code>Ordering</code> arguments to describe the memory
ordering of this operation. <code>success</code> describes the required ordering for the
read-modify-write operation that takes place if the comparison with <code>current</code> succeeds.
<code>failure</code> describes the required ordering for the load operation that takes place when
the comparison fails. Using <code>Acquire</code> as success ordering makes the store part
of this operation <code>Relaxed</code>, and using <code>Release</code> makes the successful load
<code>Relaxed</code>. The failure ordering can only be <code>SeqCst</code>, <code>Acquire</code> or <code>Relaxed</code>
and must be equivalent to or weaker than the success ordering.</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="kw">use </span>crossbeam_epoch::{<span class="self">self </span><span class="kw">as </span>epoch, Atomic, Owned, Shared};
<span class="kw">use </span>std::sync::atomic::Ordering::SeqCst;
<span class="kw">let </span>a = Atomic::new(<span class="number">1234</span>);
<span class="kw">let </span>guard = <span class="kw-2">&amp;</span>epoch::pin();
<span class="kw">let </span><span class="kw-2">mut </span>new = Owned::new(<span class="number">5678</span>);
<span class="kw">let </span><span class="kw-2">mut </span>ptr = a.load(SeqCst, guard);
<span class="kw">loop </span>{
<span class="kw">match </span>a.compare_exchange_weak(ptr, new, SeqCst, SeqCst, guard) {
<span class="prelude-val">Ok</span>(p) =&gt; {
ptr = p;
<span class="kw">break</span>;
}
<span class="prelude-val">Err</span>(err) =&gt; {
ptr = err.current;
new = err.new;
}
}
}
<span class="kw">let </span><span class="kw-2">mut </span>curr = a.load(SeqCst, guard);
<span class="kw">loop </span>{
<span class="kw">match </span>a.compare_exchange_weak(curr, Shared::null(), SeqCst, SeqCst, guard) {
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) =&gt; <span class="kw">break</span>,
<span class="prelude-val">Err</span>(err) =&gt; curr = err.current,
}
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_update" class="method"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#625-643">source</a><h4 class="code-header">pub fn <a href="#method.fetch_update" class="fn">fetch_update</a>&lt;'g, F&gt;(
&amp;self,
set_order: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a>,
fail_order: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a>,
guard: &amp;'g <a class="struct" href="struct.Guard.html" title="struct crossbeam_epoch::Guard">Guard</a>,
func: F
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'g, T&gt;, <a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'g, T&gt;&gt;<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'g, T&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'g, T&gt;&gt;,</div></h4></section></summary><div class="docblock"><p>Fetches the pointer, and then applies a function to it that returns a new value.
Returns a <code>Result</code> of <code>Ok(previous_value)</code> if the function returned <code>Some</code>, else <code>Err(_)</code>.</p>
<p>Note that the given function may be called multiple times if the value has been changed by
other threads in the meantime, as long as the function returns <code>Some(_)</code>, but the function
will have been applied only once to the stored value.</p>
<p><code>fetch_update</code> takes two <a href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering"><code>Ordering</code></a> arguments to describe the memory
ordering of this operation. The first describes the required ordering for
when the operation finally succeeds while the second describes the
required ordering for loads. These correspond to the success and failure
orderings of <a href="struct.Atomic.html#method.compare_exchange" title="method crossbeam_epoch::Atomic::compare_exchange"><code>Atomic::compare_exchange</code></a> respectively.</p>
<p>Using <a href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html#variant.Acquire" title="variant core::sync::atomic::Ordering::Acquire"><code>Acquire</code></a> as success ordering makes the store part of this
operation <a href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html#variant.Relaxed" title="variant core::sync::atomic::Ordering::Relaxed"><code>Relaxed</code></a>, and using <a href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html#variant.Release" title="variant core::sync::atomic::Ordering::Release"><code>Release</code></a> makes the final successful
load <a href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html#variant.Relaxed" title="variant core::sync::atomic::Ordering::Relaxed"><code>Relaxed</code></a>. The (failed) load ordering can only be <a href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html#variant.SeqCst" title="variant core::sync::atomic::Ordering::SeqCst"><code>SeqCst</code></a>,
<a href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html#variant.Acquire" title="variant core::sync::atomic::Ordering::Acquire"><code>Acquire</code></a> or <a href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html#variant.Relaxed" title="variant core::sync::atomic::Ordering::Relaxed"><code>Relaxed</code></a> and must be equivalent to or weaker than the
success ordering.</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="kw">use </span>crossbeam_epoch::{<span class="self">self </span><span class="kw">as </span>epoch, Atomic};
<span class="kw">use </span>std::sync::atomic::Ordering::SeqCst;
<span class="kw">let </span>a = Atomic::new(<span class="number">1234</span>);
<span class="kw">let </span>guard = <span class="kw-2">&amp;</span>epoch::pin();
<span class="kw">let </span>res1 = a.fetch_update(SeqCst, SeqCst, guard, |x| <span class="prelude-val">Some</span>(x.with_tag(<span class="number">1</span>)));
<span class="macro">assert!</span>(res1.is_ok());
<span class="kw">let </span>res2 = a.fetch_update(SeqCst, SeqCst, guard, |x| <span class="prelude-val">None</span>);
<span class="macro">assert!</span>(res2.is_err());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.compare_and_set" class="method"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#687-699">source</a><h4 class="code-header">pub fn <a href="#method.compare_and_set" class="fn">compare_and_set</a>&lt;'g, O, P&gt;(
&amp;self,
current: <a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'_, T&gt;,
new: P,
ord: O,
guard: &amp;'g <a class="struct" href="struct.Guard.html" title="struct crossbeam_epoch::Guard">Guard</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'g, T&gt;, <a class="type" href="type.CompareAndSetError.html" title="type crossbeam_epoch::CompareAndSetError">CompareAndSetError</a>&lt;'g, T, P&gt;&gt;<div class="where">where
O: <a class="trait" href="trait.CompareAndSetOrdering.html" title="trait crossbeam_epoch::CompareAndSetOrdering">CompareAndSetOrdering</a>,
P: <a class="trait" href="trait.Pointer.html" title="trait crossbeam_epoch::Pointer">Pointer</a>&lt;T&gt;,</div></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated: Use <code>compare_exchange</code> instead</span></div></span></summary><div class="docblock"><p>Stores the pointer <code>new</code> (either <code>Shared</code> or <code>Owned</code>) into the atomic pointer if the current
value is the same as <code>current</code>. The tag is also taken into account, so two pointers to the
same object, but with different tags, will not be considered equal.</p>
<p>The return value is a result indicating whether the new pointer was written. On success the
pointer that was written is returned. On failure the actual current value and <code>new</code> are
returned.</p>
<p>This method takes a <a href="trait.CompareAndSetOrdering.html" title="trait crossbeam_epoch::CompareAndSetOrdering"><code>CompareAndSetOrdering</code></a> argument which describes the memory
ordering of this operation.</p>
<h5 id="migrating-to-compare_exchange"><a href="#migrating-to-compare_exchange">Migrating to <code>compare_exchange</code></a></h5>
<p><code>compare_and_set</code> is equivalent to <code>compare_exchange</code> with the following mapping for
memory orderings:</p>
<div><table><thead><tr><th>Original</th><th>Success</th><th>Failure</th></tr></thead><tbody>
<tr><td>Relaxed</td><td>Relaxed</td><td>Relaxed</td></tr>
<tr><td>Acquire</td><td>Acquire</td><td>Acquire</td></tr>
<tr><td>Release</td><td>Release</td><td>Relaxed</td></tr>
<tr><td>AcqRel</td><td>AcqRel</td><td>Acquire</td></tr>
<tr><td>SeqCst</td><td>SeqCst</td><td>SeqCst</td></tr>
</tbody></table>
</div><h5 id="examples-10"><a href="#examples-10">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_epoch::{<span class="self">self </span><span class="kw">as </span>epoch, Atomic, Owned, Shared};
<span class="kw">use </span>std::sync::atomic::Ordering::SeqCst;
<span class="kw">let </span>a = Atomic::new(<span class="number">1234</span>);
<span class="kw">let </span>guard = <span class="kw-2">&amp;</span>epoch::pin();
<span class="kw">let </span>curr = a.load(SeqCst, guard);
<span class="kw">let </span>res1 = a.compare_and_set(curr, Shared::null(), SeqCst, guard);
<span class="kw">let </span>res2 = a.compare_and_set(curr, Owned::new(<span class="number">5678</span>), SeqCst, guard);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.compare_and_set_weak" class="method"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#766-778">source</a><h4 class="code-header">pub fn <a href="#method.compare_and_set_weak" class="fn">compare_and_set_weak</a>&lt;'g, O, P&gt;(
&amp;self,
current: <a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'_, T&gt;,
new: P,
ord: O,
guard: &amp;'g <a class="struct" href="struct.Guard.html" title="struct crossbeam_epoch::Guard">Guard</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'g, T&gt;, <a class="type" href="type.CompareAndSetError.html" title="type crossbeam_epoch::CompareAndSetError">CompareAndSetError</a>&lt;'g, T, P&gt;&gt;<div class="where">where
O: <a class="trait" href="trait.CompareAndSetOrdering.html" title="trait crossbeam_epoch::CompareAndSetOrdering">CompareAndSetOrdering</a>,
P: <a class="trait" href="trait.Pointer.html" title="trait crossbeam_epoch::Pointer">Pointer</a>&lt;T&gt;,</div></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated: Use <code>compare_exchange_weak</code> instead</span></div></span></summary><div class="docblock"><p>Stores the pointer <code>new</code> (either <code>Shared</code> or <code>Owned</code>) into the atomic pointer if the current
value is the same as <code>current</code>. The tag is also taken into account, so two pointers to the
same object, but with different tags, will not be considered equal.</p>
<p>Unlike <a href="struct.Atomic.html#method.compare_and_set" title="method crossbeam_epoch::Atomic::compare_and_set"><code>compare_and_set</code></a>, this method is allowed to spuriously fail even when comparison
succeeds, which can result in more efficient code on some platforms. The return value is a
result indicating whether the new pointer was written. On success the pointer that was
written is returned. On failure the actual current value and <code>new</code> are returned.</p>
<p>This method takes a <a href="trait.CompareAndSetOrdering.html" title="trait crossbeam_epoch::CompareAndSetOrdering"><code>CompareAndSetOrdering</code></a> argument which describes the memory
ordering of this operation.</p>
<h5 id="migrating-to-compare_exchange_weak"><a href="#migrating-to-compare_exchange_weak">Migrating to <code>compare_exchange_weak</code></a></h5>
<p><code>compare_and_set_weak</code> is equivalent to <code>compare_exchange_weak</code> with the following mapping for
memory orderings:</p>
<div><table><thead><tr><th>Original</th><th>Success</th><th>Failure</th></tr></thead><tbody>
<tr><td>Relaxed</td><td>Relaxed</td><td>Relaxed</td></tr>
<tr><td>Acquire</td><td>Acquire</td><td>Acquire</td></tr>
<tr><td>Release</td><td>Release</td><td>Relaxed</td></tr>
<tr><td>AcqRel</td><td>AcqRel</td><td>Acquire</td></tr>
<tr><td>SeqCst</td><td>SeqCst</td><td>SeqCst</td></tr>
</tbody></table>
</div><h5 id="examples-11"><a href="#examples-11">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_epoch::{<span class="self">self </span><span class="kw">as </span>epoch, Atomic, Owned, Shared};
<span class="kw">use </span>std::sync::atomic::Ordering::SeqCst;
<span class="kw">let </span>a = Atomic::new(<span class="number">1234</span>);
<span class="kw">let </span>guard = <span class="kw-2">&amp;</span>epoch::pin();
<span class="kw">let </span><span class="kw-2">mut </span>new = Owned::new(<span class="number">5678</span>);
<span class="kw">let </span><span class="kw-2">mut </span>ptr = a.load(SeqCst, guard);
<span class="kw">loop </span>{
<span class="kw">match </span>a.compare_and_set_weak(ptr, new, SeqCst, guard) {
<span class="prelude-val">Ok</span>(p) =&gt; {
ptr = p;
<span class="kw">break</span>;
}
<span class="prelude-val">Err</span>(err) =&gt; {
ptr = err.current;
new = err.new;
}
}
}
<span class="kw">let </span><span class="kw-2">mut </span>curr = a.load(SeqCst, guard);
<span class="kw">loop </span>{
<span class="kw">match </span>a.compare_and_set_weak(curr, Shared::null(), SeqCst, guard) {
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) =&gt; <span class="kw">break</span>,
<span class="prelude-val">Err</span>(err) =&gt; curr = err.current,
}
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_and" class="method"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#799-801">source</a><h4 class="code-header">pub fn <a href="#method.fetch_and" class="fn">fetch_and</a>&lt;'g&gt;(
&amp;self,
val: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>,
ord: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a>,
_: &amp;'g <a class="struct" href="struct.Guard.html" title="struct crossbeam_epoch::Guard">Guard</a>
) -&gt; <a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'g, T&gt;</h4></section></summary><div class="docblock"><p>Bitwise “and” with the current tag.</p>
<p>Performs a bitwise “and” operation on the current tag and the argument <code>val</code>, and sets the
new tag to the result. Returns the previous pointer.</p>
<p>This method takes an <a href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering"><code>Ordering</code></a> argument which describes the memory ordering of this
operation.</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>crossbeam_epoch::{<span class="self">self </span><span class="kw">as </span>epoch, Atomic, Shared};
<span class="kw">use </span>std::sync::atomic::Ordering::SeqCst;
<span class="kw">let </span>a = Atomic::&lt;i32&gt;::from(Shared::null().with_tag(<span class="number">3</span>));
<span class="kw">let </span>guard = <span class="kw-2">&amp;</span>epoch::pin();
<span class="macro">assert_eq!</span>(a.fetch_and(<span class="number">2</span>, SeqCst, guard).tag(), <span class="number">3</span>);
<span class="macro">assert_eq!</span>(a.load(SeqCst, guard).tag(), <span class="number">2</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_or" class="method"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#822-824">source</a><h4 class="code-header">pub fn <a href="#method.fetch_or" class="fn">fetch_or</a>&lt;'g&gt;(
&amp;self,
val: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>,
ord: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a>,
_: &amp;'g <a class="struct" href="struct.Guard.html" title="struct crossbeam_epoch::Guard">Guard</a>
) -&gt; <a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'g, T&gt;</h4></section></summary><div class="docblock"><p>Bitwise “or” with the current tag.</p>
<p>Performs a bitwise “or” operation on the current tag and the argument <code>val</code>, and sets the
new tag to the result. Returns the previous pointer.</p>
<p>This method takes an <a href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering"><code>Ordering</code></a> argument which describes the memory ordering of this
operation.</p>
<h5 id="examples-13"><a href="#examples-13">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_epoch::{<span class="self">self </span><span class="kw">as </span>epoch, Atomic, Shared};
<span class="kw">use </span>std::sync::atomic::Ordering::SeqCst;
<span class="kw">let </span>a = Atomic::&lt;i32&gt;::from(Shared::null().with_tag(<span class="number">1</span>));
<span class="kw">let </span>guard = <span class="kw-2">&amp;</span>epoch::pin();
<span class="macro">assert_eq!</span>(a.fetch_or(<span class="number">2</span>, SeqCst, guard).tag(), <span class="number">1</span>);
<span class="macro">assert_eq!</span>(a.load(SeqCst, guard).tag(), <span class="number">3</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_xor" class="method"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#845-847">source</a><h4 class="code-header">pub fn <a href="#method.fetch_xor" class="fn">fetch_xor</a>&lt;'g&gt;(
&amp;self,
val: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>,
ord: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering">Ordering</a>,
_: &amp;'g <a class="struct" href="struct.Guard.html" title="struct crossbeam_epoch::Guard">Guard</a>
) -&gt; <a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'g, T&gt;</h4></section></summary><div class="docblock"><p>Bitwise “xor” with the current tag.</p>
<p>Performs a bitwise “xor” operation on the current tag and the argument <code>val</code>, and sets the
new tag to the result. Returns the previous pointer.</p>
<p>This method takes an <a href="https://doc.rust-lang.org/1.76.0/core/sync/atomic/enum.Ordering.html" title="enum core::sync::atomic::Ordering"><code>Ordering</code></a> argument which describes the memory ordering of this
operation.</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>crossbeam_epoch::{<span class="self">self </span><span class="kw">as </span>epoch, Atomic, Shared};
<span class="kw">use </span>std::sync::atomic::Ordering::SeqCst;
<span class="kw">let </span>a = Atomic::&lt;i32&gt;::from(Shared::null().with_tag(<span class="number">1</span>));
<span class="kw">let </span>guard = <span class="kw-2">&amp;</span>epoch::pin();
<span class="macro">assert_eq!</span>(a.fetch_xor(<span class="number">3</span>, SeqCst, guard).tag(), <span class="number">1</span>);
<span class="macro">assert_eq!</span>(a.load(SeqCst, guard).tag(), <span class="number">2</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_owned" class="method"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#883-885">source</a><h4 class="code-header">pub unsafe fn <a href="#method.into_owned" class="fn">into_owned</a>(self) -&gt; <a class="struct" href="struct.Owned.html" title="struct crossbeam_epoch::Owned">Owned</a>&lt;T&gt;</h4></section></summary><div class="docblock"><p>Takes ownership of the pointee.</p>
<p>This consumes the atomic and converts it into <a href="struct.Owned.html" title="struct crossbeam_epoch::Owned"><code>Owned</code></a>. As <a href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic"><code>Atomic</code></a> doesnt have a
destructor and doesnt drop the pointee while <a href="struct.Owned.html" title="struct crossbeam_epoch::Owned"><code>Owned</code></a> does, this is suitable for
destructors of data structures.</p>
<h5 id="panics"><a href="#panics">Panics</a></h5>
<p>Panics if this pointer is null, but only in debug mode.</p>
<h5 id="safety"><a href="#safety">Safety</a></h5>
<p>This method may be called only if the pointer is valid and nobody else is holding a
reference to the same object.</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">struct </span>DataStructure {
ptr: Atomic&lt;usize&gt;,
}
<span class="kw">impl </span>Drop <span class="kw">for </span>DataStructure {
<span class="kw">fn </span>drop(<span class="kw-2">&amp;mut </span><span class="self">self</span>) {
<span class="comment">// By now the DataStructure lives only in our thread and we are sure we don't hold
// any Shared or &amp; to it ourselves.
</span><span class="kw">unsafe </span>{
drop(mem::replace(<span class="kw-2">&amp;mut </span><span class="self">self</span>.ptr, Atomic::null()).into_owned());
}
}
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into_owned" class="method"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#920-927">source</a><h4 class="code-header">pub unsafe fn <a href="#method.try_into_owned" class="fn">try_into_owned</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.Owned.html" title="struct crossbeam_epoch::Owned">Owned</a>&lt;T&gt;&gt;</h4></section></summary><div class="docblock"><p>Takes ownership of the pointee if it is non-null.</p>
<p>This consumes the atomic and converts it into <a href="struct.Owned.html" title="struct crossbeam_epoch::Owned"><code>Owned</code></a>. As <a href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic"><code>Atomic</code></a> doesnt have a
destructor and doesnt drop the pointee while <a href="struct.Owned.html" title="struct crossbeam_epoch::Owned"><code>Owned</code></a> does, this is suitable for
destructors of data structures.</p>
<h5 id="safety-1"><a href="#safety-1">Safety</a></h5>
<p>This method may be called only if the pointer is valid and nobody else is holding a
reference to the same object, or the pointer is null.</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">struct </span>DataStructure {
ptr: Atomic&lt;usize&gt;,
}
<span class="kw">impl </span>Drop <span class="kw">for </span>DataStructure {
<span class="kw">fn </span>drop(<span class="kw-2">&amp;mut </span><span class="self">self</span>) {
<span class="comment">// By now the DataStructure lives only in our thread and we are sure we don't hold
// any Shared or &amp; to it ourselves, but it may be null, so we have to be careful.
</span><span class="kw">let </span>old = mem::replace(<span class="kw-2">&amp;mut </span><span class="self">self</span>.ptr, Atomic::null());
<span class="kw">unsafe </span>{
<span class="kw">if let </span><span class="prelude-val">Some</span>(x) = old.try_into_owned() {
drop(x)
}
}
}
}</code></pre></div>
</div></details></div></details></div><h2 id="trait-implementations" class="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-Clone-for-Atomic%3CT%3E" class="impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#950-959">source</a><a href="#impl-Clone-for-Atomic%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.Pointable.html" title="trait crossbeam_epoch::Pointable">Pointable</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic">Atomic</a>&lt;T&gt;</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="../src/crossbeam_epoch/atomic.rs.html#955-958">source</a><a href="#method.clone" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&amp;self) -&gt; Self</h4></section></summary><div class="docblock"><p>Returns a copy of the atomic value.</p>
<p>Note that a <code>Relaxed</code> load is used here. If you need synchronization, use it with other
atomics or fences.</p>
</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.76.0/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.76.0/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.76.0/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.76.0/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-Atomic%3CT%3E" class="impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#930-940">source</a><a href="#impl-Debug-for-Atomic%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.Pointable.html" title="trait crossbeam_epoch::Pointable">Pointable</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic">Atomic</a>&lt;T&gt;</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="../src/crossbeam_epoch/atomic.rs.html#931-939">source</a><a href="#method.fmt-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/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.76.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.76.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.76.0/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-Atomic%3CT%3E" class="impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#961-965">source</a><a href="#impl-Default-for-Atomic%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.Pointable.html" title="trait crossbeam_epoch::Pointable">Pointable</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic">Atomic</a>&lt;T&gt;</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="../src/crossbeam_epoch/atomic.rs.html#962-964">source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -&gt; Self</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3C*const+T%3E-for-Atomic%3CT%3E" class="impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#1012-1026">source</a><a href="#impl-From%3C*const+T%3E-for-Atomic%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.pointer.html">*const T</a>&gt; for <a class="struct" href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic">Atomic</a>&lt;T&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-3" class="method trait-impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#1023-1025">source</a><a href="#method.from-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(raw: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.pointer.html">*const T</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Returns a new atomic pointer pointing to <code>raw</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::ptr;
<span class="kw">use </span>crossbeam_epoch::Atomic;
<span class="kw">let </span>a = Atomic::&lt;i32&gt;::from(ptr::null::&lt;i32&gt;());</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CBox%3CT%3E%3E-for-Atomic%3CT%3E" class="impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#985-989">source</a><a href="#impl-From%3CBox%3CT%3E%3E-for-Atomic%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;T&gt;&gt; for <a class="struct" href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic">Atomic</a>&lt;T&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="../src/crossbeam_epoch/atomic.rs.html#986-988">source</a><a href="#method.from-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(b: <a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;T&gt;) -&gt; Self</h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3COwned%3CT%3E%3E-for-Atomic%3CT%3E" class="impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#967-983">source</a><a href="#impl-From%3COwned%3CT%3E%3E-for-Atomic%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.Pointable.html" title="trait crossbeam_epoch::Pointable">Pointable</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="struct.Owned.html" title="struct crossbeam_epoch::Owned">Owned</a>&lt;T&gt;&gt; for <a class="struct" href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic">Atomic</a>&lt;T&gt;</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="../src/crossbeam_epoch/atomic.rs.html#978-982">source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(owned: <a class="struct" href="struct.Owned.html" title="struct crossbeam_epoch::Owned">Owned</a>&lt;T&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Returns a new atomic pointer pointing to <code>owned</code>.</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>crossbeam_epoch::{Atomic, Owned};
<span class="kw">let </span>a = Atomic::&lt;i32&gt;::from(Owned::new(<span class="number">1234</span>));</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CShared%3C'g,+T%3E%3E-for-Atomic%3CT%3E" class="impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#997-1010">source</a><a href="#impl-From%3CShared%3C'g,+T%3E%3E-for-Atomic%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'g, T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.Pointable.html" title="trait crossbeam_epoch::Pointable">Pointable</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'g, T&gt;&gt; for <a class="struct" href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic">Atomic</a>&lt;T&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-4" class="method trait-impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#1007-1009">source</a><a href="#method.from-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(ptr: <a class="struct" href="struct.Shared.html" title="struct crossbeam_epoch::Shared">Shared</a>&lt;'g, T&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Returns a new atomic pointer pointing to <code>ptr</code>.</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="kw">use </span>crossbeam_epoch::{Atomic, Shared};
<span class="kw">let </span>a = Atomic::&lt;i32&gt;::from(Shared::&lt;i32&gt;::null());</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CT%3E-for-Atomic%3CT%3E" class="impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#991-995">source</a><a href="#impl-From%3CT%3E-for-Atomic%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for <a class="struct" href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic">Atomic</a>&lt;T&gt;</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="../src/crossbeam_epoch/atomic.rs.html#992-994">source</a><a href="#method.from-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -&gt; Self</h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Pointer-for-Atomic%3CT%3E" class="impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#942-948">source</a><a href="#impl-Pointer-for-Atomic%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.Pointable.html" title="trait crossbeam_epoch::Pointable">Pointable</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Pointer.html" title="trait core::fmt::Pointer">Pointer</a> for <a class="struct" href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic">Atomic</a>&lt;T&gt;</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="../src/crossbeam_epoch/atomic.rs.html#943-947">source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/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.76.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.76.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter.</div></details></div></details><section id="impl-Send-for-Atomic%3CT%3E" class="impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#299">source</a><a href="#impl-Send-for-Atomic%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.Pointable.html" title="trait crossbeam_epoch::Pointable">Pointable</a> + <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic">Atomic</a>&lt;T&gt;</h3></section><section id="impl-Sync-for-Atomic%3CT%3E" class="impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#300">source</a><a href="#impl-Sync-for-Atomic%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.Pointable.html" title="trait crossbeam_epoch::Pointable">Pointable</a> + <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic">Atomic</a>&lt;T&gt;</h3></section></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-Atomic%3CT%3E" class="impl"><a href="#impl-RefUnwindSafe-for-Atomic%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic">Atomic</a>&lt;T&gt;<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a>,</div></h3></section><section id="impl-Unpin-for-Atomic%3CT%3E" class="impl"><a href="#impl-Unpin-for-Atomic%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic">Atomic</a>&lt;T&gt;</h3></section><section id="impl-UnwindSafe-for-Atomic%3CT%3E" class="impl"><a href="#impl-UnwindSafe-for-Atomic%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Atomic.html" title="struct crossbeam_epoch::Atomic">Atomic</a>&lt;T&gt;<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a>,</div></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#141">source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.76.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#208">source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></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.76.0/src/core/borrow.rs.html#210">source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/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.76.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#216">source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#217">source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3C!%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#780">source</a><a href="#impl-From%3C!%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.never.html">!</a>&gt; for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-6" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#781">source</a><a href="#method.from-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.never.html">!</a>) -&gt; T</h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#763">source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-5" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#766">source</a><a href="#method.from-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#747-749">source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#756">source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code><a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Pointable-for-T" class="impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#194-214">source</a><a href="#impl-Pointable-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="trait.Pointable.html" title="trait crossbeam_epoch::Pointable">Pointable</a> for T</h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedconstant.ALIGN" class="associatedconstant trait-impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#195">source</a><a href="#associatedconstant.ALIGN" class="anchor">§</a><h4 class="code-header">const <a href="trait.Pointable.html#associatedconstant.ALIGN" class="constant">ALIGN</a>: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a> = const ALIGN: usize = mem::align_of::&lt;T&gt;();</h4></section></summary><div class='docblock'>The alignment of pointer.</div></details><details class="toggle" open><summary><section id="associatedtype.Init" class="associatedtype trait-impl"><a href="#associatedtype.Init" class="anchor">§</a><h4 class="code-header">type <a href="trait.Pointable.html#associatedtype.Init" class="associatedtype">Init</a> = T</h4></section></summary><div class='docblock'>The type for initializers.</div></details><details class="toggle method-toggle" open><summary><section id="method.init-1" class="method trait-impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#199-201">source</a><a href="#method.init-1" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="trait.Pointable.html#tymethod.init" class="fn">init</a>(init: &lt;T as <a class="trait" href="trait.Pointable.html" title="trait crossbeam_epoch::Pointable">Pointable</a>&gt;::<a class="associatedtype" href="trait.Pointable.html#associatedtype.Init" title="type crossbeam_epoch::Pointable::Init">Init</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Initializes a with the given initializer. <a href="trait.Pointable.html#tymethod.init">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.deref" class="method trait-impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#203-205">source</a><a href="#method.deref" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="trait.Pointable.html#tymethod.deref" class="fn">deref</a>&lt;'a&gt;(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;'a T</a></h4></section></summary><div class='docblock'>Dereferences the given pointer. <a href="trait.Pointable.html#tymethod.deref">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.deref_mut" class="method trait-impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#207-209">source</a><a href="#method.deref_mut" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="trait.Pointable.html#tymethod.deref_mut" class="fn">deref_mut</a>&lt;'a&gt;(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;'a mut T</a></h4></section></summary><div class='docblock'>Mutably dereferences the given pointer. <a href="trait.Pointable.html#tymethod.deref_mut">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.drop" class="method trait-impl"><a class="src rightside" href="../src/crossbeam_epoch/atomic.rs.html#211-213">source</a><a href="#method.drop" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="trait.Pointable.html#tymethod.drop" class="fn">drop</a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>)</h4></section></summary><div class='docblock'>Drops the object pointed to by the given pointer. <a href="trait.Pointable.html#tymethod.drop">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToOwned-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/alloc/borrow.rs.html#83-85">source</a><a href="#impl-ToOwned-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl"><a href="#associatedtype.Owned" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/alloc/borrow.rs.html#88">source</a><a href="#method.to_owned" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fn">to_owned</a>(&amp;self) -&gt; T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/alloc/borrow.rs.html#92">source</a><a href="#method.clone_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fn">clone_into</a>(&amp;self, target: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut T</a>)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#803-805">source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><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 href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#810">source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#788-790">source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><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 href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#795">source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>