mirror of
https://github.com/NotAShelf/mpvrc.git
synced 2026-04-17 08:19:51 +00:00
deploy: de38ae62916547ad097c066f94a32e9ba7790eeb
This commit is contained in:
commit
9a86359447
28502 changed files with 1261284 additions and 0 deletions
1
thread_local/all.html
Normal file
1
thread_local/all.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<!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="List of all items in this crate"><title>List of all items in this crate</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="thread_local" 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="../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 mod sys"><!--[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="../thread_local/index.html">thread_<wbr>local</a><span class="version">1.1.8</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h3><a href="#structs">Crate Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><h1>List of all items</h1><h3 id="structs">Structs</h3><ul class="all-items"><li><a href="struct.CachedIntoIter.html">CachedIntoIter</a></li><li><a href="struct.CachedIterMut.html">CachedIterMut</a></li><li><a href="struct.CachedThreadLocal.html">CachedThreadLocal</a></li><li><a href="struct.IntoIter.html">IntoIter</a></li><li><a href="struct.Iter.html">Iter</a></li><li><a href="struct.IterMut.html">IterMut</a></li><li><a href="struct.ThreadLocal.html">ThreadLocal</a></li></ul></section></div></main></body></html>
|
||||
11
thread_local/cached/struct.CachedIntoIter.html
Normal file
11
thread_local/cached/struct.CachedIntoIter.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../thread_local/struct.CachedIntoIter.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../thread_local/struct.CachedIntoIter.html">../../thread_local/struct.CachedIntoIter.html</a>...</p>
|
||||
<script>location.replace("../../thread_local/struct.CachedIntoIter.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
thread_local/cached/struct.CachedIterMut.html
Normal file
11
thread_local/cached/struct.CachedIterMut.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../thread_local/struct.CachedIterMut.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../thread_local/struct.CachedIterMut.html">../../thread_local/struct.CachedIterMut.html</a>...</p>
|
||||
<script>location.replace("../../thread_local/struct.CachedIterMut.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
thread_local/cached/struct.CachedThreadLocal.html
Normal file
11
thread_local/cached/struct.CachedThreadLocal.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../thread_local/struct.CachedThreadLocal.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../thread_local/struct.CachedThreadLocal.html">../../thread_local/struct.CachedThreadLocal.html</a>...</p>
|
||||
<script>location.replace("../../thread_local/struct.CachedThreadLocal.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
47
thread_local/index.html
Normal file
47
thread_local/index.html
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<!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="Per-object thread-local storage"><title>thread_local - 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="thread_local" 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="../crates.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 mod crate"><!--[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="../thread_local/index.html">thread_<wbr>local</a><span class="version">1.1.8</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#structs">Crate Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"></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"><h1>Crate <span>thread_local</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/thread_local/lib.rs.html#8-683">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Per-object thread-local storage</p>
|
||||
<p>This library provides the <code>ThreadLocal</code> type which allows a separate copy of
|
||||
an object to be used for each thread. This allows for per-object
|
||||
thread-local storage, unlike the standard library’s <code>thread_local!</code> macro
|
||||
which only allows static thread-local storage.</p>
|
||||
<p>Per-thread objects are not destroyed when a thread exits. Instead, objects
|
||||
are only destroyed when the <code>ThreadLocal</code> containing them is destroyed.</p>
|
||||
<p>You can also iterate over the thread-local values of all thread in a
|
||||
<code>ThreadLocal</code> object using the <code>iter_mut</code> and <code>into_iter</code> methods. This can
|
||||
only be done if you have mutable access to the <code>ThreadLocal</code> object, which
|
||||
guarantees that you are the only thread currently accessing it.</p>
|
||||
<p>Note that since thread IDs are recycled when a thread exits, it is possible
|
||||
for one thread to retrieve the object of another thread. Since this can only
|
||||
occur after a thread has exited this does not lead to any race conditions.</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<p>Basic usage of <code>ThreadLocal</code>:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>thread_local::ThreadLocal;
|
||||
<span class="kw">let </span>tls: ThreadLocal<u32> = ThreadLocal::new();
|
||||
<span class="macro">assert_eq!</span>(tls.get(), <span class="prelude-val">None</span>);
|
||||
<span class="macro">assert_eq!</span>(tls.get_or(|| <span class="number">5</span>), <span class="kw-2">&</span><span class="number">5</span>);
|
||||
<span class="macro">assert_eq!</span>(tls.get(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="number">5</span>));</code></pre></div>
|
||||
<p>Combining thread-local values into a single result:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>thread_local::ThreadLocal;
|
||||
<span class="kw">use </span>std::sync::Arc;
|
||||
<span class="kw">use </span>std::cell::Cell;
|
||||
<span class="kw">use </span>std::thread;
|
||||
|
||||
<span class="kw">let </span>tls = Arc::new(ThreadLocal::new());
|
||||
|
||||
<span class="comment">// Create a bunch of threads to do stuff
|
||||
</span><span class="kw">for _ in </span><span class="number">0</span>..<span class="number">5 </span>{
|
||||
<span class="kw">let </span>tls2 = tls.clone();
|
||||
thread::spawn(<span class="kw">move </span>|| {
|
||||
<span class="comment">// Increment a counter to count some event...
|
||||
</span><span class="kw">let </span>cell = tls2.get_or(|| Cell::new(<span class="number">0</span>));
|
||||
cell.set(cell.get() + <span class="number">1</span>);
|
||||
}).join().unwrap();
|
||||
}
|
||||
|
||||
<span class="comment">// Once all threads are done, collect the counter values and return the
|
||||
// sum of all thread-local counter values.
|
||||
</span><span class="kw">let </span>tls = Arc::try_unwrap(tls).unwrap();
|
||||
<span class="kw">let </span>total = tls.into_iter().fold(<span class="number">0</span>, |x, y| x + y.get());
|
||||
<span class="macro">assert_eq!</span>(total, <span class="number">5</span>);</code></pre></div>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.CachedIntoIter.html" title="struct thread_local::CachedIntoIter">Cached<wbr>Into<wbr>Iter</a><wbr><span class="stab deprecated" title="">Deprecated</span></div><div class="desc docblock-short">An iterator that moves out of a <code>CachedThreadLocal</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.CachedIterMut.html" title="struct thread_local::CachedIterMut">Cached<wbr>Iter<wbr>Mut</a><wbr><span class="stab deprecated" title="">Deprecated</span></div><div class="desc docblock-short">Mutable iterator over the contents of a <code>CachedThreadLocal</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.CachedThreadLocal.html" title="struct thread_local::CachedThreadLocal">Cached<wbr>Thread<wbr>Local</a><wbr><span class="stab deprecated" title="">Deprecated</span></div><div class="desc docblock-short">Wrapper around <a href="struct.ThreadLocal.html" title="struct thread_local::ThreadLocal"><code>ThreadLocal</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.IntoIter.html" title="struct thread_local::IntoIter">Into<wbr>Iter</a></div><div class="desc docblock-short">An iterator that moves out of a <code>ThreadLocal</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.Iter.html" title="struct thread_local::Iter">Iter</a></div><div class="desc docblock-short">Iterator over the contents of a <code>ThreadLocal</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.IterMut.html" title="struct thread_local::IterMut">IterMut</a></div><div class="desc docblock-short">Mutable iterator over the contents of a <code>ThreadLocal</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.ThreadLocal.html" title="struct thread_local::ThreadLocal">Thread<wbr>Local</a></div><div class="desc docblock-short">Thread-local variable wrapper</div></li></ul></section></div></main></body></html>
|
||||
1
thread_local/sidebar-items.js
Normal file
1
thread_local/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"struct":["CachedIntoIter","CachedIterMut","CachedThreadLocal","IntoIter","Iter","IterMut","ThreadLocal"]};
|
||||
211
thread_local/struct.CachedIntoIter.html
Normal file
211
thread_local/struct.CachedIntoIter.html
Normal file
File diff suppressed because one or more lines are too long
210
thread_local/struct.CachedIterMut.html
Normal file
210
thread_local/struct.CachedIterMut.html
Normal file
File diff suppressed because one or more lines are too long
34
thread_local/struct.CachedThreadLocal.html
Normal file
34
thread_local/struct.CachedThreadLocal.html
Normal file
File diff suppressed because one or more lines are too long
211
thread_local/struct.IntoIter.html
Normal file
211
thread_local/struct.IntoIter.html
Normal file
File diff suppressed because one or more lines are too long
210
thread_local/struct.Iter.html
Normal file
210
thread_local/struct.Iter.html
Normal file
File diff suppressed because one or more lines are too long
210
thread_local/struct.IterMut.html
Normal file
210
thread_local/struct.IterMut.html
Normal file
File diff suppressed because one or more lines are too long
41
thread_local/struct.ThreadLocal.html
Normal file
41
thread_local/struct.ThreadLocal.html
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue