edlang/sharded_slab/trait.Config.html
2024-07-26 09:42:18 +00:00

29 lines
10 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="Configuration parameters which can be overridden to tune the behavior of a slab."><title>Config in sharded_slab - 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-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="sharded_slab" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0 (051478957 2024-07-21)" data-channel="1.80.0" data-search-js="search-d52510db62a78183.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-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.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 trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../sharded_slab/index.html">sharded_slab</a><span class="version">0.1.7</span></h2></div><h2 class="location"><a href="#">Config</a></h2><div class="sidebar-elems"><section><h3><a href="#provided-associated-consts">Provided Associated Constants</a></h3><ul class="block"><li><a href="#associatedconstant.INITIAL_PAGE_SIZE">INITIAL_PAGE_SIZE</a></li><li><a href="#associatedconstant.MAX_PAGES">MAX_PAGES</a></li><li><a href="#associatedconstant.MAX_THREADS">MAX_THREADS</a></li><li><a href="#associatedconstant.RESERVED_BITS">RESERVED_BITS</a></li></ul><h3><a href="#object-safety">Object Safety</a></h3><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In crate sharded_slab</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>Trait <a href="index.html">sharded_slab</a>::<wbr><a class="trait" href="#">Config</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/sharded_slab/cfg.rs.html#8-40">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub trait Config: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
const <a href="#associatedconstant.MAX_THREADS" class="constant">MAX_THREADS</a>: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a> = 4_096usize;
const <a href="#associatedconstant.MAX_PAGES" class="constant">MAX_PAGES</a>: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a> = 32usize;
const <a href="#associatedconstant.INITIAL_PAGE_SIZE" class="constant">INITIAL_PAGE_SIZE</a>: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a> = 32usize;
const <a href="#associatedconstant.RESERVED_BITS" class="constant">RESERVED_BITS</a>: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a> = 0usize;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Configuration parameters which can be overridden to tune the behavior of a slab.</p>
</div></details><h2 id="provided-associated-consts" class="section-header">Provided Associated Constants<a href="#provided-associated-consts" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedconstant.MAX_THREADS" class="method"><a class="src rightside" href="../src/sharded_slab/cfg.rs.html#15">source</a><h4 class="code-header">const <a href="#associatedconstant.MAX_THREADS" class="constant">MAX_THREADS</a>: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a> = 4_096usize</h4></section></summary><div class="docblock"><p>The maximum number of threads which can access the slab.</p>
<p>This value (rounded to a power of two) determines the number of shards
in the slab. If a thread is created, accesses the slab, and then terminates,
its shard may be reused and thus does not count against the maximum
number of threads once the thread has terminated.</p>
</div></details><details class="toggle" open><summary><section id="associatedconstant.MAX_PAGES" class="method"><a class="src rightside" href="../src/sharded_slab/cfg.rs.html#20">source</a><h4 class="code-header">const <a href="#associatedconstant.MAX_PAGES" class="constant">MAX_PAGES</a>: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a> = 32usize</h4></section></summary><div class="docblock"><p>The maximum number of pages in each shard in the slab.</p>
<p>This value, in combination with <code>INITIAL_PAGE_SIZE</code>, determines how many
bits of each index are used to represent page addresses.</p>
</div></details><details class="toggle" open><summary><section id="associatedconstant.INITIAL_PAGE_SIZE" class="method"><a class="src rightside" href="../src/sharded_slab/cfg.rs.html#30">source</a><h4 class="code-header">const <a href="#associatedconstant.INITIAL_PAGE_SIZE" class="constant">INITIAL_PAGE_SIZE</a>: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a> = 32usize</h4></section></summary><div class="docblock"><p>The size of the first page in each shard.</p>
<p>When a page in a shard has been filled with values, a new page
will be allocated that is twice as large as the previous page. Thus, the
second page will be twice this size, and the third will be four times
this size, and so on.</p>
<p>Note that page sizes must be powers of two. If this value is not a power
of two, it will be rounded to the next power of two.</p>
</div></details><details class="toggle" open><summary><section id="associatedconstant.RESERVED_BITS" class="method"><a class="src rightside" href="../src/sharded_slab/cfg.rs.html#39">source</a><h4 class="code-header">const <a href="#associatedconstant.RESERVED_BITS" class="constant">RESERVED_BITS</a>: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a> = 0usize</h4></section></summary><div class="docblock"><p>Sets a number of high-order bits in each index which are reserved from
user code.</p>
<p>Note that these bits are taken from the generation counter; if the page
address and thread IDs are configured to use a large number of bits,
reserving additional bits will decrease the period of the generation
counter. These should thus be used relatively sparingly, to ensure that
generation counters are able to effectively prevent the ABA problem.</p>
</div></details></div><h2 id="object-safety" class="section-header">Object Safety<a href="#object-safety" class="anchor">§</a></h2><div class="object-safety-info">This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.80.0/reference/items/traits.html#object-safety">object safe</a>.</div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-Config-for-DefaultConfig" class="impl"><a class="src rightside" href="../src/sharded_slab/cfg.rs.html#136-146">source</a><a href="#impl-Config-for-DefaultConfig" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Config.html" title="trait sharded_slab::Config">Config</a> for <a class="struct" href="struct.DefaultConfig.html" title="struct sharded_slab::DefaultConfig">DefaultConfig</a></h3></section></summary><div class="impl-items"><section id="associatedconstant.INITIAL_PAGE_SIZE-1" class="associatedconstant trait-impl"><a class="src rightside" href="../src/sharded_slab/cfg.rs.html#137">source</a><a href="#associatedconstant.INITIAL_PAGE_SIZE-1" class="anchor">§</a><h4 class="code-header">const <a href="#associatedconstant.INITIAL_PAGE_SIZE" class="constant">INITIAL_PAGE_SIZE</a>: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a> = 32usize</h4></section><section id="associatedconstant.MAX_THREADS-1" class="associatedconstant trait-impl"><a class="src rightside" href="../src/sharded_slab/cfg.rs.html#140">source</a><a href="#associatedconstant.MAX_THREADS-1" class="anchor">§</a><h4 class="code-header">const <a href="#associatedconstant.MAX_THREADS" class="constant">MAX_THREADS</a>: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a> = 4_096usize</h4></section><section id="associatedconstant.MAX_PAGES-1" class="associatedconstant trait-impl"><a class="src rightside" href="../src/sharded_slab/cfg.rs.html#145">source</a><a href="#associatedconstant.MAX_PAGES-1" class="anchor">§</a><h4 class="code-header">const <a href="#associatedconstant.MAX_PAGES" class="constant">MAX_PAGES</a>: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a> = 32usize</h4></section></div></details></div><script src="../trait.impl/sharded_slab/cfg/trait.Config.js" async></script></section></div></main></body></html>