rtic/1/api/spin/rwlock/struct.RwLock.html
2024-10-24 05:57:30 +00:00

191 lines
No EOL
59 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

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

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A lock that provides data access to either one writer or many readers."><title>RwLock in spin::rwlock - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-492a78a4a87dcc01.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="spin" data-themes="" data-resource-suffix="" data-rustdoc-version="1.82.0 (f6e511eec 2024-10-15)" data-channel="1.82.0" data-search-js="search-a99f1315e7cc5121.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-921df33f47b8780c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-3b12f09e550e0385.css"></noscript><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" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../spin/index.html">spin</a><span class="version">0.9.8</span></h2></div><h2 class="location"><a href="#">RwLock</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.as_mut_ptr">as_mut_ptr</a></li><li><a href="#method.force_read_decrement">force_read_decrement</a></li><li><a href="#method.force_write_unlock">force_write_unlock</a></li><li><a href="#method.get_mut">get_mut</a></li><li><a href="#method.into_inner">into_inner</a></li><li><a href="#method.new">new</a></li><li><a href="#method.read">read</a></li><li><a href="#method.reader_count">reader_count</a></li><li><a href="#method.try_read">try_read</a></li><li><a href="#method.try_upgradeable_read">try_upgradeable_read</a></li><li><a href="#method.try_write">try_write</a></li><li><a href="#method.upgradeable_read">upgradeable_read</a></li><li><a href="#method.write">write</a></li><li><a href="#method.writer_count">writer_count</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Debug-for-RwLock%3CT,+R%3E">Debug</a></li><li><a href="#impl-Default-for-RwLock%3CT,+R%3E">Default</a></li><li><a href="#impl-From%3CT%3E-for-RwLock%3CT,+R%3E">From&#60;T&#62;</a></li><li><a href="#impl-RawRwLock-for-RwLock%3C(),+R%3E">RawRwLock</a></li><li><a href="#impl-RawRwLockDowngrade-for-RwLock%3C(),+R%3E">RawRwLockDowngrade</a></li><li><a href="#impl-RawRwLockUpgrade-for-RwLock%3C(),+R%3E">RawRwLockUpgrade</a></li><li><a href="#impl-Send-for-RwLock%3CT,+R%3E">Send</a></li><li><a href="#impl-Sync-for-RwLock%3CT,+R%3E">Sync</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-RwLock%3CT,+R%3E">!Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-RwLock%3CT,+R%3E">!RefUnwindSafe</a></li><li><a href="#impl-Unpin-for-RwLock%3CT,+R%3E">Unpin</a></li><li><a href="#impl-UnwindSafe-for-RwLock%3CT,+R%3E">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow&#60;T&#62;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut&#60;T&#62;</a></li><li><a href="#impl-From%3C!%3E-for-T">From&#60;!&#62;</a></li><li><a href="#impl-From%3CT%3E-for-T">From&#60;T&#62;</a></li><li><a href="#impl-Into%3CU%3E-for-T">Into&#60;U&#62;</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom&#60;U&#62;</a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto&#60;U&#62;</a></li></ul></section><h2><a href="index.html">In spin::<wbr>rwlock</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Struct <a href="../index.html">spin</a>::<wbr><a href="index.html">rwlock</a>::<wbr><a class="struct" href="#">RwLock</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../../src/spin/rwlock.rs.html#69-73">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub struct RwLock&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, R = <a class="struct" href="../relax/struct.Spin.html" title="struct spin::relax::Spin">Spin</a>&gt; { <span class="comment">/* private fields */</span> }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A lock that provides data access to either one writer or many readers.</p>
<p>This lock behaves in a similar manner to its namesake <code>std::sync::RwLock</code> but uses
spinning for synchronisation instead. Unlike its namespace, this lock does not
track lock poisoning.</p>
<p>This type of lock allows a number of readers or at most one writer at any
point in time. The write portion of this lock typically allows modification
of the underlying data (exclusive access) and the read portion of this lock
typically allows for read-only access (shared access).</p>
<p>The type parameter <code>T</code> represents the data that this lock protects. It is
required that <code>T</code> satisfies <code>Send</code> to be shared across tasks and <code>Sync</code> to
allow concurrent access through readers. The RAII guards returned from the
locking methods implement <code>Deref</code> (and <code>DerefMut</code> for the <code>write</code> methods)
to allow access to the contained of the lock.</p>
<p>An <a href="struct.RwLockUpgradableGuard.html" title="struct spin::rwlock::RwLockUpgradableGuard"><code>RwLockUpgradableGuard</code></a> can be upgraded to a
writable guard through the <a href="struct.RwLockUpgradableGuard.html#method.upgrade" title="method spin::rwlock::RwLockUpgradableGuard::upgrade"><code>RwLockUpgradableGuard::upgrade</code></a>
<a href="struct.RwLockUpgradableGuard.html#method.try_upgrade" title="method spin::rwlock::RwLockUpgradableGuard::try_upgrade"><code>RwLockUpgradableGuard::try_upgrade</code></a> functions.
Writable or upgradeable guards can be downgraded through their respective <code>downgrade</code>
functions.</p>
<p>Based on Facebooks
<a href="https://github.com/facebook/folly/blob/a0394d84f2d5c3e50ebfd0566f9d3acb52cfab5a/folly/synchronization/RWSpinLock.h"><code>folly/RWSpinLock.h</code></a>.
This implementation is unfair to writers - if the lock always has readers, then no writers will
ever get a chance. Using an upgradeable lock guard can <em>somewhat</em> alleviate this issue as no
new readers are allowed when an upgradeable guard is held, but upgradeable guards can be taken
when there are existing readers. However if the lock is that highly contended and writes are
crucial then this implementation may be a poor choice.</p>
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>spin;
<span class="kw">let </span>lock = spin::RwLock::new(<span class="number">5</span>);
<span class="comment">// many reader locks can be held at once
</span>{
<span class="kw">let </span>r1 = lock.read();
<span class="kw">let </span>r2 = lock.read();
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>r1, <span class="number">5</span>);
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>r2, <span class="number">5</span>);
} <span class="comment">// read locks are dropped at this point
// only one write lock may be held, however
</span>{
<span class="kw">let </span><span class="kw-2">mut </span>w = lock.write();
<span class="kw-2">*</span>w += <span class="number">1</span>;
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>w, <span class="number">6</span>);
} <span class="comment">// write lock is dropped here</span></code></pre></div>
</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-RwLock%3CT,+R%3E" class="impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#123-184">source</a><a href="#impl-RwLock%3CT,+R%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, R&gt; <a class="struct" href="struct.RwLock.html" title="struct spin::rwlock::RwLock">RwLock</a>&lt;T, R&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../../src/spin/rwlock.rs.html#140-146">source</a><h4 class="code-header">pub const fn <a href="#method.new" class="fn">new</a>(data: T) -&gt; Self</h4></section></summary><div class="docblock"><p>Creates a new spinlock wrapping the supplied data.</p>
<p>May be used statically:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>spin;
<span class="kw">static </span>RW_LOCK: spin::RwLock&lt;()&gt; = spin::RwLock::new(());
<span class="kw">fn </span>demo() {
<span class="kw">let </span>lock = RW_LOCK.read();
<span class="comment">// do something with lock
</span>drop(lock);
}</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/spin/rwlock.rs.html#150-155">source</a><h4 class="code-header">pub fn <a href="#method.into_inner" class="fn">into_inner</a>(self) -&gt; T</h4></section></summary><div class="docblock"><p>Consumes this <code>RwLock</code>, returning the underlying data.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_mut_ptr" class="method"><a class="src rightside" href="../../src/spin/rwlock.rs.html#181-183">source</a><h4 class="code-header">pub fn <a href="#method.as_mut_ptr" class="fn">as_mut_ptr</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.82.0/core/primitive.pointer.html">*mut T</a></h4></section></summary><div class="docblock"><p>Returns a mutable pointer to the underying data.</p>
<p>This is mostly meant to be used for applications which require manual unlocking, but where
storing both the lock and the pointer to the inner data gets inefficient.</p>
<p>While this is safe, writing to the data is undefined behavior unless the current thread has
acquired a write lock, and reading requires either a read or write lock.</p>
<h5 id="example"><a class="doc-anchor" href="#example">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>lock = spin::RwLock::new(<span class="number">42</span>);
<span class="kw">unsafe </span>{
core::mem::forget(lock.write());
<span class="macro">assert_eq!</span>(lock.as_mut_ptr().read(), <span class="number">42</span>);
lock.as_mut_ptr().write(<span class="number">58</span>);
lock.force_write_unlock();
}
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>lock.read(), <span class="number">58</span>);
</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-RwLock%3CT,+R%3E-1" class="impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#186-257">source</a><a href="#impl-RwLock%3CT,+R%3E-1" class="anchor">§</a><h3 class="code-header">impl&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, R: <a class="trait" href="../relax/trait.RelaxStrategy.html" title="trait spin::relax::RelaxStrategy">RelaxStrategy</a>&gt; <a class="struct" href="struct.RwLock.html" title="struct spin::rwlock::RwLock">RwLock</a>&lt;T, R&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.read" class="method"><a class="src rightside" href="../../src/spin/rwlock.rs.html#209-216">source</a><h4 class="code-header">pub fn <a href="#method.read" class="fn">read</a>(&amp;self) -&gt; <a class="struct" href="struct.RwLockReadGuard.html" title="struct spin::rwlock::RwLockReadGuard">RwLockReadGuard</a>&lt;'_, T&gt;</h4></section></summary><div class="docblock"><p>Locks this rwlock with shared read access, blocking the current thread
until it can be acquired.</p>
<p>The calling thread will be blocked until there are no more writers which
hold the lock. There may be other readers currently inside the lock when
this method returns. This method does not provide any guarantees with
respect to the ordering of whether contentious readers or writers will
acquire the lock first.</p>
<p>Returns an RAII guard which will release this threads shared access
once it is dropped.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>mylock = spin::RwLock::new(<span class="number">0</span>);
{
<span class="kw">let </span><span class="kw-2">mut </span>data = mylock.read();
<span class="comment">// The lock is now locked and the data can be read
</span><span class="macro">println!</span>(<span class="string">"{}"</span>, <span class="kw-2">*</span>data);
<span class="comment">// The lock is dropped
</span>}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.write" class="method"><a class="src rightside" href="../../src/spin/rwlock.rs.html#237-244">source</a><h4 class="code-header">pub fn <a href="#method.write" class="fn">write</a>(&amp;self) -&gt; <a class="struct" href="struct.RwLockWriteGuard.html" title="struct spin::rwlock::RwLockWriteGuard">RwLockWriteGuard</a>&lt;'_, T, R&gt;</h4></section></summary><div class="docblock"><p>Lock this rwlock with exclusive write access, blocking the current
thread until it can be acquired.</p>
<p>This function will not return while other writers or other readers
currently have access to the lock.</p>
<p>Returns an RAII guard which will drop the write access of this rwlock
when dropped.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>mylock = spin::RwLock::new(<span class="number">0</span>);
{
<span class="kw">let </span><span class="kw-2">mut </span>data = mylock.write();
<span class="comment">// The lock is now locked and the data can be written
</span><span class="kw-2">*</span>data += <span class="number">1</span>;
<span class="comment">// The lock is dropped
</span>}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.upgradeable_read" class="method"><a class="src rightside" href="../../src/spin/rwlock.rs.html#249-256">source</a><h4 class="code-header">pub fn <a href="#method.upgradeable_read" class="fn">upgradeable_read</a>(&amp;self) -&gt; <a class="struct" href="struct.RwLockUpgradableGuard.html" title="struct spin::rwlock::RwLockUpgradableGuard">RwLockUpgradableGuard</a>&lt;'_, T, R&gt;</h4></section></summary><div class="docblock"><p>Obtain a readable lock guard that can later be upgraded to a writable lock guard.
Upgrades can be done through the <a href="struct.RwLockUpgradableGuard.html#method.upgrade" title="method spin::rwlock::RwLockUpgradableGuard::upgrade"><code>RwLockUpgradableGuard::upgrade</code></a> method.</p>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-RwLock%3CT,+R%3E-2" class="impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#259-445">source</a><a href="#impl-RwLock%3CT,+R%3E-2" class="anchor">§</a><h3 class="code-header">impl&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, R&gt; <a class="struct" href="struct.RwLock.html" title="struct spin::rwlock::RwLock">RwLock</a>&lt;T, R&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.try_read" class="method"><a class="src rightside" href="../../src/spin/rwlock.rs.html#298-313">source</a><h4 class="code-header">pub fn <a href="#method.try_read" class="fn">try_read</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.82.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.RwLockReadGuard.html" title="struct spin::rwlock::RwLockReadGuard">RwLockReadGuard</a>&lt;'_, T&gt;&gt;</h4></section></summary><div class="docblock"><p>Attempt to acquire this lock with shared read access.</p>
<p>This function will never block and will return immediately if <code>read</code>
would otherwise succeed. Returns <code>Some</code> of an RAII guard which will
release the shared access of this thread when dropped, or <code>None</code> if the
access could not be granted. This method does not provide any
guarantees with respect to the ordering of whether contentious readers
or writers will acquire the lock first.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>mylock = spin::RwLock::new(<span class="number">0</span>);
{
<span class="kw">match </span>mylock.try_read() {
<span class="prelude-val">Some</span>(data) =&gt; {
<span class="comment">// The lock is now locked and the data can be read
</span><span class="macro">println!</span>(<span class="string">"{}"</span>, <span class="kw-2">*</span>data);
<span class="comment">// The lock is dropped
</span>},
<span class="prelude-val">None </span>=&gt; (), <span class="comment">// no cigar
</span>};
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.reader_count" class="method"><a class="src rightside" href="../../src/spin/rwlock.rs.html#321-324">source</a><h4 class="code-header">pub fn <a href="#method.reader_count" class="fn">reader_count</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.82.0/core/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Return the number of readers that currently hold the lock (including upgradable readers).</p>
<h5 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h5>
<p>This function provides no synchronization guarantees and so its result should be considered out of date
the instant it is called. Do not use it for synchronization purposes. However, it may be useful as a heuristic.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.writer_count" class="method"><a class="src rightside" href="../../src/spin/rwlock.rs.html#334-336">source</a><h4 class="code-header">pub fn <a href="#method.writer_count" class="fn">writer_count</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.82.0/core/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Return the number of writers that currently hold the lock.</p>
<p>Because <a href="struct.RwLock.html" title="struct spin::rwlock::RwLock"><code>RwLock</code></a> guarantees exclusive mutable access, this function may only return either <code>0</code> or <code>1</code>.</p>
<h5 id="safety-1"><a class="doc-anchor" href="#safety-1">§</a>Safety</h5>
<p>This function provides no synchronization guarantees and so its result should be considered out of date
the instant it is called. Do not use it for synchronization purposes. However, it may be useful as a heuristic.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.force_read_decrement" class="method"><a class="src rightside" href="../../src/spin/rwlock.rs.html#347-350">source</a><h4 class="code-header">pub unsafe fn <a href="#method.force_read_decrement" class="fn">force_read_decrement</a>(&amp;self)</h4></section></summary><div class="docblock"><p>Force decrement the reader count.</p>
<h5 id="safety-2"><a class="doc-anchor" href="#safety-2">§</a>Safety</h5>
<p>This is <em>extremely</em> unsafe if there are outstanding <code>RwLockReadGuard</code>s
live, or if called more times than <code>read</code> has been called, but can be
useful in FFI contexts where the caller doesnt know how to deal with
RAII. The underlying atomic operation uses <code>Ordering::Release</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.force_write_unlock" class="method"><a class="src rightside" href="../../src/spin/rwlock.rs.html#361-364">source</a><h4 class="code-header">pub unsafe fn <a href="#method.force_write_unlock" class="fn">force_write_unlock</a>(&amp;self)</h4></section></summary><div class="docblock"><p>Force unlock exclusive write access.</p>
<h5 id="safety-3"><a class="doc-anchor" href="#safety-3">§</a>Safety</h5>
<p>This is <em>extremely</em> unsafe if there are outstanding <code>RwLockWriteGuard</code>s
live, or if called when there are current readers, but can be useful in
FFI contexts where the caller doesnt know how to deal with RAII. The
underlying atomic operation uses <code>Ordering::Release</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_write" class="method"><a class="src rightside" href="../../src/spin/rwlock.rs.html#408-410">source</a><h4 class="code-header">pub fn <a href="#method.try_write" class="fn">try_write</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.82.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.RwLockWriteGuard.html" title="struct spin::rwlock::RwLockWriteGuard">RwLockWriteGuard</a>&lt;'_, T, R&gt;&gt;</h4></section></summary><div class="docblock"><p>Attempt to lock this rwlock with exclusive write access.</p>
<p>This function does not ever block, and it will return <code>None</code> if a call
to <code>write</code> would otherwise block. If successful, an RAII guard is
returned.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>mylock = spin::RwLock::new(<span class="number">0</span>);
{
<span class="kw">match </span>mylock.try_write() {
<span class="prelude-val">Some</span>(<span class="kw-2">mut </span>data) =&gt; {
<span class="comment">// The lock is now locked and the data can be written
</span><span class="kw-2">*</span>data += <span class="number">1</span>;
<span class="comment">// The lock is implicitly dropped
</span>},
<span class="prelude-val">None </span>=&gt; (), <span class="comment">// no cigar
</span>};
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_upgradeable_read" class="method"><a class="src rightside" href="../../src/spin/rwlock.rs.html#414-426">source</a><h4 class="code-header">pub fn <a href="#method.try_upgradeable_read" class="fn">try_upgradeable_read</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.82.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.RwLockUpgradableGuard.html" title="struct spin::rwlock::RwLockUpgradableGuard">RwLockUpgradableGuard</a>&lt;'_, T, R&gt;&gt;</h4></section></summary><div class="docblock"><p>Tries to obtain an upgradeable lock guard.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_mut" class="method"><a class="src rightside" href="../../src/spin/rwlock.rs.html#440-444">source</a><h4 class="code-header">pub fn <a href="#method.get_mut" class="fn">get_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.82.0/core/primitive.reference.html">&amp;mut T</a></h4></section></summary><div class="docblock"><p>Returns a mutable reference to the underlying data.</p>
<p>Since this call borrows the <code>RwLock</code> mutably, no actual locking needs to
take place the mutable borrow statically guarantees no locks exist.</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">let </span><span class="kw-2">mut </span>lock = spin::RwLock::new(<span class="number">0</span>);
<span class="kw-2">*</span>lock.get_mut() = <span class="number">10</span>;
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>lock.read(), <span class="number">10</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-RwLock%3CT,+R%3E" class="impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#447-456">source</a><a href="#impl-Debug-for-RwLock%3CT,+R%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.RwLock.html" title="struct spin::rwlock::RwLock">RwLock</a>&lt;T, R&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#448-455">source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.82.0/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.82.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.82.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.82.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-RwLock%3CT,+R%3E" class="impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#458-462">source</a><a href="#impl-Default-for-RwLock%3CT,+R%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a>, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.RwLock.html" title="struct spin::rwlock::RwLock">RwLock</a>&lt;T, R&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#459-461">source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.82.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -&gt; Self</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.82.0/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CT%3E-for-RwLock%3CT,+R%3E" class="impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#464-468">source</a><a href="#impl-From%3CT%3E-for-RwLock%3CT,+R%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for <a class="struct" href="struct.RwLock.html" title="struct spin::rwlock::RwLock">RwLock</a>&lt;T, R&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#465-467">source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.82.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(data: T) -&gt; Self</h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-RawRwLock-for-RwLock%3C(),+R%3E" class="impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#803-853">source</a><a href="#impl-RawRwLock-for-RwLock%3C(),+R%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R: <a class="trait" href="../relax/trait.RelaxStrategy.html" title="trait spin::relax::RelaxStrategy">RelaxStrategy</a>&gt; <a class="trait" href="../../lock_api/rwlock/trait.RawRwLock.html" title="trait lock_api::rwlock::RawRwLock">RawRwLock</a> for <a class="struct" href="struct.RwLock.html" title="struct spin::rwlock::RwLock">RwLock</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.82.0/core/primitive.unit.html">()</a>, R&gt;</h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.GuardMarker" class="associatedtype trait-impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#804">source</a><a href="#associatedtype.GuardMarker" class="anchor">§</a><h4 class="code-header">type <a href="../../lock_api/rwlock/trait.RawRwLock.html#associatedtype.GuardMarker" class="associatedtype">GuardMarker</a> = <a class="struct" href="../../lock_api/struct.GuardSend.html" title="struct lock_api::GuardSend">GuardSend</a></h4></section></summary><div class='docblock'>Marker type which determines whether a lock guard should be <code>Send</code>. Use
one of the <code>GuardSend</code> or <code>GuardNoSend</code> helper types here.</div></details><details class="toggle" open><summary><section id="associatedconstant.INIT" class="associatedconstant trait-impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#806">source</a><a href="#associatedconstant.INIT" class="anchor">§</a><h4 class="code-header">const <a href="../../lock_api/rwlock/trait.RawRwLock.html#associatedconstant.INIT" class="constant">INIT</a>: Self = _</h4></section></summary><div class='docblock'>Initial value for an unlocked <code>RwLock</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.lock_exclusive" class="method trait-impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#809-812">source</a><a href="#method.lock_exclusive" class="anchor">§</a><h4 class="code-header">fn <a href="../../lock_api/rwlock/trait.RawRwLock.html#tymethod.lock_exclusive" class="fn">lock_exclusive</a>(&amp;self)</h4></section></summary><div class='docblock'>Acquires an exclusive lock, blocking the current thread until it is able to do so.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_lock_exclusive" class="method trait-impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#815-818">source</a><a href="#method.try_lock_exclusive" class="anchor">§</a><h4 class="code-header">fn <a href="../../lock_api/rwlock/trait.RawRwLock.html#tymethod.try_lock_exclusive" class="fn">try_lock_exclusive</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.82.0/core/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Attempts to acquire an exclusive lock without blocking.</div></details><details class="toggle method-toggle" open><summary><section id="method.unlock_exclusive" class="method trait-impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#821-827">source</a><a href="#method.unlock_exclusive" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="../../lock_api/rwlock/trait.RawRwLock.html#tymethod.unlock_exclusive" class="fn">unlock_exclusive</a>(&amp;self)</h4></section></summary><div class='docblock'>Releases an exclusive lock. <a href="../../lock_api/rwlock/trait.RawRwLock.html#tymethod.unlock_exclusive">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lock_shared" class="method trait-impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#830-833">source</a><a href="#method.lock_shared" class="anchor">§</a><h4 class="code-header">fn <a href="../../lock_api/rwlock/trait.RawRwLock.html#tymethod.lock_shared" class="fn">lock_shared</a>(&amp;self)</h4></section></summary><div class='docblock'>Acquires a shared lock, blocking the current thread until it is able to do so.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_lock_shared" class="method trait-impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#836-839">source</a><a href="#method.try_lock_shared" class="anchor">§</a><h4 class="code-header">fn <a href="../../lock_api/rwlock/trait.RawRwLock.html#tymethod.try_lock_shared" class="fn">try_lock_shared</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.82.0/core/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Attempts to acquire a shared lock without blocking.</div></details><details class="toggle method-toggle" open><summary><section id="method.unlock_shared" class="method trait-impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#842-847">source</a><a href="#method.unlock_shared" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="../../lock_api/rwlock/trait.RawRwLock.html#tymethod.unlock_shared" class="fn">unlock_shared</a>(&amp;self)</h4></section></summary><div class='docblock'>Releases a shared lock. <a href="../../lock_api/rwlock/trait.RawRwLock.html#tymethod.unlock_shared">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.is_locked" class="method trait-impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#850-852">source</a><a href="#method.is_locked" class="anchor">§</a><h4 class="code-header">fn <a href="../../lock_api/rwlock/trait.RawRwLock.html#method.is_locked" class="fn">is_locked</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.82.0/core/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Checks if this <code>RwLock</code> is currently locked in any way.</div></details><details class="toggle method-toggle" open><summary><section id="method.is_locked_exclusive" class="method trait-impl"><a class="src rightside" href="../../src/lock_api/rwlock.rs.html#89">source</a><a href="#method.is_locked_exclusive" class="anchor">§</a><h4 class="code-header">fn <a href="../../lock_api/rwlock/trait.RawRwLock.html#method.is_locked_exclusive" class="fn">is_locked_exclusive</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.82.0/core/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Check if this <code>RwLock</code> is currently exclusively locked.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-RawRwLockDowngrade-for-RwLock%3C(),+R%3E" class="impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#905-914">source</a><a href="#impl-RawRwLockDowngrade-for-RwLock%3C(),+R%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R: <a class="trait" href="../relax/trait.RelaxStrategy.html" title="trait spin::relax::RelaxStrategy">RelaxStrategy</a>&gt; <a class="trait" href="../../lock_api/rwlock/trait.RawRwLockDowngrade.html" title="trait lock_api::rwlock::RawRwLockDowngrade">RawRwLockDowngrade</a> for <a class="struct" href="struct.RwLock.html" title="struct spin::rwlock::RwLock">RwLock</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.82.0/core/primitive.unit.html">()</a>, R&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.downgrade" class="method trait-impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#906-913">source</a><a href="#method.downgrade" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="../../lock_api/rwlock/trait.RawRwLockDowngrade.html#tymethod.downgrade" class="fn">downgrade</a>(&amp;self)</h4></section></summary><div class='docblock'>Atomically downgrades an exclusive lock into a shared lock without
allowing any thread to take an exclusive lock in the meantime. <a href="../../lock_api/rwlock/trait.RawRwLockDowngrade.html#tymethod.downgrade">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-RawRwLockUpgrade-for-RwLock%3C(),+R%3E" class="impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#856-902">source</a><a href="#impl-RawRwLockUpgrade-for-RwLock%3C(),+R%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R: <a class="trait" href="../relax/trait.RelaxStrategy.html" title="trait spin::relax::RelaxStrategy">RelaxStrategy</a>&gt; <a class="trait" href="../../lock_api/rwlock/trait.RawRwLockUpgrade.html" title="trait lock_api::rwlock::RawRwLockUpgrade">RawRwLockUpgrade</a> for <a class="struct" href="struct.RwLock.html" title="struct spin::rwlock::RwLock">RwLock</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.82.0/core/primitive.unit.html">()</a>, R&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.lock_upgradable" class="method trait-impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#858-861">source</a><a href="#method.lock_upgradable" class="anchor">§</a><h4 class="code-header">fn <a href="../../lock_api/rwlock/trait.RawRwLockUpgrade.html#tymethod.lock_upgradable" class="fn">lock_upgradable</a>(&amp;self)</h4></section></summary><div class='docblock'>Acquires an upgradable lock, blocking the current thread until it is able to do so.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_lock_upgradable" class="method trait-impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#864-869">source</a><a href="#method.try_lock_upgradable" class="anchor">§</a><h4 class="code-header">fn <a href="../../lock_api/rwlock/trait.RawRwLockUpgrade.html#tymethod.try_lock_upgradable" class="fn">try_lock_upgradable</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.82.0/core/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Attempts to acquire an upgradable lock without blocking.</div></details><details class="toggle method-toggle" open><summary><section id="method.unlock_upgradable" class="method trait-impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#872-878">source</a><a href="#method.unlock_upgradable" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="../../lock_api/rwlock/trait.RawRwLockUpgrade.html#tymethod.unlock_upgradable" class="fn">unlock_upgradable</a>(&amp;self)</h4></section></summary><div class='docblock'>Releases an upgradable lock. <a href="../../lock_api/rwlock/trait.RawRwLockUpgrade.html#tymethod.unlock_upgradable">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.upgrade" class="method trait-impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#881-888">source</a><a href="#method.upgrade" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="../../lock_api/rwlock/trait.RawRwLockUpgrade.html#tymethod.upgrade" class="fn">upgrade</a>(&amp;self)</h4></section></summary><div class='docblock'>Upgrades an upgradable lock to an exclusive lock. <a href="../../lock_api/rwlock/trait.RawRwLockUpgrade.html#tymethod.upgrade">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.try_upgrade" class="method trait-impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#891-901">source</a><a href="#method.try_upgrade" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="../../lock_api/rwlock/trait.RawRwLockUpgrade.html#tymethod.try_upgrade" class="fn">try_upgrade</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.82.0/core/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Attempts to upgrade an upgradable lock to an exclusive lock without
blocking. <a href="../../lock_api/rwlock/trait.RawRwLockUpgrade.html#tymethod.try_upgrade">Read more</a></div></details></div></details><section id="impl-Send-for-RwLock%3CT,+R%3E" class="impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#111">source</a><a href="#impl-Send-for-RwLock%3CT,+R%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.RwLock.html" title="struct spin::rwlock::RwLock">RwLock</a>&lt;T, R&gt;</h3></section><section id="impl-Sync-for-RwLock%3CT,+R%3E" class="impl"><a class="src rightside" href="../../src/spin/rwlock.rs.html#112">source</a><a href="#impl-Sync-for-RwLock%3CT,+R%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T: ?<a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.RwLock.html" title="struct spin::rwlock::RwLock">RwLock</a>&lt;T, R&gt;</h3></section></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-RwLock%3CT,+R%3E" class="impl"><a href="#impl-Freeze-for-RwLock%3CT,+R%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, R = <a class="struct" href="../relax/struct.Spin.html" title="struct spin::relax::Spin">Spin</a>&gt; !<a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.RwLock.html" title="struct spin::rwlock::RwLock">RwLock</a>&lt;T, R&gt;</h3></section><section id="impl-RefUnwindSafe-for-RwLock%3CT,+R%3E" class="impl"><a href="#impl-RefUnwindSafe-for-RwLock%3CT,+R%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, R = <a class="struct" href="../relax/struct.Spin.html" title="struct spin::relax::Spin">Spin</a>&gt; !<a class="trait" href="https://doc.rust-lang.org/1.82.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.RwLock.html" title="struct spin::rwlock::RwLock">RwLock</a>&lt;T, R&gt;</h3></section><section id="impl-Unpin-for-RwLock%3CT,+R%3E" class="impl"><a href="#impl-Unpin-for-RwLock%3CT,+R%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.RwLock.html" title="struct spin::rwlock::RwLock">RwLock</a>&lt;T, R&gt;<div class="where">where
R: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,
T: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section><section id="impl-UnwindSafe-for-RwLock%3CT,+R%3E" class="impl"><a href="#impl-UnwindSafe-for-RwLock%3CT,+R%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, R&gt; <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.RwLock.html" title="struct spin::rwlock::RwLock">RwLock</a>&lt;T, R&gt;<div class="where">where
R: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a>,
T: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</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.82.0/src/core/any.rs.html#138">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.82.0/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.82.0/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.82.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.82.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.82.0/src/core/borrow.rs.html#209">source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.82.0/src/core/borrow.rs.html#211">source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.82.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.82.0/core/primitive.reference.html">&amp;T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.82.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.82.0/src/core/borrow.rs.html#217">source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.82.0/src/core/borrow.rs.html#218">source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.82.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.82.0/core/primitive.reference.html">&amp;mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.82.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3C!%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.82.0/src/core/convert/mod.rs.html#782">source</a><a href="#impl-From%3C!%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.82.0/core/primitive.never.html">!</a>&gt; for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-2" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.82.0/src/core/convert/mod.rs.html#783">source</a><a href="#method.from-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.82.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: <a class="primitive" href="https://doc.rust-lang.org/1.82.0/core/primitive.never.html">!</a>) -&gt; T</h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.82.0/src/core/convert/mod.rs.html#765">source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-1" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.82.0/src/core/convert/mod.rs.html#768">source</a><a href="#method.from-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.82.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.82.0/src/core/convert/mod.rs.html#748-750">source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.82.0/src/core/convert/mod.rs.html#758">source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.82.0/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code><a href="https://doc.rust-lang.org/1.82.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.82.0/src/core/convert/mod.rs.html#805-807">source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.82.0/src/core/convert/mod.rs.html#809">source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.82.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.82.0/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.82.0/src/core/convert/mod.rs.html#812">source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.82.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.82.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.82.0/src/core/convert/mod.rs.html#790-792">source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.82.0/src/core/convert/mod.rs.html#794">source</a><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.82.0/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.82.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.82.0/src/core/convert/mod.rs.html#797">source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.82.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.82.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>