struct.CachePadded.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta name="generator" content="rustdoc">
  7. <meta name="description" content="API documentation for the Rust `CachePadded` struct in crate `crossbeam`.">
  8. <meta name="keywords" content="rust, rustlang, rust-lang, CachePadded">
  9. <title>crossbeam::CachePadded - Rust</title>
  10. <link rel="stylesheet" type="text/css" href="../normalize.css">
  11. <link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle">
  12. <link rel="stylesheet" type="text/css" href="../dark.css">
  13. <link rel="stylesheet" type="text/css" href="../main.css" id="themeStyle">
  14. <script src="../storage.js"></script>
  15. </head>
  16. <body class="rustdoc struct">
  17. <!--[if lte IE 8]>
  18. <div class="warning">
  19. This old browser is unsupported and will most likely display funky
  20. things.
  21. </div>
  22. <![endif]-->
  23. <nav class="sidebar">
  24. <div class="sidebar-menu">&#9776;</div>
  25. <p class='location'>Struct CachePadded</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.zeroed">zeroed</a><a href="#method.new">new</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Deref">Deref</a><a href="#impl-DerefMut">DerefMut</a></div></div><p class='location'><a href='index.html'>crossbeam</a></p><script>window.sidebarCurrent = {name: 'CachePadded', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div>
  26. </nav>
  27. <div class="theme-picker">
  28. <button id="theme-picker" aria-label="Pick another theme!">
  29. <img src="../brush.svg" width="18" alt="Pick another theme!">
  30. </button>
  31. <div id="theme-choices"></div>
  32. </div>
  33. <script src="../theme.js"></script>
  34. <nav class="sub">
  35. <form class="search-form js-only">
  36. <div class="search-container">
  37. <input class="search-input" name="search"
  38. autocomplete="off"
  39. placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
  40. type="search">
  41. </div>
  42. </form>
  43. </nav>
  44. <section id='main' class="content">
  45. <h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>crossbeam</a>::<wbr><a class="struct" href=''>CachePadded</a></span><span class='out-of-band'><span id='render-detail'>
  46. <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
  47. [<span class='inner'>&#x2212;</span>]
  48. </a>
  49. </span><a class='srclink' href='../src/crossbeam/cache_padded.rs.html#28-31' title='goto source code'>[src]</a></span></h1>
  50. <pre class='rust struct'>pub struct CachePadded&lt;T&gt; { /* fields omitted */ }</pre><div class='docblock'><p>Pad <code>T</code> to the length of a cacheline.</p>
  51. <p>Sometimes concurrent programming requires a piece of data to be padded out
  52. to the size of a cacheline to avoid &quot;false sharing&quot;: cachelines being
  53. invalidated due to unrelated concurrent activity. Use the <code>CachePadded</code> type
  54. when you want to <em>avoid</em> cache locality.</p>
  55. <p>At the moment, cache lines are assumed to be 32 * sizeof(usize) on all
  56. architectures.</p>
  57. <p><strong>Warning</strong>: the wrapped data is never dropped; move out using <code>ptr::read</code>
  58. if you need to run dtors.</p>
  59. </div>
  60. <h2 id='methods' class='small-section-header'>
  61. Methods<a href='#methods' class='anchor'></a>
  62. </h2>
  63. <h3 id='impl' class='impl'><span class='in-band'><code>impl&lt;T:&nbsp;<a class="trait" href="../crossbeam/trait.ZerosValid.html" title="trait crossbeam::ZerosValid">ZerosValid</a>&gt; <a class="struct" href="../crossbeam/struct.CachePadded.html" title="struct crossbeam::CachePadded">CachePadded</a>&lt;T&gt;</code><a href='#impl' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/crossbeam/cache_padded.rs.html#76-94' title='goto source code'>[src]</a></span></h3>
  64. <div class='impl-items'><h4 id='method.zeroed' class="method"><span id='zeroed.v' class='invisible'><code>pub fn <a href='#method.zeroed' class='fnname'>zeroed</a>() -&gt; <a class="struct" href="../crossbeam/struct.CachePadded.html" title="struct crossbeam::CachePadded">CachePadded</a>&lt;T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/crossbeam/cache_padded.rs.html#79-84' title='goto source code'>[src]</a></span></h4>
  65. <div class='docblock'><p>A const fn equivalent to mem::zeroed().</p>
  66. </div></div><h3 id='impl-1' class='impl'><span class='in-band'><code>impl&lt;T&gt; <a class="struct" href="../crossbeam/struct.CachePadded.html" title="struct crossbeam::CachePadded">CachePadded</a>&lt;T&gt;</code><a href='#impl-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/crossbeam/cache_padded.rs.html#103-120' title='goto source code'>[src]</a></span></h3>
  67. <div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>pub fn <a href='#method.new' class='fnname'>new</a>(t: T) -&gt; <a class="struct" href="../crossbeam/struct.CachePadded.html" title="struct crossbeam::CachePadded">CachePadded</a>&lt;T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/crossbeam/cache_padded.rs.html#108-119' title='goto source code'>[src]</a></span></h4>
  68. <div class='docblock'><p>Wrap <code>t</code> with cacheline padding.</p>
  69. <p><strong>Warning</strong>: the wrapped data is never dropped; move out using
  70. <code>ptr:read</code> if you need to run dtors.</p>
  71. </div></div>
  72. <h2 id='implementations' class='small-section-header'>
  73. Trait Implementations<a href='#implementations' class='anchor'></a>
  74. </h2>
  75. <h3 id='impl-Debug' class='impl'><span class='in-band'><code>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../crossbeam/struct.CachePadded.html" title="struct crossbeam::CachePadded">CachePadded</a>&lt;T&gt;</code><a href='#impl-Debug' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/crossbeam/cache_padded.rs.html#33-37' title='goto source code'>[src]</a></span></h3>
  76. <div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/crossbeam/cache_padded.rs.html#34-36' title='goto source code'>[src]</a></span></h4>
  77. <div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
  78. </div></div><h3 id='impl-Send' class='impl'><span class='in-band'><code>impl&lt;T:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../crossbeam/struct.CachePadded.html" title="struct crossbeam::CachePadded">CachePadded</a>&lt;T&gt;</code><a href='#impl-Send' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/crossbeam/cache_padded.rs.html#39' title='goto source code'>[src]</a></span></h3>
  79. <div class='impl-items'></div><h3 id='impl-Sync' class='impl'><span class='in-band'><code>impl&lt;T:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../crossbeam/struct.CachePadded.html" title="struct crossbeam::CachePadded">CachePadded</a>&lt;T&gt;</code><a href='#impl-Sync' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/crossbeam/cache_padded.rs.html#40' title='goto source code'>[src]</a></span></h3>
  80. <div class='impl-items'></div><h3 id='impl-Deref' class='impl'><span class='in-band'><code>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a> for <a class="struct" href="../crossbeam/struct.CachePadded.html" title="struct crossbeam::CachePadded">CachePadded</a>&lt;T&gt;</code><a href='#impl-Deref' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/crossbeam/cache_padded.rs.html#122-128' title='goto source code'>[src]</a></span></h3>
  81. <div class='impl-items'><h4 id='associatedtype.Target' class="type"><span id='Target.t' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target' class="type">Target</a> = T</code></span></h4>
  82. <div class='docblock'><p>The resulting type after dereferencing.</p>
  83. </div><h4 id='method.deref' class="method"><span id='deref.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#tymethod.deref' class='fnname'>deref</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/crossbeam/cache_padded.rs.html#124-127' title='goto source code'>[src]</a></span></h4>
  84. <div class='docblock'><p>Dereferences the value.</p>
  85. </div></div><h3 id='impl-DerefMut' class='impl'><span class='in-band'><code>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a> for <a class="struct" href="../crossbeam/struct.CachePadded.html" title="struct crossbeam::CachePadded">CachePadded</a>&lt;T&gt;</code><a href='#impl-DerefMut' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/crossbeam/cache_padded.rs.html#130-135' title='goto source code'>[src]</a></span></h3>
  86. <div class='impl-items'><h4 id='method.deref_mut' class="method"><span id='deref_mut.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/deref/trait.DerefMut.html#tymethod.deref_mut' class='fnname'>deref_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/crossbeam/cache_padded.rs.html#131-134' title='goto source code'>[src]</a></span></h4>
  87. <div class='docblock'><p>Mutably dereferences the value.</p>
  88. </div></div></section>
  89. <section id='search' class="content hidden"></section>
  90. <section class="footer"></section>
  91. <aside id="help" class="hidden">
  92. <div>
  93. <h1 class="hidden">Help</h1>
  94. <div class="shortcuts">
  95. <h2>Keyboard Shortcuts</h2>
  96. <dl>
  97. <dt><kbd>?</kbd></dt>
  98. <dd>Show this help dialog</dd>
  99. <dt><kbd>S</kbd></dt>
  100. <dd>Focus the search field</dd>
  101. <dt><kbd>↑</kbd></dt>
  102. <dd>Move up in search results</dd>
  103. <dt><kbd>↓</kbd></dt>
  104. <dd>Move down in search results</dd>
  105. <dt><kbd>↹</kbd></dt>
  106. <dd>Switch tab</dd>
  107. <dt><kbd>&#9166;</kbd></dt>
  108. <dd>Go to active search result</dd>
  109. <dt><kbd>+</kbd></dt>
  110. <dd>Expand all sections</dd>
  111. <dt><kbd>-</kbd></dt>
  112. <dd>Collapse all sections</dd>
  113. </dl>
  114. </div>
  115. <div class="infos">
  116. <h2>Search Tricks</h2>
  117. <p>
  118. Prefix searches with a type followed by a colon (e.g.
  119. <code>fn:</code>) to restrict the search to a given type.
  120. </p>
  121. <p>
  122. Accepted types are: <code>fn</code>, <code>mod</code>,
  123. <code>struct</code>, <code>enum</code>,
  124. <code>trait</code>, <code>type</code>, <code>macro</code>,
  125. and <code>const</code>.
  126. </p>
  127. <p>
  128. Search functions by type signature (e.g.
  129. <code>vec -> usize</code> or <code>* -> vec</code>)
  130. </p>
  131. </div>
  132. </div>
  133. </aside>
  134. <script>
  135. window.rootPath = "../";
  136. window.currentCrate = "crossbeam";
  137. </script>
  138. <script src="../main.js"></script>
  139. <script defer src="../search-index.js"></script>
  140. </body>
  141. </html>