136 lines
No EOL
8 KiB
HTML
136 lines
No EOL
8 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<meta name="generator" content="rustdoc">
|
||
<meta name="description" content="API documentation for the Rust `CachePadded` struct in crate `crossbeam`.">
|
||
<meta name="keywords" content="rust, rustlang, rust-lang, CachePadded">
|
||
|
||
<title>crossbeam::mem::CachePadded - Rust</title>
|
||
|
||
<link rel="stylesheet" type="text/css" href="../../rustdoc.css">
|
||
<link rel="stylesheet" type="text/css" href="../../main.css">
|
||
|
||
|
||
|
||
|
||
</head>
|
||
<body class="rustdoc">
|
||
<!--[if lte IE 8]>
|
||
<div class="warning">
|
||
This old browser is unsupported and will most likely display funky
|
||
things.
|
||
</div>
|
||
<![endif]-->
|
||
|
||
|
||
|
||
<nav class="sidebar">
|
||
|
||
<p class='location'><a href='../index.html'>crossbeam</a>::<wbr><a href='index.html'>mem</a></p><script>window.sidebarCurrent = {name: 'CachePadded', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
|
||
</nav>
|
||
|
||
<nav class="sub">
|
||
<form class="search-form js-only">
|
||
<div class="search-container">
|
||
<input class="search-input" name="search"
|
||
autocomplete="off"
|
||
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
|
||
type="search">
|
||
</div>
|
||
</form>
|
||
</nav>
|
||
|
||
<section id='main' class="content struct">
|
||
<h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>crossbeam</a>::<wbr><a href='index.html'>mem</a>::<wbr><a class='struct' href=''>CachePadded</a></span><span class='out-of-band'><span id='render-detail'>
|
||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
|
||
[<span class='inner'>−</span>]
|
||
</a>
|
||
</span><a id='src-414' class='srclink' href='../../src/crossbeam/mem/cache_padded.rs.html#26-29' title='goto source code'>[src]</a></span></h1>
|
||
<pre class='rust struct'>pub struct CachePadded<T> {
|
||
// some fields omitted
|
||
}</pre><div class='docblock'><p>Pad <code>T</code> to the length of a cacheline.</p>
|
||
|
||
<p>Sometimes concurrent programming requires a piece of data to be padded out
|
||
to the size of a cacheline to avoid "false sharing": cachelines being
|
||
invalidated due to unrelated concurrent activity. Use the <code>CachePadded</code> type
|
||
when you want to <em>avoid</em> cache locality.</p>
|
||
|
||
<p>At the moment, cache lines are assumed to be 32 * sizeof(usize) on all
|
||
architectures.</p>
|
||
|
||
<p><strong>Warning</strong>: the wrapped data is never dropped; move out using <code>ptr::read</code>
|
||
if you need to run dtors.</p>
|
||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><code>impl<T: <a class='trait' href='../../crossbeam/mem/trait.ZerosValid.html' title='crossbeam::mem::ZerosValid'>ZerosValid</a>> <a class='struct' href='../../crossbeam/mem/struct.CachePadded.html' title='crossbeam::mem::CachePadded'>CachePadded</a><T></code></h3><div class='impl-items'><h4 id='method.zeroed' class='method'><code>fn <a href='#method.zeroed' class='fnname'>zeroed</a>() -> <a class='struct' href='../../crossbeam/mem/struct.CachePadded.html' title='crossbeam::mem::CachePadded'>CachePadded</a><T></code></h4>
|
||
<div class='docblock'><p>A const fn equivalent to mem::zeroed().</p>
|
||
</div></div><h3 class='impl'><code>impl<T> <a class='struct' href='../../crossbeam/mem/struct.CachePadded.html' title='crossbeam::mem::CachePadded'>CachePadded</a><T></code></h3><div class='impl-items'><h4 id='method.new' class='method'><code>fn <a href='#method.new' class='fnname'>new</a>(t: T) -> <a class='struct' href='../../crossbeam/mem/struct.CachePadded.html' title='crossbeam::mem::CachePadded'>CachePadded</a><T></code></h4>
|
||
<div class='docblock'><p>Wrap <code>t</code> with cacheline padding.</p>
|
||
|
||
<p><strong>Warning</strong>: the wrapped data is never dropped; move out using
|
||
<code>ptr:read</code> if you need to run dtors.</p>
|
||
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><code>impl<T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/marker/trait.Send.html' title='core::marker::Send'>Send</a>> <a class='trait' href='https://doc.rust-lang.org/nightly/core/marker/trait.Send.html' title='core::marker::Send'>Send</a> for <a class='struct' href='../../crossbeam/mem/struct.CachePadded.html' title='crossbeam::mem::CachePadded'>CachePadded</a><T></code></h3><div class='impl-items'></div><h3 class='impl'><code>impl<T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html' title='core::marker::Sync'>Sync</a>> <a class='trait' href='https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html' title='core::marker::Sync'>Sync</a> for <a class='struct' href='../../crossbeam/mem/struct.CachePadded.html' title='crossbeam::mem::CachePadded'>CachePadded</a><T></code></h3><div class='impl-items'></div><h3 class='impl'><code>impl<T> <a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.Deref.html' title='core::ops::Deref'>Deref</a> for <a class='struct' href='../../crossbeam/mem/struct.CachePadded.html' title='crossbeam::mem::CachePadded'>CachePadded</a><T></code></h3><div class='impl-items'><h4 id='associatedtype.Target' class='type'><code>type <a href='https://doc.rust-lang.org/nightly/core/ops/trait.Deref.html#associatedtype.Target' class='type'>Target</a> = T</code></h4>
|
||
<h4 id='method.deref' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/trait.Deref.html#tymethod.deref' class='fnname'>deref</a>(&self) -> &T</code></h4>
|
||
</div><h3 class='impl'><code>impl<T> <a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.DerefMut.html' title='core::ops::DerefMut'>DerefMut</a> for <a class='struct' href='../../crossbeam/mem/struct.CachePadded.html' title='crossbeam::mem::CachePadded'>CachePadded</a><T></code></h3><div class='impl-items'><h4 id='method.deref_mut' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/trait.DerefMut.html#tymethod.deref_mut' class='fnname'>deref_mut</a>(&mut self) -> &mut T</code></h4>
|
||
</div></section>
|
||
<section id='search' class="content hidden"></section>
|
||
|
||
<section class="footer"></section>
|
||
|
||
<aside id="help" class="hidden">
|
||
<div>
|
||
<h1 class="hidden">Help</h1>
|
||
|
||
<div class="shortcuts">
|
||
<h2>Keyboard Shortcuts</h2>
|
||
|
||
<dl>
|
||
<dt>?</dt>
|
||
<dd>Show this help dialog</dd>
|
||
<dt>S</dt>
|
||
<dd>Focus the search field</dd>
|
||
<dt>⇤</dt>
|
||
<dd>Move up in search results</dd>
|
||
<dt>⇥</dt>
|
||
<dd>Move down in search results</dd>
|
||
<dt>⏎</dt>
|
||
<dd>Go to active search result</dd>
|
||
</dl>
|
||
</div>
|
||
|
||
<div class="infos">
|
||
<h2>Search Tricks</h2>
|
||
|
||
<p>
|
||
Prefix searches with a type followed by a colon (e.g.
|
||
<code>fn:</code>) to restrict the search to a given type.
|
||
</p>
|
||
|
||
<p>
|
||
Accepted types are: <code>fn</code>, <code>mod</code>,
|
||
<code>struct</code>, <code>enum</code>,
|
||
<code>trait</code>, <code>type</code>, <code>macro</code>,
|
||
and <code>const</code>.
|
||
</p>
|
||
|
||
<p>
|
||
Search functions by type signature (e.g.
|
||
<code>vec -> usize</code> or <code>* -> vec</code>)
|
||
</p>
|
||
</div>
|
||
</div>
|
||
</aside>
|
||
|
||
|
||
|
||
<script>
|
||
window.rootPath = "../../";
|
||
window.currentCrate = "crossbeam";
|
||
window.playgroundUrl = "";
|
||
</script>
|
||
<script src="../../jquery.js"></script>
|
||
<script src="../../main.js"></script>
|
||
|
||
<script defer src="../../search-index.js"></script>
|
||
</body>
|
||
</html> |