Rust-for-Arduboy/docs/doc/atomic_polyfill/struct.AtomicU8.html

167 lines
No EOL
32 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="An integer type which can be safely shared between threads."><title>AtomicU8 in atomic_polyfill - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-fa3bb1812debf86c.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="atomic_polyfill" data-themes="" data-resource-suffix="" data-rustdoc-version="1.75.0-nightly (2bbb61989 2023-10-04)" data-channel="nightly" data-search-js="search-8be46b629f5f14a8.js" data-settings-js="settings-74424d7eec62a23e.js" ><script src="../static.files/storage-fec3eaa3851e447d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-c5bd66d33317d69f.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-5d8b3c7633ad77ba.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="logo-container" href="../atomic_polyfill/index.html"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a></nav><nav class="sidebar"><a class="logo-container" href="../atomic_polyfill/index.html"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2 class="location"><a href="#">AtomicU8</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block"><li><a href="#method.as_ptr">as_ptr</a></li><li><a href="#method.from_mut">from_mut</a></li><li><a href="#method.from_mut_slice">from_mut_slice</a></li><li><a href="#method.from_ptr">from_ptr</a></li><li><a href="#method.get_mut">get_mut</a></li><li><a href="#method.get_mut_slice">get_mut_slice</a></li><li><a href="#method.into_inner">into_inner</a></li><li><a href="#method.load">load</a></li><li><a href="#method.new">new</a></li><li><a href="#method.store">store</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block"><li><a href="#impl-Debug-for-AtomicU8">Debug</a></li><li><a href="#impl-Default-for-AtomicU8">Default</a></li><li><a href="#impl-From%3Cu8%3E-for-AtomicU8">From&lt;u8&gt;</a></li><li><a href="#impl-RefUnwindSafe-for-AtomicU8">RefUnwindSafe</a></li><li><a href="#impl-Sync-for-AtomicU8">Sync</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block"><li><a href="#impl-Send-for-AtomicU8">Send</a></li><li><a href="#impl-Unpin-for-AtomicU8">Unpin</a></li><li><a href="#impl-UnwindSafe-for-AtomicU8">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block"><li><a href="#impl-Any-for-AtomicU8">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-AtomicU8">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-AtomicU8">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-From%3CT%3E-for-AtomicU8">From&lt;T&gt;</a></li><li><a href="#impl-Into%3CU%3E-for-AtomicU8">Into&lt;U&gt;</a></li><li><a href="#impl-TryFrom%3CU%3E-for-AtomicU8">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-AtomicU8">TryInto&lt;U&gt;</a></li></ul></section><h2><a href="index.html">In atomic_polyfill</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Struct <a href="index.html">atomic_polyfill</a>::<wbr><a class="struct" href="#">AtomicU8</a><button id="copy-path" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><span class="since" title="Stable since Rust version 1.34.0">1.34.0</span> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code><div class="code-attribute">#[repr(C, align(1))]</div>pub struct AtomicU8 { /* private fields */ }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An integer type which can be safely shared between threads.</p>
<p>This type has the same in-memory representation as the underlying
integer type, [<code>u8</code>]. For more about the differences between atomic types and
non-atomic types as well as information about the portability of
this type, please see the <a href="crate::sync::atomic">module-level documentation</a>.</p>
<p><strong>Note:</strong> This type is only available on platforms that support
atomic loads and stores of [<code>u8</code>].</p>
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-AtomicU8" class="impl"><a href="#impl-AtomicU8" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.AtomicU8.html" title="struct atomic_polyfill::AtomicU8">AtomicU8</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><span class="since rightside" title="const since 1.34.0">const: 1.34.0</span><h4 class="code-header">pub const fn <a href="#method.new" class="fn">new</a>(v: u8) -&gt; <a class="struct" href="struct.AtomicU8.html" title="struct atomic_polyfill::AtomicU8">AtomicU8</a></h4></section></summary><div class="docblock"><p>Creates a new atomic integer.</p>
<h5 id="examples"><a href="#examples">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::atomic::AtomicU8;
<span class="kw">let </span>atomic_forty_two = AtomicU8::new(<span class="number">42</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_ptr" class="method"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/108652" title="Tracking issue for atomic_from_ptr">unstable</a></span><h4 class="code-header">pub unsafe fn <a href="#method.from_ptr" class="fn">from_ptr</a>&lt;'a&gt;(ptr: *mut u8) -&gt; &amp;'a <a class="struct" href="struct.AtomicU8.html" title="struct atomic_polyfill::AtomicU8">AtomicU8</a></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>atomic_from_ptr</code>)</span></div></span></summary><div class="docblock"><p>Creates a new reference to an atomic integer from a pointer.</p>
<h5 id="examples-1"><a href="#examples-1">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(atomic_from_ptr, pointer_is_aligned)]
</span><span class="kw">use </span>std::sync::atomic::{<span class="self">self</span>, AtomicU8};
<span class="kw">use </span>std::mem::align_of;
<span class="comment">// Get a pointer to an allocated value
</span><span class="kw">let </span>ptr: <span class="kw-2">*mut </span>u8 = Box::into_raw(Box::new(<span class="number">0</span>));
<span class="macro">assert!</span>(ptr.is_aligned_to(align_of::&lt;AtomicU8&gt;()));
{
<span class="comment">// Create an atomic view of the allocated value
</span><span class="kw">let </span>atomic = <span class="kw">unsafe </span>{AtomicU8::from_ptr(ptr) };
<span class="comment">// Use `atomic` for atomic operations, possibly share it with other threads
</span>atomic.store(<span class="number">1</span>, atomic::Ordering::Relaxed);
}
<span class="comment">// It&#39;s ok to non-atomically access the value behind `ptr`,
// since the reference to the atomic ended its lifetime in the block above
</span><span class="macro">assert_eq!</span>(<span class="kw">unsafe </span>{ <span class="kw-2">*</span>ptr }, <span class="number">1</span>);
<span class="comment">// Deallocate the value
</span><span class="kw">unsafe </span>{ drop(Box::from_raw(ptr)) }</code></pre></div>
<h5 id="safety"><a href="#safety">Safety</a></h5>
<ul>
<li><code>ptr</code> must be aligned to <code>align_of::&lt;AtomicBool&gt;()</code> (note that on some platforms this can be bigger than <code>align_of::&lt;bool&gt;()</code>).</li>
<li><code>ptr</code> must be aligned to <code>align_of::&lt;AtomicU8&gt;()</code> (note that on some platforms this can be bigger than <code>align_of::&lt;u8&gt;()</code>).</li>
<li><code>ptr</code> must be <a href="crate::ptr#safety">valid</a> for both reads and writes for the whole lifetime <code>'a</code>.</li>
<li>The value behind <code>ptr</code> must not be accessed through non-atomic operations for the whole lifetime <code>'a</code>.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_mut" class="method"><h4 class="code-header">pub fn <a href="#method.get_mut" class="fn">get_mut</a>(&amp;mut self) -&gt; &amp;mut u8</h4></section></summary><div class="docblock"><p>Returns a mutable reference to the underlying integer.</p>
<p>This is safe because the mutable reference guarantees that no other threads are
concurrently accessing the atomic data.</p>
<h5 id="examples-2"><a href="#examples-2">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::atomic::{AtomicU8, Ordering};
<span class="kw">let </span><span class="kw-2">mut </span>some_var = AtomicU8::new(<span class="number">10</span>);
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>some_var.get_mut(), <span class="number">10</span>);
<span class="kw-2">*</span>some_var.get_mut() = <span class="number">5</span>;
<span class="macro">assert_eq!</span>(some_var.load(Ordering::SeqCst), <span class="number">5</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_mut" class="method"><h4 class="code-header">pub fn <a href="#method.from_mut" class="fn">from_mut</a>(v: &amp;mut u8) -&gt; &amp;mut <a class="struct" href="struct.AtomicU8.html" title="struct atomic_polyfill::AtomicU8">AtomicU8</a></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>atomic_from_mut</code>)</span></div></span></summary><div class="docblock"><p>Get atomic access to a <code>&amp;mut u8</code>.</p>
<h5 id="examples-3"><a href="#examples-3">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(atomic_from_mut)]
</span><span class="kw">use </span>std::sync::atomic::{AtomicU8, Ordering};
<span class="kw">let </span><span class="kw-2">mut </span>some_int = <span class="number">123</span>;
<span class="kw">let </span>a = AtomicU8::from_mut(<span class="kw-2">&amp;mut </span>some_int);
a.store(<span class="number">100</span>, Ordering::Relaxed);
<span class="macro">assert_eq!</span>(some_int, <span class="number">100</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_mut_slice" class="method"><h4 class="code-header">pub fn <a href="#method.get_mut_slice" class="fn">get_mut_slice</a>(this: &amp;mut [<a class="struct" href="struct.AtomicU8.html" title="struct atomic_polyfill::AtomicU8">AtomicU8</a>]) -&gt; &amp;mut [u8]</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>atomic_from_mut</code>)</span></div></span></summary><div class="docblock"><p>Get non-atomic access to a <code>&amp;mut [AtomicU8]</code> slice</p>
<p>This is safe because the mutable reference guarantees that no other threads are
concurrently accessing the atomic data.</p>
<h5 id="examples-4"><a href="#examples-4">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(atomic_from_mut, inline_const)]
</span><span class="kw">use </span>std::sync::atomic::{AtomicU8, Ordering};
<span class="kw">let </span><span class="kw-2">mut </span>some_ints = [<span class="kw">const </span>{ AtomicU8::new(<span class="number">0</span>) }; <span class="number">10</span>];
<span class="kw">let </span>view: <span class="kw-2">&amp;mut </span>[u8] = AtomicU8::get_mut_slice(<span class="kw-2">&amp;mut </span>some_ints);
<span class="macro">assert_eq!</span>(view, [<span class="number">0</span>; <span class="number">10</span>]);
view
.iter_mut()
.enumerate()
.for_each(|(idx, int)| <span class="kw-2">*</span>int = idx <span class="kw">as _</span>);
std::thread::scope(|s| {
some_ints
.iter()
.enumerate()
.for_each(|(idx, int)| {
s.spawn(<span class="kw">move </span>|| <span class="macro">assert_eq!</span>(int.load(Ordering::Relaxed), idx <span class="kw">as _</span>));
})
});</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_mut_slice" class="method"><h4 class="code-header">pub fn <a href="#method.from_mut_slice" class="fn">from_mut_slice</a>(v: &amp;mut [u8]) -&gt; &amp;mut [<a class="struct" href="struct.AtomicU8.html" title="struct atomic_polyfill::AtomicU8">AtomicU8</a>]</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>atomic_from_mut</code>)</span></div></span></summary><div class="docblock"><p>Get atomic access to a <code>&amp;mut [u8]</code> slice.</p>
<h5 id="examples-5"><a href="#examples-5">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(atomic_from_mut)]
</span><span class="kw">use </span>std::sync::atomic::{AtomicU8, Ordering};
<span class="kw">let </span><span class="kw-2">mut </span>some_ints = [<span class="number">0</span>; <span class="number">10</span>];
<span class="kw">let </span>a = <span class="kw-2">&amp;*</span>AtomicU8::from_mut_slice(<span class="kw-2">&amp;mut </span>some_ints);
std::thread::scope(|s| {
<span class="kw">for </span>i <span class="kw">in </span><span class="number">0</span>..a.len() {
s.spawn(<span class="kw">move </span>|| a[i].store(i <span class="kw">as _</span>, Ordering::Relaxed));
}
});
<span class="kw">for </span>(i, n) <span class="kw">in </span>some_ints.into_iter().enumerate() {
<span class="macro">assert_eq!</span>(i, n <span class="kw">as </span>usize);
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_inner" class="method"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/78729" title="Tracking issue for const_cell_into_inner">unstable</a></span><h4 class="code-header">pub fn <a href="#method.into_inner" class="fn">into_inner</a>(self) -&gt; u8</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-6"><a href="#examples-6">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::atomic::AtomicU8;
<span class="kw">let </span>some_var = AtomicU8::new(<span class="number">5</span>);
<span class="macro">assert_eq!</span>(some_var.into_inner(), <span class="number">5</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.load" class="method"><h4 class="code-header">pub fn <a href="#method.load" class="fn">load</a>(&amp;self, order: <a class="enum" href="enum.Ordering.html" title="enum atomic_polyfill::Ordering">Ordering</a>) -&gt; u8</h4></section></summary><div class="docblock"><p>Loads a value from the atomic integer.</p>
<p><code>load</code> takes an <a href="enum.Ordering.html" title="enum atomic_polyfill::Ordering"><code>Ordering</code></a> argument which describes the memory ordering of this operation.
Possible values are <a href="enum.Ordering.html#variant.SeqCst" title="variant atomic_polyfill::Ordering::SeqCst"><code>SeqCst</code></a>, <a href="enum.Ordering.html#variant.Acquire" title="variant atomic_polyfill::Ordering::Acquire"><code>Acquire</code></a> and <a href="enum.Ordering.html#variant.Relaxed" title="variant atomic_polyfill::Ordering::Relaxed"><code>Relaxed</code></a>.</p>
<h5 id="panics"><a href="#panics">Panics</a></h5>
<p>Panics if <code>order</code> is <a href="enum.Ordering.html#variant.Release" title="variant atomic_polyfill::Ordering::Release"><code>Release</code></a> or <a href="enum.Ordering.html#variant.AcqRel" title="variant atomic_polyfill::Ordering::AcqRel"><code>AcqRel</code></a>.</p>
<h5 id="examples-7"><a href="#examples-7">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::atomic::{AtomicU8, Ordering};
<span class="kw">let </span>some_var = AtomicU8::new(<span class="number">5</span>);
<span class="macro">assert_eq!</span>(some_var.load(Ordering::Relaxed), <span class="number">5</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.store" class="method"><h4 class="code-header">pub fn <a href="#method.store" class="fn">store</a>(&amp;self, val: u8, order: <a class="enum" href="enum.Ordering.html" title="enum atomic_polyfill::Ordering">Ordering</a>)</h4></section></summary><div class="docblock"><p>Stores a value into the atomic integer.</p>
<p><code>store</code> takes an <a href="enum.Ordering.html" title="enum atomic_polyfill::Ordering"><code>Ordering</code></a> argument which describes the memory ordering of this operation.
Possible values are <a href="enum.Ordering.html#variant.SeqCst" title="variant atomic_polyfill::Ordering::SeqCst"><code>SeqCst</code></a>, <a href="enum.Ordering.html#variant.Release" title="variant atomic_polyfill::Ordering::Release"><code>Release</code></a> and <a href="enum.Ordering.html#variant.Relaxed" title="variant atomic_polyfill::Ordering::Relaxed"><code>Relaxed</code></a>.</p>
<h5 id="panics-1"><a href="#panics-1">Panics</a></h5>
<p>Panics if <code>order</code> is <a href="enum.Ordering.html#variant.Acquire" title="variant atomic_polyfill::Ordering::Acquire"><code>Acquire</code></a> or <a href="enum.Ordering.html#variant.AcqRel" title="variant atomic_polyfill::Ordering::AcqRel"><code>AcqRel</code></a>.</p>
<h5 id="examples-8"><a href="#examples-8">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::atomic::{AtomicU8, Ordering};
<span class="kw">let </span>some_var = AtomicU8::new(<span class="number">5</span>);
some_var.store(<span class="number">10</span>, Ordering::Relaxed);
<span class="macro">assert_eq!</span>(some_var.load(Ordering::Relaxed), <span class="number">10</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_ptr" class="method"><span class="since rightside" title="Stable since Rust version 1.70.0, const since 1.70.0">1.70.0 (const: 1.70.0)</span><h4 class="code-header">pub const fn <a href="#method.as_ptr" class="fn">as_ptr</a>(&amp;self) -&gt; *mut u8</h4></section></summary><div class="docblock"><p>Returns a mutable pointer to the underlying integer.</p>
<p>Doing non-atomic reads and writes on the resulting integer can be a data race.
This method is mostly useful for FFI, where the function signature may use
<code>*mut u8</code> instead of <code>&amp;AtomicU8</code>.</p>
<p>Returning an <code>*mut</code> pointer from a shared reference to this atomic is safe because the
atomic types work with interior mutability. All modifications of an atomic change the value
through a shared reference, and can do so safely as long as they use atomic operations. Any
use of the returned raw pointer requires an <code>unsafe</code> block and still has to uphold the same
restriction: operations on it must be atomic.</p>
<h5 id="examples-9"><a href="#examples-9">Examples</a></h5>
<div class="example-wrap ignore"><a href="#" class="tooltip" title="This example is not tested"></a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::atomic::AtomicU8;
<span class="kw">extern </span><span class="string">&quot;C&quot; </span>{
<span class="kw">fn </span>my_atomic_op(arg: <span class="kw-2">*mut </span>u8);
}
<span class="kw">let </span>atomic = AtomicU8::new(<span class="number">1</span>);
<span class="comment">// SAFETY: Safe as long as `my_atomic_op` is atomic.
</span><span class="kw">unsafe </span>{
my_atomic_op(atomic.as_ptr());
}</code></pre></div>
</div></details></div></details></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-AtomicU8" class="impl"><a href="#impl-Debug-for-AtomicU8" class="anchor">§</a><h3 class="code-header">impl Debug for <a class="struct" href="struct.AtomicU8.html" title="struct atomic_polyfill::AtomicU8">AtomicU8</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a class="fn">fmt</a>(&amp;self, f: &amp;mut Formatter&lt;'_&gt;) -&gt; Result&lt;(), Error&gt;</h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-AtomicU8" class="impl"><a href="#impl-Default-for-AtomicU8" class="anchor">§</a><h3 class="code-header">impl Default for <a class="struct" href="struct.AtomicU8.html" title="struct atomic_polyfill::AtomicU8">AtomicU8</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a class="fn">default</a>() -&gt; <a class="struct" href="struct.AtomicU8.html" title="struct atomic_polyfill::AtomicU8">AtomicU8</a></h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3Cu8%3E-for-AtomicU8" class="impl"><a href="#impl-From%3Cu8%3E-for-AtomicU8" class="anchor">§</a><h3 class="code-header">impl From&lt;u8&gt; for <a class="struct" href="struct.AtomicU8.html" title="struct atomic_polyfill::AtomicU8">AtomicU8</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a class="fn">from</a>(v: u8) -&gt; <a class="struct" href="struct.AtomicU8.html" title="struct atomic_polyfill::AtomicU8">AtomicU8</a></h4></section></summary><div class="docblock"><p>Converts an <code>u8</code> into an <code>AtomicU8</code>.</p>
</div></details></div></details><section id="impl-RefUnwindSafe-for-AtomicU8" class="impl"><a href="#impl-RefUnwindSafe-for-AtomicU8" class="anchor">§</a><h3 class="code-header">impl RefUnwindSafe for <a class="struct" href="struct.AtomicU8.html" title="struct atomic_polyfill::AtomicU8">AtomicU8</a></h3></section><section id="impl-Sync-for-AtomicU8" class="impl"><a href="#impl-Sync-for-AtomicU8" class="anchor">§</a><h3 class="code-header">impl Sync for <a class="struct" href="struct.AtomicU8.html" title="struct atomic_polyfill::AtomicU8">AtomicU8</a></h3></section></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Send-for-AtomicU8" class="impl"><a href="#impl-Send-for-AtomicU8" class="anchor">§</a><h3 class="code-header">impl Send for <a class="struct" href="struct.AtomicU8.html" title="struct atomic_polyfill::AtomicU8">AtomicU8</a></h3></section><section id="impl-Unpin-for-AtomicU8" class="impl"><a href="#impl-Unpin-for-AtomicU8" class="anchor">§</a><h3 class="code-header">impl Unpin for <a class="struct" href="struct.AtomicU8.html" title="struct atomic_polyfill::AtomicU8">AtomicU8</a></h3></section><section id="impl-UnwindSafe-for-AtomicU8" class="impl"><a href="#impl-UnwindSafe-for-AtomicU8" class="anchor">§</a><h3 class="code-header">impl UnwindSafe for <a class="struct" href="struct.AtomicU8.html" title="struct atomic_polyfill::AtomicU8">AtomicU8</a></h3></section></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-AtomicU8" class="impl"><a href="#impl-Any-for-AtomicU8" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; Any for T<span class="where fmt-newline">where
T: 'static + ?Sized,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a class="fn">type_id</a>(&amp;self) -&gt; TypeId</h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-AtomicU8" class="impl"><a href="#impl-Borrow%3CT%3E-for-AtomicU8" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; Borrow&lt;T&gt; for T<span class="where fmt-newline">where
T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a class="fn">borrow</a>(&amp;self) -&gt; &amp;T</h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-AtomicU8" class="impl"><a href="#impl-BorrowMut%3CT%3E-for-AtomicU8" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; BorrowMut&lt;T&gt; for T<span class="where fmt-newline">where
T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a class="fn">borrow_mut</a>(&amp;mut self) -&gt; &amp;mut T</h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-AtomicU8" class="impl"><a href="#impl-From%3CT%3E-for-AtomicU8" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; From&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-1" class="method trait-impl"><a href="#method.from-1" class="anchor">§</a><h4 class="code-header">fn <a class="fn">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-AtomicU8" class="impl"><a href="#impl-Into%3CU%3E-for-AtomicU8" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; Into&lt;U&gt; for T<span class="where fmt-newline">where
U: From&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a class="fn">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code>[From]&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-AtomicU8" class="impl"><a href="#impl-TryFrom%3CU%3E-for-AtomicU8" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; TryFrom&lt;U&gt; for T<span class="where fmt-newline">where
U: Into&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Error</a> = Infallible</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a class="fn">try_from</a>(value: U) -&gt; Result&lt;T, &lt;T as TryFrom&lt;U&gt;&gt;::Error&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-AtomicU8" class="impl"><a href="#impl-TryInto%3CU%3E-for-AtomicU8" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; TryInto&lt;U&gt; for T<span class="where fmt-newline">where
U: TryFrom&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Error</a> = &lt;U as TryFrom&lt;T&gt;&gt;::Error</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a class="fn">try_into</a>(self) -&gt; Result&lt;U, &lt;U as TryFrom&lt;T&gt;&gt;::Error&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>