mirror of
https://github.com/NotAShelf/mpvrc.git
synced 2026-04-17 00:13:48 +00:00
29 lines
No EOL
10 KiB
HTML
29 lines
No EOL
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-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.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-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.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.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.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_<wbr>slab</a><span class="version">0.1.7</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Config</a></h2><h3><a href="#provided-associated-consts">Provided Associated Constants</a></h3><ul class="block"><li><a href="#associatedconstant.INITIAL_PAGE_SIZE" title="INITIAL_PAGE_SIZE">INITIAL_PAGE_SIZE</a></li><li><a href="#associatedconstant.MAX_PAGES" title="MAX_PAGES">MAX_PAGES</a></li><li><a href="#associatedconstant.MAX_THREADS" title="MAX_THREADS">MAX_THREADS</a></li><li><a href="#associatedconstant.RESERVED_BITS" title="RESERVED_BITS">RESERVED_BITS</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate sharded_<wbr>slab</a></h2></div></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"><span class="rustdoc-breadcrumbs"><a href="index.html">sharded_slab</a></span><h1>Trait <span class="trait">Config</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/sharded_slab/cfg.rs.html#8-40">Source</a> </span></div><pre class="rust item-decl"><code>pub trait Config: <a class="trait" href="https://doc.rust-lang.org/1.84.1/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.84.1/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.84.1/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.84.1/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.84.1/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.84.1/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.84.1/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.84.1/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.84.1/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="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.84.1/reference/items/traits.html#object-safety">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></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.84.1/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.84.1/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.84.1/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> |