| <!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="Trait which allows reading from primitive atomic types with “consume” ordering."><meta name="keywords" content="rust, rustlang, rust-lang, AtomicConsume"><title>AtomicConsume in crossbeam_utils::atomic - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../../normalize.css"><link rel="stylesheet" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../../ayu.css" disabled><link rel="stylesheet" href="../../dark.css" disabled><link rel="stylesheet" href="../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../main.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../favicon.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../../crossbeam_utils/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../crossbeam_utils/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">AtomicConsume</a></h2><div class="sidebar-elems"><section><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Val">Val</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.load_consume">load_consume</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-AtomicConsume-for-AtomicBool">AtomicBool</a></li><li><a href="#impl-AtomicConsume-for-AtomicI16">AtomicI16</a></li><li><a href="#impl-AtomicConsume-for-AtomicI32">AtomicI32</a></li><li><a href="#impl-AtomicConsume-for-AtomicI64">AtomicI64</a></li><li><a href="#impl-AtomicConsume-for-AtomicI8">AtomicI8</a></li><li><a href="#impl-AtomicConsume-for-AtomicIsize">AtomicIsize</a></li><li><a href="#impl-AtomicConsume-for-AtomicPtr%3CT%3E">AtomicPtr<T></a></li><li><a href="#impl-AtomicConsume-for-AtomicU16">AtomicU16</a></li><li><a href="#impl-AtomicConsume-for-AtomicU32">AtomicU32</a></li><li><a href="#impl-AtomicConsume-for-AtomicU64">AtomicU64</a></li><li><a href="#impl-AtomicConsume-for-AtomicU8">AtomicU8</a></li><li><a href="#impl-AtomicConsume-for-AtomicUsize">AtomicUsize</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In crossbeam_utils::atomic</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Trait <a href="../index.html">crossbeam_utils</a>::<wbr><a href="index.html">atomic</a>::<wbr><a class="trait" href="#">AtomicConsume</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/crossbeam_utils/atomic/consume.rs.html#7-27">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><div class="item-decl"><pre class="rust trait"><code>pub trait AtomicConsume { |
| type <a href="#associatedtype.Val" class="associatedtype">Val</a>; |
| |
| fn <a href="#tymethod.load_consume" class="fnname">load_consume</a>(&self) -> Self::<a class="associatedtype" href="trait.AtomicConsume.html#associatedtype.Val" title="type crossbeam_utils::atomic::AtomicConsume::Val">Val</a>; |
| }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait which allows reading from primitive atomic types with “consume” ordering.</p> |
| </div></details><h2 id="required-associated-types" class="small-section-header">Required Associated Types<a href="#required-associated-types" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle method-toggle" open><summary><section id="associatedtype.Val" class="method has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#9">source</a><h4 class="code-header">type <a href="#associatedtype.Val" class="associatedtype">Val</a></h4></section></summary><div class="docblock"><p>Type returned by <code>load_consume</code>.</p> |
| </div></details></div><h2 id="required-methods" class="small-section-header">Required Methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.load_consume" class="method has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#26">source</a><h4 class="code-header">fn <a href="#tymethod.load_consume" class="fnname">load_consume</a>(&self) -> Self::<a class="associatedtype" href="trait.AtomicConsume.html#associatedtype.Val" title="type crossbeam_utils::atomic::AtomicConsume::Val">Val</a></h4></section></summary><div class="docblock"><p>Loads a value from the atomic using a “consume” memory ordering.</p> |
| <p>This is similar to the “acquire” ordering, except that an ordering is |
| only guaranteed with operations that “depend on” the result of the load. |
| However consume loads are usually much faster than acquire loads on |
| architectures with a weak memory model since they don’t require memory |
| fence instructions.</p> |
| <p>The exact definition of “depend on” is a bit vague, but it works as you |
| would expect in practice since a lot of software, especially the Linux |
| kernel, rely on this behavior.</p> |
| <p>This is currently only implemented on ARM and AArch64, where a fence |
| can be avoided. On other architectures this will fall back to a simple |
| <code>load(Ordering::Acquire)</code>.</p> |
| </div></details></div><h2 id="foreign-impls" class="small-section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-AtomicConsume-for-AtomicBool" class="impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#68">source</a><a href="#impl-AtomicConsume-for-AtomicBool" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.AtomicConsume.html" title="trait crossbeam_utils::atomic::AtomicConsume">AtomicConsume</a> for AtomicBool</h3></section></summary><div class="impl-items"><section id="associatedtype.Val-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Val-1" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Val" class="associatedtype">Val</a> = bool</h4></section><section id="method.load_consume" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#68">source</a><a href="#method.load_consume" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.load_consume" class="fnname">load_consume</a>(&self) -> Self::<a class="associatedtype" href="trait.AtomicConsume.html#associatedtype.Val" title="type crossbeam_utils::atomic::AtomicConsume::Val">Val</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-AtomicConsume-for-AtomicUsize" class="impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#69">source</a><a href="#impl-AtomicConsume-for-AtomicUsize" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.AtomicConsume.html" title="trait crossbeam_utils::atomic::AtomicConsume">AtomicConsume</a> for AtomicUsize</h3></section></summary><div class="impl-items"><section id="associatedtype.Val-2" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Val-2" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Val" class="associatedtype">Val</a> = usize</h4></section><section id="method.load_consume-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#69">source</a><a href="#method.load_consume-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.load_consume" class="fnname">load_consume</a>(&self) -> Self::<a class="associatedtype" href="trait.AtomicConsume.html#associatedtype.Val" title="type crossbeam_utils::atomic::AtomicConsume::Val">Val</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-AtomicConsume-for-AtomicIsize" class="impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#70">source</a><a href="#impl-AtomicConsume-for-AtomicIsize" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.AtomicConsume.html" title="trait crossbeam_utils::atomic::AtomicConsume">AtomicConsume</a> for AtomicIsize</h3></section></summary><div class="impl-items"><section id="associatedtype.Val-3" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Val-3" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Val" class="associatedtype">Val</a> = isize</h4></section><section id="method.load_consume-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#70">source</a><a href="#method.load_consume-2" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.load_consume" class="fnname">load_consume</a>(&self) -> Self::<a class="associatedtype" href="trait.AtomicConsume.html#associatedtype.Val" title="type crossbeam_utils::atomic::AtomicConsume::Val">Val</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-AtomicConsume-for-AtomicU8" class="impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#71">source</a><a href="#impl-AtomicConsume-for-AtomicU8" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.AtomicConsume.html" title="trait crossbeam_utils::atomic::AtomicConsume">AtomicConsume</a> for AtomicU8</h3></section></summary><div class="impl-items"><section id="associatedtype.Val-4" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Val-4" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Val" class="associatedtype">Val</a> = u8</h4></section><section id="method.load_consume-3" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#71">source</a><a href="#method.load_consume-3" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.load_consume" class="fnname">load_consume</a>(&self) -> Self::<a class="associatedtype" href="trait.AtomicConsume.html#associatedtype.Val" title="type crossbeam_utils::atomic::AtomicConsume::Val">Val</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-AtomicConsume-for-AtomicI8" class="impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#72">source</a><a href="#impl-AtomicConsume-for-AtomicI8" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.AtomicConsume.html" title="trait crossbeam_utils::atomic::AtomicConsume">AtomicConsume</a> for AtomicI8</h3></section></summary><div class="impl-items"><section id="associatedtype.Val-5" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Val-5" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Val" class="associatedtype">Val</a> = i8</h4></section><section id="method.load_consume-4" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#72">source</a><a href="#method.load_consume-4" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.load_consume" class="fnname">load_consume</a>(&self) -> Self::<a class="associatedtype" href="trait.AtomicConsume.html#associatedtype.Val" title="type crossbeam_utils::atomic::AtomicConsume::Val">Val</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-AtomicConsume-for-AtomicU16" class="impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#73">source</a><a href="#impl-AtomicConsume-for-AtomicU16" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.AtomicConsume.html" title="trait crossbeam_utils::atomic::AtomicConsume">AtomicConsume</a> for AtomicU16</h3></section></summary><div class="impl-items"><section id="associatedtype.Val-6" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Val-6" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Val" class="associatedtype">Val</a> = u16</h4></section><section id="method.load_consume-5" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#73">source</a><a href="#method.load_consume-5" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.load_consume" class="fnname">load_consume</a>(&self) -> Self::<a class="associatedtype" href="trait.AtomicConsume.html#associatedtype.Val" title="type crossbeam_utils::atomic::AtomicConsume::Val">Val</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-AtomicConsume-for-AtomicI16" class="impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#74">source</a><a href="#impl-AtomicConsume-for-AtomicI16" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.AtomicConsume.html" title="trait crossbeam_utils::atomic::AtomicConsume">AtomicConsume</a> for AtomicI16</h3></section></summary><div class="impl-items"><section id="associatedtype.Val-7" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Val-7" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Val" class="associatedtype">Val</a> = i16</h4></section><section id="method.load_consume-6" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#74">source</a><a href="#method.load_consume-6" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.load_consume" class="fnname">load_consume</a>(&self) -> Self::<a class="associatedtype" href="trait.AtomicConsume.html#associatedtype.Val" title="type crossbeam_utils::atomic::AtomicConsume::Val">Val</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-AtomicConsume-for-AtomicU32" class="impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#75">source</a><a href="#impl-AtomicConsume-for-AtomicU32" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.AtomicConsume.html" title="trait crossbeam_utils::atomic::AtomicConsume">AtomicConsume</a> for AtomicU32</h3></section></summary><div class="impl-items"><section id="associatedtype.Val-8" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Val-8" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Val" class="associatedtype">Val</a> = u32</h4></section><section id="method.load_consume-7" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#75">source</a><a href="#method.load_consume-7" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.load_consume" class="fnname">load_consume</a>(&self) -> Self::<a class="associatedtype" href="trait.AtomicConsume.html#associatedtype.Val" title="type crossbeam_utils::atomic::AtomicConsume::Val">Val</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-AtomicConsume-for-AtomicI32" class="impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#76">source</a><a href="#impl-AtomicConsume-for-AtomicI32" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.AtomicConsume.html" title="trait crossbeam_utils::atomic::AtomicConsume">AtomicConsume</a> for AtomicI32</h3></section></summary><div class="impl-items"><section id="associatedtype.Val-9" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Val-9" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Val" class="associatedtype">Val</a> = i32</h4></section><section id="method.load_consume-8" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#76">source</a><a href="#method.load_consume-8" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.load_consume" class="fnname">load_consume</a>(&self) -> Self::<a class="associatedtype" href="trait.AtomicConsume.html#associatedtype.Val" title="type crossbeam_utils::atomic::AtomicConsume::Val">Val</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-AtomicConsume-for-AtomicU64" class="impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#78">source</a><a href="#impl-AtomicConsume-for-AtomicU64" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.AtomicConsume.html" title="trait crossbeam_utils::atomic::AtomicConsume">AtomicConsume</a> for AtomicU64</h3></section></summary><div class="impl-items"><section id="associatedtype.Val-10" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Val-10" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Val" class="associatedtype">Val</a> = u64</h4></section><section id="method.load_consume-9" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#78">source</a><a href="#method.load_consume-9" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.load_consume" class="fnname">load_consume</a>(&self) -> Self::<a class="associatedtype" href="trait.AtomicConsume.html#associatedtype.Val" title="type crossbeam_utils::atomic::AtomicConsume::Val">Val</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-AtomicConsume-for-AtomicI64" class="impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#80">source</a><a href="#impl-AtomicConsume-for-AtomicI64" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.AtomicConsume.html" title="trait crossbeam_utils::atomic::AtomicConsume">AtomicConsume</a> for AtomicI64</h3></section></summary><div class="impl-items"><section id="associatedtype.Val-11" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Val-11" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Val" class="associatedtype">Val</a> = i64</h4></section><section id="method.load_consume-10" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#80">source</a><a href="#method.load_consume-10" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.load_consume" class="fnname">load_consume</a>(&self) -> Self::<a class="associatedtype" href="trait.AtomicConsume.html#associatedtype.Val" title="type crossbeam_utils::atomic::AtomicConsume::Val">Val</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-AtomicConsume-for-AtomicPtr%3CT%3E" class="impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#83-86">source</a><a href="#impl-AtomicConsume-for-AtomicPtr%3CT%3E" class="anchor"></a><h3 class="code-header">impl<T> <a class="trait" href="trait.AtomicConsume.html" title="trait crossbeam_utils::atomic::AtomicConsume">AtomicConsume</a> for AtomicPtr<T></h3></section></summary><div class="impl-items"><section id="associatedtype.Val-12" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Val-12" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Val" class="associatedtype">Val</a> = *mut T</h4></section><section id="method.load_consume-11" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_utils/atomic/consume.rs.html#85">source</a><a href="#method.load_consume-11" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.load_consume" class="fnname">load_consume</a>(&self) -> Self::<a class="associatedtype" href="trait.AtomicConsume.html#associatedtype.Val" title="type crossbeam_utils::atomic::AtomicConsume::Val">Val</a></h4></section></div></details><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div id="implementors-list"></div><script src="../../implementors/crossbeam_utils/atomic/consume/trait.AtomicConsume.js" data-ignore-extern-crates="core" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-current-crate="crossbeam_utils" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html> |