890 lines
176 KiB
HTML
890 lines
176 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A thread-safe mutable memory location."><title>AtomicCell in crossbeam_utils::atomic - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="crossbeam_utils" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.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]--><rustdoc-topbar><h2><a href="#">AtomicCell</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../crossbeam_utils/index.html">crossbeam_<wbr>utils</a><span class="version">0.8.21</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Atomic<wbr>Cell</a></h2><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.as_ptr" title="as_ptr">as_ptr</a></li><li><a href="#method.compare_and_swap" title="compare_and_swap">compare_and_swap</a></li><li><a href="#method.compare_exchange" title="compare_exchange">compare_exchange</a></li><li><a href="#method.fetch_add" title="fetch_add">fetch_add</a></li><li><a href="#method.fetch_add-1" title="fetch_add">fetch_add</a></li><li><a href="#method.fetch_add-10" title="fetch_add">fetch_add</a></li><li><a href="#method.fetch_add-11" title="fetch_add">fetch_add</a></li><li><a href="#method.fetch_add-2" title="fetch_add">fetch_add</a></li><li><a href="#method.fetch_add-3" title="fetch_add">fetch_add</a></li><li><a href="#method.fetch_add-4" title="fetch_add">fetch_add</a></li><li><a href="#method.fetch_add-5" title="fetch_add">fetch_add</a></li><li><a href="#method.fetch_add-6" title="fetch_add">fetch_add</a></li><li><a href="#method.fetch_add-7" title="fetch_add">fetch_add</a></li><li><a href="#method.fetch_add-8" title="fetch_add">fetch_add</a></li><li><a href="#method.fetch_add-9" title="fetch_add">fetch_add</a></li><li><a href="#method.fetch_and" title="fetch_and">fetch_and</a></li><li><a href="#method.fetch_and-1" title="fetch_and">fetch_and</a></li><li><a href="#method.fetch_and-10" title="fetch_and">fetch_and</a></li><li><a href="#method.fetch_and-11" title="fetch_and">fetch_and</a></li><li><a href="#method.fetch_and-12" title="fetch_and">fetch_and</a></li><li><a href="#method.fetch_and-2" title="fetch_and">fetch_and</a></li><li><a href="#method.fetch_and-3" title="fetch_and">fetch_and</a></li><li><a href="#method.fetch_and-4" title="fetch_and">fetch_and</a></li><li><a href="#method.fetch_and-5" title="fetch_and">fetch_and</a></li><li><a href="#method.fetch_and-6" title="fetch_and">fetch_and</a></li><li><a href="#method.fetch_and-7" title="fetch_and">fetch_and</a></li><li><a href="#method.fetch_and-8" title="fetch_and">fetch_and</a></li><li><a href="#method.fetch_and-9" title="fetch_and">fetch_and</a></li><li><a href="#method.fetch_max" title="fetch_max">fetch_max</a></li><li><a href="#method.fetch_max-1" title="fetch_max">fetch_max</a></li><li><a href="#method.fetch_max-10" title="fetch_max">fetch_max</a></li><li><a href="#method.fetch_max-11" title="fetch_max">fetch_max</a></li><li><a href="#method.fetch_max-2" title="fetch_max">fetch_max</a></li><li><a href="#method.fetch_max-3" title="fetch_max">fetch_max</a></li><li><a href="#method.fetch_max-4" title="fetch_max">fetch_max</a></li><li><a href="#method.fetch_max-5" title="fetch_max">fetch_max</a></li><li><a href="#method.fetch_max-6" title="fetch_max">fetch_max</a></li><li><a href="#method.fetch_max-7" title="fetch_max">fetch_max</a></li><li><a href="#method.fetch_max-8" title="fetch_max">fetch_max</a></li><li><a href="#method.fetch_max-9" title="fetch_max">fetch_max</a></li><li><a href="#method.fetch_min" title="fetch_min">fetch_min</a></li><li><a href="#method.fetch_min-1" title="fetch_min">fetch_min</a></li><li><a href="#method.fetch_min-10" title="fetch_min">fetch_min</a></li><li><a href="#method.fetch_min-11" title="fetch_min">fetch_min</a></li><li><a href="#method.fetch_min-2" title="fetch_min">fetch_min</a></li><li><a href="#method.fetch_min-3" title="fetch_min">fetch_min</a></li><li><a href="#method.fetch_min-4" title="fetch_min">fetch_min</a></li><li><a href="#method.fetch_min-5" title="fetch_min">fetch_min</a></li><li><a href="#method.fetch_min-6" title="fetch_min">fetch_min</a></li><li><a href="#method.fetch_min-7" title="fetch_min">fetch_min</a></li><li><a href="#method.fetch_min-8" title="fetch_min">fetch_min</a></li><li><a href="#method.fetch_min-9" title="fetch_min">fetch_min</a></li><li><a href="#method.fetch_nand" title="fetch_nand">fetch_nand</a></li><li><a href="#method.fetch_nand-1" title="fetch_nand">fetch_nand</a></li><li><a href="#method.fetch_nand-10" title="fetch_nand">fetch_nand</a></li><li><a href="#method.fetch_nand-11" title="fetch_nand">fetch_nand</a></li><li><a href="#method.fetch_nand-12" title="fetch_nand">fetch_nand</a></li><li><a href="#method.fetch_nand-2" title="fetch_nand">fetch_nand</a></li><li><a href="#method.fetch_nand-3" title="fetch_nand">fetch_nand</a></li><li><a href="#method.fetch_nand-4" title="fetch_nand">fetch_nand</a></li><li><a href="#method.fetch_nand-5" title="fetch_nand">fetch_nand</a></li><li><a href="#method.fetch_nand-6" title="fetch_nand">fetch_nand</a></li><li><a href="#method.fetch_nand-7" title="fetch_nand">fetch_nand</a></li><li><a href="#method.fetch_nand-8" title="fetch_nand">fetch_nand</a></li><li><a href="#method.fetch_nand-9" title="fetch_nand">fetch_nand</a></li><li><a href="#method.fetch_or" title="fetch_or">fetch_or</a></li><li><a href="#method.fetch_or-1" title="fetch_or">fetch_or</a></li><li><a href="#method.fetch_or-10" title="fetch_or">fetch_or</a></li><li><a href="#method.fetch_or-11" title="fetch_or">fetch_or</a></li><li><a href="#method.fetch_or-12" title="fetch_or">fetch_or</a></li><li><a href="#method.fetch_or-2" title="fetch_or">fetch_or</a></li><li><a href="#method.fetch_or-3" title="fetch_or">fetch_or</a></li><li><a href="#method.fetch_or-4" title="fetch_or">fetch_or</a></li><li><a href="#method.fetch_or-5" title="fetch_or">fetch_or</a></li><li><a href="#method.fetch_or-6" title="fetch_or">fetch_or</a></li><li><a href="#method.fetch_or-7" title="fetch_or">fetch_or</a></li><li><a href="#method.fetch_or-8" title="fetch_or">fetch_or</a></li><li><a href="#method.fetch_or-9" title="fetch_or">fetch_or</a></li><li><a href="#method.fetch_sub" title="fetch_sub">fetch_sub</a></li><li><a href="#method.fetch_sub-1" title="fetch_sub">fetch_sub</a></li><li><a href="#method.fetch_sub-10" title="fetch_sub">fetch_sub</a></li><li><a href="#method.fetch_sub-11" title="fetch_sub">fetch_sub</a></li><li><a href="#method.fetch_sub-2" title="fetch_sub">fetch_sub</a></li><li><a href="#method.fetch_sub-3" title="fetch_sub">fetch_sub</a></li><li><a href="#method.fetch_sub-4" title="fetch_sub">fetch_sub</a></li><li><a href="#method.fetch_sub-5" title="fetch_sub">fetch_sub</a></li><li><a href="#method.fetch_sub-6" title="fetch_sub">fetch_sub</a></li><li><a href="#method.fetch_sub-7" title="fetch_sub">fetch_sub</a></li><li><a href="#method.fetch_sub-8" title="fetch_sub">fetch_sub</a></li><li><a href="#method.fetch_sub-9" title="fetch_sub">fetch_sub</a></li><li><a href="#method.fetch_update" title="fetch_update">fetch_update</a></li><li><a href="#method.fetch_xor" title="fetch_xor">fetch_xor</a></li><li><a href="#method.fetch_xor-1" title="fetch_xor">fetch_xor</a></li><li><a href="#method.fetch_xor-10" title="fetch_xor">fetch_xor</a></li><li><a href="#method.fetch_xor-11" title="fetch_xor">fetch_xor</a></li><li><a href="#method.fetch_xor-12" title="fetch_xor">fetch_xor</a></li><li><a href="#method.fetch_xor-2" title="fetch_xor">fetch_xor</a></li><li><a href="#method.fetch_xor-3" title="fetch_xor">fetch_xor</a></li><li><a href="#method.fetch_xor-4" title="fetch_xor">fetch_xor</a></li><li><a href="#method.fetch_xor-5" title="fetch_xor">fetch_xor</a></li><li><a href="#method.fetch_xor-6" title="fetch_xor">fetch_xor</a></li><li><a href="#method.fetch_xor-7" title="fetch_xor">fetch_xor</a></li><li><a href="#method.fetch_xor-8" title="fetch_xor">fetch_xor</a></li><li><a href="#method.fetch_xor-9" title="fetch_xor">fetch_xor</a></li><li><a href="#method.into_inner" title="into_inner">into_inner</a></li><li><a href="#method.is_lock_free" title="is_lock_free">is_lock_free</a></li><li><a href="#method.load" title="load">load</a></li><li><a href="#method.new" title="new">new</a></li><li><a href="#method.store" title="store">store</a></li><li><a href="#method.swap" title="swap">swap</a></li><li><a href="#method.take" title="take">take</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Debug-for-AtomicCell%3CT%3E" title="Debug">Debug</a></li><li><a href="#impl-Default-for-AtomicCell%3CT%3E" title="Default">Default</a></li><li><a href="#impl-Drop-for-AtomicCell%3CT%3E" title="Drop">Drop</a></li><li><a href="#impl-From%3CT%3E-for-AtomicCell%3CT%3E" title="From<T>">From<T></a></li><li><a href="#impl-RefUnwindSafe-for-AtomicCell%3CT%3E" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-Send-for-AtomicCell%3CT%3E" title="Send">Send</a></li><li><a href="#impl-Sync-for-AtomicCell%3CT%3E" title="Sync">Sync</a></li><li><a href="#impl-UnwindSafe-for-AtomicCell%3CT%3E" title="UnwindSafe">UnwindSafe</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-AtomicCell%3CT%3E" title="!Freeze">!Freeze</a></li><li><a href="#impl-Unpin-for-AtomicCell%3CT%3E" title="Unpin">Unpin</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T" title="Any">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T" title="Borrow<T>">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut<T>">BorrowMut<T></a></li><li><a href="#impl-From%3C!%3E-for-T" title="From<!>">From<!></a></li><li><a href="#impl-From%3CT%3E-for-T" title="From<T>">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into<U>">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T" title="TryFrom<U>">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto<U>">TryInto<U></a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In crossbeam_<wbr>utils::<wbr>atomic</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">crossbeam_utils</a>::<wbr><a href="index.html">atomic</a></div><h1>Struct <span class="struct">Atomic<wbr>Cell</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#30-45">Source</a> </span></div><pre class="rust item-decl"><code>pub struct AtomicCell<T> { <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>A thread-safe mutable memory location.</p>
|
||
<p>This type is equivalent to <a href="https://doc.rust-lang.org/1.93.1/core/cell/struct.Cell.html" title="struct core::cell::Cell"><code>Cell</code></a>, except it can also be shared among multiple threads.</p>
|
||
<p>Operations on <code>AtomicCell</code>s use atomic instructions whenever possible, and synchronize using
|
||
global locks otherwise. You can call <a href="struct.AtomicCell.html#method.is_lock_free" title="associated function crossbeam_utils::atomic::AtomicCell::is_lock_free"><code>AtomicCell::<T>::is_lock_free()</code></a> to check whether
|
||
atomic instructions or locks will be used.</p>
|
||
<p>Atomic loads use the <a href="https://doc.rust-lang.org/1.93.1/core/sync/atomic/enum.Ordering.html#variant.Acquire" title="variant core::sync::atomic::Ordering::Acquire"><code>Acquire</code></a> ordering and atomic stores use the <a href="https://doc.rust-lang.org/1.93.1/core/sync/atomic/enum.Ordering.html#variant.Release" title="variant core::sync::atomic::Ordering::Release"><code>Release</code></a> ordering.</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-AtomicCell%3CT%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#53-181">Source</a><a href="#impl-AtomicCell%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><T></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_utils/atomic/atomic_cell.rs.html#63-67">Source</a><h4 class="code-header">pub const fn <a href="#method.new" class="fn">new</a>(val: T) -> <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><T></h4></section></summary><div class="docblock"><p>Creates a new atomic cell initialized with <code>val</code>.</p>
|
||
<h5 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.into_inner" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#84-92">Source</a><h4 class="code-header">pub fn <a href="#method.into_inner" class="fn">into_inner</a>(self) -> T</h4></section></summary><div class="docblock"><p>Consumes the atomic and returns the contained value.</p>
|
||
<p>This is safe because passing <code>self</code> by value guarantees that no other threads are
|
||
concurrently accessing the atomic data.</p>
|
||
<h5 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7</span>);
|
||
<span class="kw">let </span>v = a.into_inner();
|
||
|
||
<span class="macro">assert_eq!</span>(v, <span class="number">7</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.is_lock_free" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#122-124">Source</a><h4 class="code-header">pub const fn <a href="#method.is_lock_free" class="fn">is_lock_free</a>() -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if operations on values of this type are lock-free.</p>
|
||
<p>If the compiler or the platform doesn’t support the necessary atomic instructions,
|
||
<code>AtomicCell<T></code> will use global locks for every potentially concurrent atomic operation.</p>
|
||
<h5 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="comment">// This type is internally represented as `AtomicUsize` so we can just use atomic
|
||
// operations provided by it.
|
||
</span><span class="macro">assert_eq!</span>(AtomicCell::<usize>::is_lock_free(), <span class="bool-val">true</span>);
|
||
|
||
<span class="comment">// A wrapper struct around `isize`.
|
||
</span><span class="kw">struct </span>Foo {
|
||
bar: isize,
|
||
}
|
||
<span class="comment">// `AtomicCell<Foo>` will be internally represented as `AtomicIsize`.
|
||
</span><span class="macro">assert_eq!</span>(AtomicCell::<Foo>::is_lock_free(), <span class="bool-val">true</span>);
|
||
|
||
<span class="comment">// Operations on zero-sized types are always lock-free.
|
||
</span><span class="macro">assert_eq!</span>(AtomicCell::<()>::is_lock_free(), <span class="bool-val">true</span>);
|
||
|
||
<span class="comment">// Very large types cannot be represented as any of the standard atomic types, so atomic
|
||
// operations on them will have to use global locks for synchronization.
|
||
</span><span class="macro">assert_eq!</span>(AtomicCell::<[u8; <span class="number">1000</span>]>::is_lock_free(), <span class="bool-val">false</span>);</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_utils/atomic/atomic_cell.rs.html#139-147">Source</a><h4 class="code-header">pub fn <a href="#method.store" class="fn">store</a>(&self, val: T)</h4></section></summary><div class="docblock"><p>Stores <code>val</code> into the atomic cell.</p>
|
||
<h5 id="examples-3"><a class="doc-anchor" href="#examples-3">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">7</span>);
|
||
a.store(<span class="number">8</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">8</span>);</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_utils/atomic/atomic_cell.rs.html#162-164">Source</a><h4 class="code-header">pub fn <a href="#method.swap" class="fn">swap</a>(&self, val: T) -> T</h4></section></summary><div class="docblock"><p>Stores <code>val</code> into the atomic cell and returns the previous value.</p>
|
||
<h5 id="examples-4"><a class="doc-anchor" href="#examples-4">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.swap(<span class="number">8</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">8</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.as_ptr" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#178-180">Source</a><h4 class="code-header">pub fn <a href="#method.as_ptr" class="fn">as_ptr</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.pointer.html">*mut T</a></h4></section></summary><div class="docblock"><p>Returns a raw pointer to the underlying data in this atomic cell.</p>
|
||
<h5 id="examples-5"><a class="doc-anchor" href="#examples-5">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">5</span>);
|
||
|
||
<span class="kw">let </span>ptr = a.as_ptr();</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AtomicCell%3CT%3E-1" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#183-200">Source</a><a href="#impl-AtomicCell%3CT%3E-1" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html" title="trait core::default::Default">Default</a>> <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><T></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.take" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#197-199">Source</a><h4 class="code-header">pub fn <a href="#method.take" class="fn">take</a>(&self) -> T</h4></section></summary><div class="docblock"><p>Takes the value of the atomic cell, leaving <code>Default::default()</code> in its place.</p>
|
||
<h5 id="examples-6"><a class="doc-anchor" href="#examples-6">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">5</span>);
|
||
<span class="kw">let </span>five = a.take();
|
||
|
||
<span class="macro">assert_eq!</span>(five, <span class="number">5</span>);
|
||
<span class="macro">assert_eq!</span>(a.into_inner(), <span class="number">0</span>);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AtomicCell%3CT%3E-2" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#202-217">Source</a><a href="#impl-AtomicCell%3CT%3E-2" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a>> <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><T></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.load" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#214-216">Source</a><h4 class="code-header">pub fn <a href="#method.load" class="fn">load</a>(&self) -> T</h4></section></summary><div class="docblock"><p>Loads a value from the atomic cell.</p>
|
||
<h5 id="examples-7"><a class="doc-anchor" href="#examples-7">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">7</span>);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AtomicCell%3CT%3E-3" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#219-303">Source</a><a href="#impl-AtomicCell%3CT%3E-3" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a>> <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><T></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.compare_and_swap" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#241-246">Source</a><h4 class="code-header">pub fn <a href="#method.compare_and_swap" class="fn">compare_and_swap</a>(&self, current: T, new: T) -> T</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>If the current value equals <code>current</code>, stores <code>new</code> into the atomic cell.</p>
|
||
<p>The return value is always the previous value. If it is equal to <code>current</code>, then the value
|
||
was updated.</p>
|
||
<h5 id="examples-8"><a class="doc-anchor" href="#examples-8">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">1</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.compare_and_swap(<span class="number">2</span>, <span class="number">3</span>), <span class="number">1</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">1</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.compare_and_swap(<span class="number">1</span>, <span class="number">2</span>), <span class="number">1</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">2</span>);</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_utils/atomic/atomic_cell.rs.html#266-268">Source</a><h4 class="code-header">pub fn <a href="#method.compare_exchange" class="fn">compare_exchange</a>(&self, current: T, new: T) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, T></h4></section></summary><div class="docblock"><p>If the current value equals <code>current</code>, stores <code>new</code> into the atomic cell.</p>
|
||
<p>The return value is a result indicating whether the new value was written and containing
|
||
the previous value. On success this value is guaranteed to be equal to <code>current</code>.</p>
|
||
<h5 id="examples-9"><a class="doc-anchor" href="#examples-9">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">1</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.compare_exchange(<span class="number">2</span>, <span class="number">3</span>), <span class="prelude-val">Err</span>(<span class="number">1</span>));
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">1</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.compare_exchange(<span class="number">1</span>, <span class="number">2</span>), <span class="prelude-val">Ok</span>(<span class="number">1</span>));
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">2</span>);</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_utils/atomic/atomic_cell.rs.html#290-302">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_update" class="fn">fetch_update</a><F>(&self, f: F) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, T><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(T) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><T>,</div></h4></section></summary><div class="docblock"><p>Fetches the value, and applies a function to it that returns an optional
|
||
new value. Returns a <code>Result</code> of <code>Ok(previous_value)</code> if the function returned <code>Some(_)</code>, else
|
||
<code>Err(previous_value)</code>.</p>
|
||
<p>Note: This may call the function multiple times if the value has been changed from 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>
|
||
<h5 id="examples-10"><a class="doc-anchor" href="#examples-10">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.fetch_update(|<span class="kw">_</span>| <span class="prelude-val">None</span>), <span class="prelude-val">Err</span>(<span class="number">7</span>));
|
||
<span class="macro">assert_eq!</span>(a.fetch_update(|a| <span class="prelude-val">Some</span>(a + <span class="number">1</span>)), <span class="prelude-val">Ok</span>(<span class="number">7</span>));
|
||
<span class="macro">assert_eq!</span>(a.fetch_update(|a| <span class="prelude-val">Some</span>(a + <span class="number">1</span>)), <span class="prelude-val">Ok</span>(<span class="number">8</span>));
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">9</span>);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AtomicCell%3Cu8%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#780">Source</a><a href="#impl-AtomicCell%3Cu8%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fetch_add" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#780">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_add" class="fn">fetch_add</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a></h4></section></summary><div class="docblock"><p>Increments the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The addition wraps on overflow.</p>
|
||
<h5 id="examples-11"><a class="doc-anchor" href="#examples-11">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u8</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_add(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">10</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_sub" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#780">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_sub" class="fn">fetch_sub</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a></h4></section></summary><div class="docblock"><p>Decrements the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The subtraction wraps on overflow.</p>
|
||
<h5 id="examples-12"><a class="doc-anchor" href="#examples-12">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u8</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_sub(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">4</span>);</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_utils/atomic/atomic_cell.rs.html#780">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_and" class="fn">fetch_and</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a></h4></section></summary><div class="docblock"><p>Applies bitwise “and” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-13"><a class="doc-anchor" href="#examples-13">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u8</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_and(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">3</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_nand" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#780">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_nand" class="fn">fetch_nand</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a></h4></section></summary><div class="docblock"><p>Applies bitwise “nand” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-14"><a class="doc-anchor" href="#examples-14">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u8</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_nand(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), !(<span class="number">7 </span>& <span class="number">3</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_utils/atomic/atomic_cell.rs.html#780">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_or" class="fn">fetch_or</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a></h4></section></summary><div class="docblock"><p>Applies bitwise “or” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-15"><a class="doc-anchor" href="#examples-15">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u8</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_or(<span class="number">16</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">23</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_utils/atomic/atomic_cell.rs.html#780">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_xor" class="fn">fetch_xor</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a></h4></section></summary><div class="docblock"><p>Applies bitwise “xor” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-16"><a class="doc-anchor" href="#examples-16">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u8</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_xor(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">5</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_max" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#780">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_max" class="fn">fetch_max</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a></h4></section></summary><div class="docblock"><p>Compares and sets the maximum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-17"><a class="doc-anchor" href="#examples-17">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u8</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_max(<span class="number">9</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">9</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_min" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#780">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_min" class="fn">fetch_min</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a></h4></section></summary><div class="docblock"><p>Compares and sets the minimum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-18"><a class="doc-anchor" href="#examples-18">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u8</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_min(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">2</span>);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AtomicCell%3Ci8%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#781">Source</a><a href="#impl-AtomicCell%3Ci8%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fetch_add-1" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#781">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_add-1" class="fn">fetch_add</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a></h4></section></summary><div class="docblock"><p>Increments the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The addition wraps on overflow.</p>
|
||
<h5 id="examples-19"><a class="doc-anchor" href="#examples-19">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i8</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_add(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">10</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_sub-1" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#781">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_sub-1" class="fn">fetch_sub</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a></h4></section></summary><div class="docblock"><p>Decrements the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The subtraction wraps on overflow.</p>
|
||
<h5 id="examples-20"><a class="doc-anchor" href="#examples-20">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i8</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_sub(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">4</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_and-1" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#781">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_and-1" class="fn">fetch_and</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a></h4></section></summary><div class="docblock"><p>Applies bitwise “and” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-21"><a class="doc-anchor" href="#examples-21">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i8</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_and(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">3</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_nand-1" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#781">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_nand-1" class="fn">fetch_nand</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a></h4></section></summary><div class="docblock"><p>Applies bitwise “nand” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-22"><a class="doc-anchor" href="#examples-22">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i8</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_nand(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), !(<span class="number">7 </span>& <span class="number">3</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_or-1" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#781">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_or-1" class="fn">fetch_or</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a></h4></section></summary><div class="docblock"><p>Applies bitwise “or” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-23"><a class="doc-anchor" href="#examples-23">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i8</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_or(<span class="number">16</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">23</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_xor-1" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#781">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_xor-1" class="fn">fetch_xor</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a></h4></section></summary><div class="docblock"><p>Applies bitwise “xor” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-24"><a class="doc-anchor" href="#examples-24">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i8</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_xor(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">5</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_max-1" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#781">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_max-1" class="fn">fetch_max</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a></h4></section></summary><div class="docblock"><p>Compares and sets the maximum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-25"><a class="doc-anchor" href="#examples-25">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i8</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_max(<span class="number">9</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">9</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_min-1" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#781">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_min-1" class="fn">fetch_min</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i8.html">i8</a></h4></section></summary><div class="docblock"><p>Compares and sets the minimum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-26"><a class="doc-anchor" href="#examples-26">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i8</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_min(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">2</span>);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AtomicCell%3Cu16%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#782">Source</a><a href="#impl-AtomicCell%3Cu16%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fetch_add-2" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#782">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_add-2" class="fn">fetch_add</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a></h4></section></summary><div class="docblock"><p>Increments the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The addition wraps on overflow.</p>
|
||
<h5 id="examples-27"><a class="doc-anchor" href="#examples-27">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u16</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_add(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">10</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_sub-2" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#782">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_sub-2" class="fn">fetch_sub</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a></h4></section></summary><div class="docblock"><p>Decrements the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The subtraction wraps on overflow.</p>
|
||
<h5 id="examples-28"><a class="doc-anchor" href="#examples-28">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u16</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_sub(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">4</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_and-2" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#782">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_and-2" class="fn">fetch_and</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a></h4></section></summary><div class="docblock"><p>Applies bitwise “and” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-29"><a class="doc-anchor" href="#examples-29">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u16</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_and(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">3</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_nand-2" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#782">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_nand-2" class="fn">fetch_nand</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a></h4></section></summary><div class="docblock"><p>Applies bitwise “nand” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-30"><a class="doc-anchor" href="#examples-30">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u16</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_nand(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), !(<span class="number">7 </span>& <span class="number">3</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_or-2" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#782">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_or-2" class="fn">fetch_or</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a></h4></section></summary><div class="docblock"><p>Applies bitwise “or” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-31"><a class="doc-anchor" href="#examples-31">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u16</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_or(<span class="number">16</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">23</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_xor-2" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#782">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_xor-2" class="fn">fetch_xor</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a></h4></section></summary><div class="docblock"><p>Applies bitwise “xor” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-32"><a class="doc-anchor" href="#examples-32">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u16</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_xor(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">5</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_max-2" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#782">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_max-2" class="fn">fetch_max</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a></h4></section></summary><div class="docblock"><p>Compares and sets the maximum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-33"><a class="doc-anchor" href="#examples-33">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u16</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_max(<span class="number">9</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">9</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_min-2" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#782">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_min-2" class="fn">fetch_min</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a></h4></section></summary><div class="docblock"><p>Compares and sets the minimum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-34"><a class="doc-anchor" href="#examples-34">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u16</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_min(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">2</span>);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AtomicCell%3Ci16%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#783">Source</a><a href="#impl-AtomicCell%3Ci16%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fetch_add-3" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#783">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_add-3" class="fn">fetch_add</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a></h4></section></summary><div class="docblock"><p>Increments the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The addition wraps on overflow.</p>
|
||
<h5 id="examples-35"><a class="doc-anchor" href="#examples-35">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i16</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_add(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">10</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_sub-3" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#783">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_sub-3" class="fn">fetch_sub</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a></h4></section></summary><div class="docblock"><p>Decrements the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The subtraction wraps on overflow.</p>
|
||
<h5 id="examples-36"><a class="doc-anchor" href="#examples-36">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i16</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_sub(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">4</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_and-3" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#783">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_and-3" class="fn">fetch_and</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a></h4></section></summary><div class="docblock"><p>Applies bitwise “and” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-37"><a class="doc-anchor" href="#examples-37">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i16</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_and(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">3</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_nand-3" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#783">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_nand-3" class="fn">fetch_nand</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a></h4></section></summary><div class="docblock"><p>Applies bitwise “nand” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-38"><a class="doc-anchor" href="#examples-38">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i16</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_nand(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), !(<span class="number">7 </span>& <span class="number">3</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_or-3" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#783">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_or-3" class="fn">fetch_or</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a></h4></section></summary><div class="docblock"><p>Applies bitwise “or” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-39"><a class="doc-anchor" href="#examples-39">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i16</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_or(<span class="number">16</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">23</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_xor-3" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#783">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_xor-3" class="fn">fetch_xor</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a></h4></section></summary><div class="docblock"><p>Applies bitwise “xor” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-40"><a class="doc-anchor" href="#examples-40">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i16</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_xor(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">5</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_max-3" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#783">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_max-3" class="fn">fetch_max</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a></h4></section></summary><div class="docblock"><p>Compares and sets the maximum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-41"><a class="doc-anchor" href="#examples-41">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i16</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_max(<span class="number">9</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">9</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_min-3" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#783">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_min-3" class="fn">fetch_min</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i16.html">i16</a></h4></section></summary><div class="docblock"><p>Compares and sets the minimum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-42"><a class="doc-anchor" href="#examples-42">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i16</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_min(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">2</span>);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AtomicCell%3Cu32%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#785">Source</a><a href="#impl-AtomicCell%3Cu32%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fetch_add-4" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#785">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_add-4" class="fn">fetch_add</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a></h4></section></summary><div class="docblock"><p>Increments the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The addition wraps on overflow.</p>
|
||
<h5 id="examples-43"><a class="doc-anchor" href="#examples-43">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u32</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_add(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">10</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_sub-4" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#785">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_sub-4" class="fn">fetch_sub</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a></h4></section></summary><div class="docblock"><p>Decrements the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The subtraction wraps on overflow.</p>
|
||
<h5 id="examples-44"><a class="doc-anchor" href="#examples-44">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u32</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_sub(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">4</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_and-4" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#785">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_and-4" class="fn">fetch_and</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a></h4></section></summary><div class="docblock"><p>Applies bitwise “and” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-45"><a class="doc-anchor" href="#examples-45">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u32</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_and(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">3</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_nand-4" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#785">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_nand-4" class="fn">fetch_nand</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a></h4></section></summary><div class="docblock"><p>Applies bitwise “nand” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-46"><a class="doc-anchor" href="#examples-46">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u32</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_nand(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), !(<span class="number">7 </span>& <span class="number">3</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_or-4" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#785">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_or-4" class="fn">fetch_or</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a></h4></section></summary><div class="docblock"><p>Applies bitwise “or” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-47"><a class="doc-anchor" href="#examples-47">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u32</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_or(<span class="number">16</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">23</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_xor-4" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#785">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_xor-4" class="fn">fetch_xor</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a></h4></section></summary><div class="docblock"><p>Applies bitwise “xor” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-48"><a class="doc-anchor" href="#examples-48">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u32</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_xor(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">5</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_max-4" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#785">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_max-4" class="fn">fetch_max</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a></h4></section></summary><div class="docblock"><p>Compares and sets the maximum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-49"><a class="doc-anchor" href="#examples-49">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u32</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_max(<span class="number">9</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">9</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_min-4" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#785">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_min-4" class="fn">fetch_min</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a></h4></section></summary><div class="docblock"><p>Compares and sets the minimum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-50"><a class="doc-anchor" href="#examples-50">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u32</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_min(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">2</span>);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AtomicCell%3Ci32%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#786">Source</a><a href="#impl-AtomicCell%3Ci32%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fetch_add-5" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#786">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_add-5" class="fn">fetch_add</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a></h4></section></summary><div class="docblock"><p>Increments the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The addition wraps on overflow.</p>
|
||
<h5 id="examples-51"><a class="doc-anchor" href="#examples-51">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i32</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_add(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">10</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_sub-5" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#786">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_sub-5" class="fn">fetch_sub</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a></h4></section></summary><div class="docblock"><p>Decrements the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The subtraction wraps on overflow.</p>
|
||
<h5 id="examples-52"><a class="doc-anchor" href="#examples-52">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i32</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_sub(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">4</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_and-5" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#786">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_and-5" class="fn">fetch_and</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a></h4></section></summary><div class="docblock"><p>Applies bitwise “and” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-53"><a class="doc-anchor" href="#examples-53">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i32</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_and(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">3</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_nand-5" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#786">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_nand-5" class="fn">fetch_nand</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a></h4></section></summary><div class="docblock"><p>Applies bitwise “nand” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-54"><a class="doc-anchor" href="#examples-54">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i32</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_nand(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), !(<span class="number">7 </span>& <span class="number">3</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_or-5" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#786">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_or-5" class="fn">fetch_or</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a></h4></section></summary><div class="docblock"><p>Applies bitwise “or” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-55"><a class="doc-anchor" href="#examples-55">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i32</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_or(<span class="number">16</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">23</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_xor-5" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#786">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_xor-5" class="fn">fetch_xor</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a></h4></section></summary><div class="docblock"><p>Applies bitwise “xor” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-56"><a class="doc-anchor" href="#examples-56">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i32</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_xor(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">5</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_max-5" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#786">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_max-5" class="fn">fetch_max</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a></h4></section></summary><div class="docblock"><p>Compares and sets the maximum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-57"><a class="doc-anchor" href="#examples-57">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i32</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_max(<span class="number">9</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">9</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_min-5" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#786">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_min-5" class="fn">fetch_min</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i32.html">i32</a></h4></section></summary><div class="docblock"><p>Compares and sets the minimum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-58"><a class="doc-anchor" href="#examples-58">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i32</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_min(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">2</span>);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AtomicCell%3Cu64%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#789">Source</a><a href="#impl-AtomicCell%3Cu64%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fetch_add-6" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#789">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_add-6" class="fn">fetch_add</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Increments the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The addition wraps on overflow.</p>
|
||
<h5 id="examples-59"><a class="doc-anchor" href="#examples-59">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u64</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_add(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">10</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_sub-6" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#789">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_sub-6" class="fn">fetch_sub</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Decrements the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The subtraction wraps on overflow.</p>
|
||
<h5 id="examples-60"><a class="doc-anchor" href="#examples-60">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u64</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_sub(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">4</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_and-6" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#789">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_and-6" class="fn">fetch_and</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Applies bitwise “and” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-61"><a class="doc-anchor" href="#examples-61">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u64</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_and(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">3</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_nand-6" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#789">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_nand-6" class="fn">fetch_nand</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Applies bitwise “nand” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-62"><a class="doc-anchor" href="#examples-62">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u64</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_nand(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), !(<span class="number">7 </span>& <span class="number">3</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_or-6" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#789">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_or-6" class="fn">fetch_or</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Applies bitwise “or” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-63"><a class="doc-anchor" href="#examples-63">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u64</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_or(<span class="number">16</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">23</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_xor-6" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#789">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_xor-6" class="fn">fetch_xor</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Applies bitwise “xor” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-64"><a class="doc-anchor" href="#examples-64">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u64</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_xor(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">5</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_max-6" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#789">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_max-6" class="fn">fetch_max</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Compares and sets the maximum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-65"><a class="doc-anchor" href="#examples-65">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u64</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_max(<span class="number">9</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">9</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_min-6" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#789">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_min-6" class="fn">fetch_min</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Compares and sets the minimum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-66"><a class="doc-anchor" href="#examples-66">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u64</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_min(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">2</span>);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AtomicCell%3Ci64%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#791">Source</a><a href="#impl-AtomicCell%3Ci64%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fetch_add-7" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#791">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_add-7" class="fn">fetch_add</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a></h4></section></summary><div class="docblock"><p>Increments the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The addition wraps on overflow.</p>
|
||
<h5 id="examples-67"><a class="doc-anchor" href="#examples-67">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i64</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_add(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">10</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_sub-7" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#791">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_sub-7" class="fn">fetch_sub</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a></h4></section></summary><div class="docblock"><p>Decrements the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The subtraction wraps on overflow.</p>
|
||
<h5 id="examples-68"><a class="doc-anchor" href="#examples-68">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i64</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_sub(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">4</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_and-7" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#791">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_and-7" class="fn">fetch_and</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a></h4></section></summary><div class="docblock"><p>Applies bitwise “and” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-69"><a class="doc-anchor" href="#examples-69">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i64</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_and(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">3</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_nand-7" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#791">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_nand-7" class="fn">fetch_nand</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a></h4></section></summary><div class="docblock"><p>Applies bitwise “nand” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-70"><a class="doc-anchor" href="#examples-70">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i64</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_nand(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), !(<span class="number">7 </span>& <span class="number">3</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_or-7" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#791">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_or-7" class="fn">fetch_or</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a></h4></section></summary><div class="docblock"><p>Applies bitwise “or” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-71"><a class="doc-anchor" href="#examples-71">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i64</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_or(<span class="number">16</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">23</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_xor-7" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#791">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_xor-7" class="fn">fetch_xor</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a></h4></section></summary><div class="docblock"><p>Applies bitwise “xor” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-72"><a class="doc-anchor" href="#examples-72">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i64</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_xor(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">5</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_max-7" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#791">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_max-7" class="fn">fetch_max</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a></h4></section></summary><div class="docblock"><p>Compares and sets the maximum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-73"><a class="doc-anchor" href="#examples-73">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i64</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_max(<span class="number">9</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">9</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_min-7" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#791">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_min-7" class="fn">fetch_min</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a></h4></section></summary><div class="docblock"><p>Compares and sets the minimum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-74"><a class="doc-anchor" href="#examples-74">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i64</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_min(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">2</span>);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AtomicCell%3Cu128%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#800">Source</a><a href="#impl-AtomicCell%3Cu128%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fetch_add-8" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#800">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_add-8" class="fn">fetch_add</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a></h4></section></summary><div class="docblock"><p>Increments the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The addition wraps on overflow.</p>
|
||
<h5 id="examples-75"><a class="doc-anchor" href="#examples-75">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u128</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_add(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">10</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_sub-8" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#800">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_sub-8" class="fn">fetch_sub</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a></h4></section></summary><div class="docblock"><p>Decrements the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The subtraction wraps on overflow.</p>
|
||
<h5 id="examples-76"><a class="doc-anchor" href="#examples-76">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u128</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_sub(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">4</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_and-8" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#800">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_and-8" class="fn">fetch_and</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a></h4></section></summary><div class="docblock"><p>Applies bitwise “and” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-77"><a class="doc-anchor" href="#examples-77">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u128</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_and(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">3</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_nand-8" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#800">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_nand-8" class="fn">fetch_nand</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a></h4></section></summary><div class="docblock"><p>Applies bitwise “nand” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-78"><a class="doc-anchor" href="#examples-78">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u128</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_nand(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), !(<span class="number">7 </span>& <span class="number">3</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_or-8" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#800">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_or-8" class="fn">fetch_or</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a></h4></section></summary><div class="docblock"><p>Applies bitwise “or” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-79"><a class="doc-anchor" href="#examples-79">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u128</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_or(<span class="number">16</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">23</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_xor-8" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#800">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_xor-8" class="fn">fetch_xor</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a></h4></section></summary><div class="docblock"><p>Applies bitwise “xor” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-80"><a class="doc-anchor" href="#examples-80">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u128</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_xor(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">5</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_max-8" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#800">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_max-8" class="fn">fetch_max</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a></h4></section></summary><div class="docblock"><p>Compares and sets the maximum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-81"><a class="doc-anchor" href="#examples-81">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u128</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_max(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">7</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_min-8" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#800">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_min-8" class="fn">fetch_min</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a></h4></section></summary><div class="docblock"><p>Compares and sets the minimum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-82"><a class="doc-anchor" href="#examples-82">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7u128</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_min(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">2</span>);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AtomicCell%3Ci128%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#801">Source</a><a href="#impl-AtomicCell%3Ci128%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fetch_add-9" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#801">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_add-9" class="fn">fetch_add</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a></h4></section></summary><div class="docblock"><p>Increments the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The addition wraps on overflow.</p>
|
||
<h5 id="examples-83"><a class="doc-anchor" href="#examples-83">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i128</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_add(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">10</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_sub-9" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#801">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_sub-9" class="fn">fetch_sub</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a></h4></section></summary><div class="docblock"><p>Decrements the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The subtraction wraps on overflow.</p>
|
||
<h5 id="examples-84"><a class="doc-anchor" href="#examples-84">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i128</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_sub(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">4</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_and-9" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#801">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_and-9" class="fn">fetch_and</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a></h4></section></summary><div class="docblock"><p>Applies bitwise “and” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-85"><a class="doc-anchor" href="#examples-85">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i128</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_and(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">3</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_nand-9" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#801">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_nand-9" class="fn">fetch_nand</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a></h4></section></summary><div class="docblock"><p>Applies bitwise “nand” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-86"><a class="doc-anchor" href="#examples-86">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i128</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_nand(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), !(<span class="number">7 </span>& <span class="number">3</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_or-9" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#801">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_or-9" class="fn">fetch_or</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a></h4></section></summary><div class="docblock"><p>Applies bitwise “or” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-87"><a class="doc-anchor" href="#examples-87">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i128</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_or(<span class="number">16</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">23</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_xor-9" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#801">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_xor-9" class="fn">fetch_xor</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a></h4></section></summary><div class="docblock"><p>Applies bitwise “xor” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-88"><a class="doc-anchor" href="#examples-88">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i128</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_xor(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">5</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_max-9" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#801">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_max-9" class="fn">fetch_max</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a></h4></section></summary><div class="docblock"><p>Compares and sets the maximum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-89"><a class="doc-anchor" href="#examples-89">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i128</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_max(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">7</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_min-9" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#801">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_min-9" class="fn">fetch_min</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i128.html">i128</a></h4></section></summary><div class="docblock"><p>Compares and sets the minimum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-90"><a class="doc-anchor" href="#examples-90">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7i128</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_min(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">2</span>);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AtomicCell%3Cusize%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#803">Source</a><a href="#impl-AtomicCell%3Cusize%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fetch_add-10" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#803">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_add-10" class="fn">fetch_add</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Increments the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The addition wraps on overflow.</p>
|
||
<h5 id="examples-91"><a class="doc-anchor" href="#examples-91">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7usize</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_add(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">10</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_sub-10" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#803">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_sub-10" class="fn">fetch_sub</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Decrements the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The subtraction wraps on overflow.</p>
|
||
<h5 id="examples-92"><a class="doc-anchor" href="#examples-92">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7usize</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_sub(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">4</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_and-10" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#803">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_and-10" class="fn">fetch_and</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Applies bitwise “and” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-93"><a class="doc-anchor" href="#examples-93">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7usize</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_and(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">3</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_nand-10" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#803">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_nand-10" class="fn">fetch_nand</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Applies bitwise “nand” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-94"><a class="doc-anchor" href="#examples-94">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7usize</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_nand(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), !(<span class="number">7 </span>& <span class="number">3</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_or-10" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#803">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_or-10" class="fn">fetch_or</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Applies bitwise “or” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-95"><a class="doc-anchor" href="#examples-95">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7usize</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_or(<span class="number">16</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">23</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_xor-10" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#803">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_xor-10" class="fn">fetch_xor</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Applies bitwise “xor” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-96"><a class="doc-anchor" href="#examples-96">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7usize</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_xor(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">5</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_max-10" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#803">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_max-10" class="fn">fetch_max</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Compares and sets the maximum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-97"><a class="doc-anchor" href="#examples-97">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7usize</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_max(<span class="number">9</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">9</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_min-10" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#803">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_min-10" class="fn">fetch_min</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Compares and sets the minimum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-98"><a class="doc-anchor" href="#examples-98">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7usize</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_min(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">2</span>);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AtomicCell%3Cisize%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#804">Source</a><a href="#impl-AtomicCell%3Cisize%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.isize.html">isize</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fetch_add-11" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#804">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_add-11" class="fn">fetch_add</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.isize.html">isize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.isize.html">isize</a></h4></section></summary><div class="docblock"><p>Increments the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The addition wraps on overflow.</p>
|
||
<h5 id="examples-99"><a class="doc-anchor" href="#examples-99">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7isize</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_add(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">10</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_sub-11" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#804">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_sub-11" class="fn">fetch_sub</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.isize.html">isize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.isize.html">isize</a></h4></section></summary><div class="docblock"><p>Decrements the current value by <code>val</code> and returns the previous value.</p>
|
||
<p>The subtraction wraps on overflow.</p>
|
||
<h5 id="examples-100"><a class="doc-anchor" href="#examples-100">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7isize</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_sub(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">4</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_and-11" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#804">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_and-11" class="fn">fetch_and</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.isize.html">isize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.isize.html">isize</a></h4></section></summary><div class="docblock"><p>Applies bitwise “and” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-101"><a class="doc-anchor" href="#examples-101">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7isize</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_and(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">3</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_nand-11" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#804">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_nand-11" class="fn">fetch_nand</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.isize.html">isize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.isize.html">isize</a></h4></section></summary><div class="docblock"><p>Applies bitwise “nand” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-102"><a class="doc-anchor" href="#examples-102">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7isize</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_nand(<span class="number">3</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), !(<span class="number">7 </span>& <span class="number">3</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_or-11" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#804">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_or-11" class="fn">fetch_or</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.isize.html">isize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.isize.html">isize</a></h4></section></summary><div class="docblock"><p>Applies bitwise “or” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-103"><a class="doc-anchor" href="#examples-103">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7isize</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_or(<span class="number">16</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">23</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_xor-11" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#804">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_xor-11" class="fn">fetch_xor</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.isize.html">isize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.isize.html">isize</a></h4></section></summary><div class="docblock"><p>Applies bitwise “xor” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-104"><a class="doc-anchor" href="#examples-104">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7isize</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_xor(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">5</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_max-11" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#804">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_max-11" class="fn">fetch_max</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.isize.html">isize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.isize.html">isize</a></h4></section></summary><div class="docblock"><p>Compares and sets the maximum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-105"><a class="doc-anchor" href="#examples-105">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7isize</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_max(<span class="number">9</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">9</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_min-11" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#804">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_min-11" class="fn">fetch_min</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.isize.html">isize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.isize.html">isize</a></h4></section></summary><div class="docblock"><p>Compares and sets the minimum of the current value and <code>val</code>,
|
||
and returns the previous value.</p>
|
||
<h5 id="examples-106"><a class="doc-anchor" href="#examples-106">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="number">7isize</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_min(<span class="number">2</span>), <span class="number">7</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="number">2</span>);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AtomicCell%3Cbool%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#806-941">Source</a><a href="#impl-AtomicCell%3Cbool%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fetch_and-12" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#823-838">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_and-12" class="fn">fetch_and</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Applies logical “and” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-107"><a class="doc-anchor" href="#examples-107">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="bool-val">true</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_and(<span class="bool-val">true</span>), <span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="bool-val">true</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_and(<span class="bool-val">false</span>), <span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="bool-val">false</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_nand-12" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#859-874">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_nand-12" class="fn">fetch_nand</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Applies logical “nand” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-108"><a class="doc-anchor" href="#examples-108">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="bool-val">true</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_nand(<span class="bool-val">false</span>), <span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="bool-val">true</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_nand(<span class="bool-val">true</span>), <span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="bool-val">false</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_nand(<span class="bool-val">false</span>), <span class="bool-val">false</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="bool-val">true</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_or-12" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#892-907">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_or-12" class="fn">fetch_or</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Applies logical “or” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-109"><a class="doc-anchor" href="#examples-109">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="bool-val">false</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_or(<span class="bool-val">false</span>), <span class="bool-val">false</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="bool-val">false</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_or(<span class="bool-val">true</span>), <span class="bool-val">false</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="bool-val">true</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fetch_xor-12" class="method"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#925-940">Source</a><h4 class="code-header">pub fn <a href="#method.fetch_xor-12" class="fn">fetch_xor</a>(&self, val: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Applies logical “xor” to the current value and returns the previous value.</p>
|
||
<h5 id="examples-110"><a class="doc-anchor" href="#examples-110">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_utils::atomic::AtomicCell;
|
||
|
||
<span class="kw">let </span>a = AtomicCell::new(<span class="bool-val">true</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_xor(<span class="bool-val">false</span>), <span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="bool-val">true</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.fetch_xor(<span class="bool-val">true</span>), <span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(a.load(), <span class="bool-val">false</span>);</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-Debug-for-AtomicCell%3CT%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#956-962">Source</a><a href="#impl-Debug-for-AtomicCell%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><T></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_utils/atomic/atomic_cell.rs.html#957-961">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.93.1/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.93.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-AtomicCell%3CT%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#943-947">Source</a><a href="#impl-Default-for-AtomicCell%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html" title="trait core::default::Default">Default</a>> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><T></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_utils/atomic/atomic_cell.rs.html#944-946">Source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -> <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><T></h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Drop-for-AtomicCell%3CT%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#307-319">Source</a><a href="#impl-Drop-for-AtomicCell%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><T></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="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#308-318">Source</a><a href="#method.drop" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/ops/drop/trait.Drop.html#tymethod.drop" class="fn">drop</a>(&mut self)</h4></section></summary><div class='docblock'>Executes the destructor for this type. <a href="https://doc.rust-lang.org/1.93.1/core/ops/drop/trait.Drop.html#tymethod.drop">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CT%3E-for-AtomicCell%3CT%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#949-954">Source</a><a href="#impl-From%3CT%3E-for-AtomicCell%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><T></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_utils/atomic/atomic_cell.rs.html#951-953">Source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(val: T) -> <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><T></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><section id="impl-RefUnwindSafe-for-AtomicCell%3CT%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#51">Source</a><a href="#impl-RefUnwindSafe-for-AtomicCell%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><T></h3></section><section id="impl-Send-for-AtomicCell%3CT%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#47">Source</a><a href="#impl-Send-for-AtomicCell%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><T></h3></section><section id="impl-Sync-for-AtomicCell%3CT%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#48">Source</a><a href="#impl-Sync-for-AtomicCell%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><T></h3></section><section id="impl-UnwindSafe-for-AtomicCell%3CT%3E" class="impl"><a class="src rightside" href="../../src/crossbeam_utils/atomic/atomic_cell.rs.html#50">Source</a><a href="#impl-UnwindSafe-for-AtomicCell%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><T></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-Freeze-for-AtomicCell%3CT%3E" class="impl"><a href="#impl-Freeze-for-AtomicCell%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> !<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><T></h3></section><section id="impl-Unpin-for-AtomicCell%3CT%3E" class="impl"><a href="#impl-Unpin-for-AtomicCell%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.AtomicCell.html" title="struct crossbeam_utils::atomic::AtomicCell">AtomicCell</a><T><div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</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.93.1/src/core/any.rs.html#138">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/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.93.1/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.93.1/src/core/any.rs.html#139">Source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.93.1/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.93.1/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.93.1/src/core/borrow.rs.html#212">Source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/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.93.1/src/core/borrow.rs.html#214">Source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.93.1/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.93.1/src/core/borrow.rs.html#221">Source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/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.93.1/src/core/borrow.rs.html#222">Source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.93.1/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.93.1/src/core/convert/mod.rs.html#802">Source</a><a href="#impl-From%3C!%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.never.html">!</a>> for T</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.93.1/src/core/convert/mod.rs.html#803">Source</a><a href="#method.from-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.never.html">!</a>) -> 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.93.1/src/core/convert/mod.rs.html#785">Source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</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.93.1/src/core/convert/mod.rs.html#788">Source</a><a href="#method.from-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -> 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.93.1/src/core/convert/mod.rs.html#767-769">Source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>,</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.93.1/src/core/convert/mod.rs.html#777">Source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -> 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.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p>
|
||
</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.93.1/src/core/convert/mod.rs.html#827-829">Source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#831">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.93.1/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.93.1/src/core/convert/mod.rs.html#834">Source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></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.93.1/src/core/convert/mod.rs.html#811-813">Source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#815">Source</a><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/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.93.1/src/core/convert/mod.rs.html#818">Source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html> |