Now a REAL lib
This commit is contained in:
1
doc/lazy_static/all.html
Normal file
1
doc/lazy_static/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"><meta name="keywords" content="rust, rustlang, rust-lang"><title>List of all items in this crate</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc mod"><!--[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">☰</button><a class="sidebar-logo" href="../lazy_static/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../lazy_static/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location">Crate lazy_static</h2></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../lazy_static/index.html"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav></div><section id="main-content" class="content"><h1 class="fqn"><span class="in-band">List of all items</span></h1><h3 id="Traits">Traits</h3><ul class="traits docblock"><li><a href="trait.LazyStatic.html">LazyStatic</a></li></ul><h3 id="Macros">Macros</h3><ul class="macros docblock"><li><a href="macro.lazy_static.html">lazy_static</a></li></ul><h3 id="Functions">Functions</h3><ul class="functions docblock"><li><a href="fn.initialize.html">initialize</a></li></ul></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="lazy_static" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0 (a55dd71d5 2022-09-19)" ></div></body></html>
|
||||
19
doc/lazy_static/fn.initialize.html
Normal file
19
doc/lazy_static/fn.initialize.html
Normal file
@ -0,0 +1,19 @@
|
||||
<!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="Takes a shared reference to a lazy static and initializes it if it has not been already."><meta name="keywords" content="rust, rustlang, rust-lang, initialize"><title>initialize in lazy_static - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc fn"><!--[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">☰</button><a class="sidebar-logo" href="../lazy_static/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../lazy_static/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><div class="sidebar-elems"><h2 class="location"><a href="index.html">In lazy_static</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../lazy_static/index.html"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav></div><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn"><span class="in-band">Function <a href="index.html">lazy_static</a>::<wbr><a class="fn" href="#">initialize</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/lazy_static/lib.rs.html#213-215">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><div class="docblock item-decl"><pre class="rust fn"><code>pub fn initialize<T: <a class="trait" href="trait.LazyStatic.html" title="trait lazy_static::LazyStatic">LazyStatic</a>>(lazy: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.reference.html">&</a>T)</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Takes a shared reference to a lazy static and initializes
|
||||
it if it has not been already.</p>
|
||||
<p>This can be used to control the initialization point of a lazy static.</p>
|
||||
<p>Example:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#[<span class="ident">macro_use</span>]</span>
|
||||
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">lazy_static</span>;
|
||||
|
||||
<span class="macro">lazy_static!</span> {
|
||||
<span class="kw">static</span> <span class="kw-2">ref</span> <span class="ident">BUFFER</span>: <span class="ident">Vec</span><span class="op"><</span><span class="ident">u8</span><span class="op">></span> <span class="op">=</span> (<span class="number">0</span>..<span class="number">255</span>).<span class="ident">collect</span>();
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">main</span>() {
|
||||
<span class="ident">lazy_static::initialize</span>(<span class="kw-2">&</span><span class="ident">BUFFER</span>);
|
||||
|
||||
<span class="comment">// ...</span>
|
||||
<span class="ident">work_with_initialized_data</span>(<span class="kw-2">&</span><span class="ident">BUFFER</span>);
|
||||
}</code></pre></div>
|
||||
</div></details></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="lazy_static" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0 (a55dd71d5 2022-09-19)" ></div></body></html>
|
||||
69
doc/lazy_static/index.html
Normal file
69
doc/lazy_static/index.html
Normal file
@ -0,0 +1,69 @@
|
||||
<!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="A macro for declaring lazily evaluated statics."><meta name="keywords" content="rust, rustlang, rust-lang, lazy_static"><title>lazy_static - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="../crates.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.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">☰</button><a class="sidebar-logo" href="../lazy_static/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../lazy_static/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Crate lazy_static</a></h2><div class="sidebar-elems"><div class="block"><ul><li class="version">Version 1.4.0</li><li><a id="all-types" href="all.html">All Items</a></li></ul></div><section><div class="block"><ul><li><a href="#macros">Macros</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></div></section></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../lazy_static/index.html"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav></div><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn"><span class="in-band">Crate <a class="mod" href="#">lazy_static</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/lazy_static/lib.rs.html#8-215">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A macro for declaring lazily evaluated statics.</p>
|
||||
<p>Using this macro, it is possible to have <code>static</code>s that require code to be
|
||||
executed at runtime in order to be initialized.
|
||||
This includes anything requiring heap allocations, like vectors or hash maps,
|
||||
as well as anything that requires function calls to be computed.</p>
|
||||
<h2 id="syntax"><a href="#syntax">Syntax</a></h2>
|
||||
<div class='information'><div class='tooltip ignore'>ⓘ</div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore"><code><span class="macro">lazy_static!</span> {
|
||||
[<span class="kw">pub</span>] <span class="kw">static</span> <span class="kw-2">ref</span> <span class="ident">NAME_1</span>: <span class="ident">TYPE_1</span> <span class="op">=</span> <span class="ident">EXPR_1</span>;
|
||||
[<span class="kw">pub</span>] <span class="kw">static</span> <span class="kw-2">ref</span> <span class="ident">NAME_2</span>: <span class="ident">TYPE_2</span> <span class="op">=</span> <span class="ident">EXPR_2</span>;
|
||||
...
|
||||
[<span class="kw">pub</span>] <span class="kw">static</span> <span class="kw-2">ref</span> <span class="ident">NAME_N</span>: <span class="ident">TYPE_N</span> <span class="op">=</span> <span class="ident">EXPR_N</span>;
|
||||
}</code></pre></div>
|
||||
<p>Attributes (including doc comments) are supported as well:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">lazy_static!</span> {
|
||||
<span class="doccomment">/// This is an example for using doc comment attributes</span>
|
||||
<span class="kw">static</span> <span class="kw-2">ref</span> <span class="ident">EXAMPLE</span>: <span class="ident">u8</span> <span class="op">=</span> <span class="number">42</span>;
|
||||
}</code></pre></div>
|
||||
<h2 id="semantics"><a href="#semantics">Semantics</a></h2>
|
||||
<p>For a given <code>static ref NAME: TYPE = EXPR;</code>, the macro generates a unique type that
|
||||
implements <code>Deref<TYPE></code> and stores it in a static with name <code>NAME</code>. (Attributes end up
|
||||
attaching to this type.)</p>
|
||||
<p>On first deref, <code>EXPR</code> gets evaluated and stored internally, such that all further derefs
|
||||
can return a reference to the same object. Note that this can lead to deadlocks
|
||||
if you have multiple lazy statics that depend on each other in their initialization.</p>
|
||||
<p>Apart from the lazy initialization, the resulting “static ref” variables
|
||||
have generally the same properties as regular “static” variables:</p>
|
||||
<ul>
|
||||
<li>Any type in them needs to fulfill the <code>Sync</code> trait.</li>
|
||||
<li>If the type has a destructor, then it will not run when the process exits.</li>
|
||||
</ul>
|
||||
<h2 id="example"><a href="#example">Example</a></h2>
|
||||
<p>Using the macro:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#[<span class="ident">macro_use</span>]</span>
|
||||
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">lazy_static</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="ident">std::collections::HashMap</span>;
|
||||
|
||||
<span class="macro">lazy_static!</span> {
|
||||
<span class="kw">static</span> <span class="kw-2">ref</span> <span class="ident">HASHMAP</span>: <span class="ident">HashMap</span><span class="op"><</span><span class="ident">u32</span>, <span class="kw-2">&</span><span class="lifetime">'static</span> <span class="ident">str</span><span class="op">></span> <span class="op">=</span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">HashMap::new</span>();
|
||||
<span class="ident">m</span>.<span class="ident">insert</span>(<span class="number">0</span>, <span class="string">"foo"</span>);
|
||||
<span class="ident">m</span>.<span class="ident">insert</span>(<span class="number">1</span>, <span class="string">"bar"</span>);
|
||||
<span class="ident">m</span>.<span class="ident">insert</span>(<span class="number">2</span>, <span class="string">"baz"</span>);
|
||||
<span class="ident">m</span>
|
||||
};
|
||||
<span class="kw">static</span> <span class="kw-2">ref</span> <span class="ident">COUNT</span>: <span class="ident">usize</span> <span class="op">=</span> <span class="ident">HASHMAP</span>.<span class="ident">len</span>();
|
||||
<span class="kw">static</span> <span class="kw-2">ref</span> <span class="ident">NUMBER</span>: <span class="ident">u32</span> <span class="op">=</span> <span class="ident">times_two</span>(<span class="number">21</span>);
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">times_two</span>(<span class="ident">n</span>: <span class="ident">u32</span>) -> <span class="ident">u32</span> { <span class="ident">n</span> <span class="op">*</span> <span class="number">2</span> }
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">main</span>() {
|
||||
<span class="macro">println!</span>(<span class="string">"The map has {} entries."</span>, <span class="kw-2">*</span><span class="ident">COUNT</span>);
|
||||
<span class="macro">println!</span>(<span class="string">"The entry for `0` is \"{}\"."</span>, <span class="ident">HASHMAP</span>.<span class="ident">get</span>(<span class="kw-2">&</span><span class="number">0</span>).<span class="ident">unwrap</span>());
|
||||
<span class="macro">println!</span>(<span class="string">"A expensive calculation on a static results in: {}."</span>, <span class="kw-2">*</span><span class="ident">NUMBER</span>);
|
||||
}</code></pre></div>
|
||||
<h2 id="implementation-details"><a href="#implementation-details">Implementation details</a></h2>
|
||||
<p>The <code>Deref</code> implementation uses a hidden static variable that is guarded by an atomic check on each access.</p>
|
||||
<h2 id="cargo-features"><a href="#cargo-features">Cargo features</a></h2>
|
||||
<p>This crate provides one cargo feature:</p>
|
||||
<ul>
|
||||
<li><code>spin_no_std</code>: This allows using this crate in a no-std environment, by depending on the standalone <code>spin</code> crate.</li>
|
||||
</ul>
|
||||
</div></details><h2 id="macros" class="small-section-header"><a href="#macros">Macros</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="macro" href="macro.lazy_static.html" title="lazy_static::lazy_static macro">lazy_static</a></div><div class="item-right docblock-short"></div></div></div><h2 id="traits" class="small-section-header"><a href="#traits">Traits</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.LazyStatic.html" title="lazy_static::LazyStatic trait">LazyStatic</a></div><div class="item-right docblock-short"><p>Support trait for enabling a few common operation on lazy static values.</p>
|
||||
</div></div></div><h2 id="functions" class="small-section-header"><a href="#functions">Functions</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.initialize.html" title="lazy_static::initialize fn">initialize</a></div><div class="item-right docblock-short"><p>Takes a shared reference to a lazy static and initializes
|
||||
it if it has not been already.</p>
|
||||
</div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="lazy_static" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0 (a55dd71d5 2022-09-19)" ></div></body></html>
|
||||
11
doc/lazy_static/macro.lazy_static!.html
Normal file
11
doc/lazy_static/macro.lazy_static!.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=macro.lazy_static.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="macro.lazy_static.html">macro.lazy_static.html</a>...</p>
|
||||
<script>location.replace("macro.lazy_static.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
7
doc/lazy_static/macro.lazy_static.html
Normal file
7
doc/lazy_static/macro.lazy_static.html
Normal file
@ -0,0 +1,7 @@
|
||||
<!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 `lazy_static` macro in crate `lazy_static`."><meta name="keywords" content="rust, rustlang, rust-lang, lazy_static"><title>lazy_static in lazy_static - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc macro"><!--[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">☰</button><a class="sidebar-logo" href="../lazy_static/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../lazy_static/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><div class="sidebar-elems"><h2 class="location"><a href="index.html">In lazy_static</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../lazy_static/index.html"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav></div><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn"><span class="in-band">Macro <a href="index.html">lazy_static</a>::<wbr><a class="macro" href="#">lazy_static</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/lazy_static/lib.rs.html#167-179">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><div class="docblock item-decl"><div class="example-wrap"><pre class="rust macro"><code><span class="macro">macro_rules!</span> <span class="ident">lazy_static</span> {
|
||||
($(<span class="attribute">#[<span class="macro-nonterminal">$</span><span class="macro-nonterminal">attr</span>:<span class="ident">meta</span>]</span>)<span class="op">*</span> <span class="kw">static</span> <span class="kw-2">ref</span> <span class="macro-nonterminal">$</span><span class="macro-nonterminal">N</span>:<span class="ident">ident</span> : <span class="macro-nonterminal">$</span><span class="macro-nonterminal">T</span>:<span class="ident">ty</span> <span class="op">=</span> <span class="macro-nonterminal">$</span><span class="macro-nonterminal">e</span>:<span class="ident">expr</span>; $(<span class="macro-nonterminal">$</span><span class="macro-nonterminal">t</span>:<span class="ident">tt</span>)<span class="kw-2">*</span>) => { ... };
|
||||
($(<span class="attribute">#[<span class="macro-nonterminal">$</span><span class="macro-nonterminal">attr</span>:<span class="ident">meta</span>]</span>)<span class="op">*</span> <span class="kw">pub</span> <span class="kw">static</span> <span class="kw-2">ref</span> <span class="macro-nonterminal">$</span><span class="macro-nonterminal">N</span>:<span class="ident">ident</span> : <span class="macro-nonterminal">$</span><span class="macro-nonterminal">T</span>:<span class="ident">ty</span> <span class="op">=</span> <span class="macro-nonterminal">$</span><span class="macro-nonterminal">e</span>:<span class="ident">expr</span>; $(<span class="macro-nonterminal">$</span><span class="macro-nonterminal">t</span>:<span class="ident">tt</span>)<span class="kw-2">*</span>) => { ... };
|
||||
($(<span class="attribute">#[<span class="macro-nonterminal">$</span><span class="macro-nonterminal">attr</span>:<span class="ident">meta</span>]</span>)<span class="op">*</span> <span class="kw">pub</span> ($(<span class="macro-nonterminal">$</span><span class="macro-nonterminal">vis</span>:<span class="ident">tt</span>)<span class="op">+</span>) <span class="kw">static</span> <span class="kw-2">ref</span> <span class="macro-nonterminal">$</span><span class="macro-nonterminal">N</span>:<span class="ident">ident</span> : <span class="macro-nonterminal">$</span><span class="macro-nonterminal">T</span>:<span class="ident">ty</span> <span class="op">=</span> <span class="macro-nonterminal">$</span><span class="macro-nonterminal">e</span>:<span class="ident">expr</span>; $(<span class="macro-nonterminal">$</span><span class="macro-nonterminal">t</span>:<span class="ident">tt</span>)<span class="kw-2">*</span>) => { ... };
|
||||
() => { ... };
|
||||
}</code></pre></div>
|
||||
</div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="lazy_static" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0 (a55dd71d5 2022-09-19)" ></div></body></html>
|
||||
1
doc/lazy_static/sidebar-items.js
Normal file
1
doc/lazy_static/sidebar-items.js
Normal file
@ -0,0 +1 @@
|
||||
window.SIDEBAR_ITEMS = {"fn":[["initialize","Takes a shared reference to a lazy static and initializes it if it has not been already."]],"macro":[["lazy_static",""]],"trait":[["LazyStatic","Support trait for enabling a few common operation on lazy static values."]]};
|
||||
4
doc/lazy_static/trait.LazyStatic.html
Normal file
4
doc/lazy_static/trait.LazyStatic.html
Normal file
@ -0,0 +1,4 @@
|
||||
<!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="Support trait for enabling a few common operation on lazy static values."><meta name="keywords" content="rust, rustlang, rust-lang, LazyStatic"><title>LazyStatic in lazy_static - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.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">☰</button><a class="sidebar-logo" href="../lazy_static/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../lazy_static/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">LazyStatic</a></h2><div class="sidebar-elems"><section><div class="block"><h3 class="sidebar-title"><a href="#implementors">Implementors</a></h3></div></section><h2 class="location"><a href="index.html">In lazy_static</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../lazy_static/index.html"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav></div><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn"><span class="in-band">Trait <a href="index.html">lazy_static</a>::<wbr><a class="trait" href="#">LazyStatic</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/lazy_static/lib.rs.html#185-188">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><div class="docblock item-decl"><pre class="rust trait"><code>pub trait LazyStatic { }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Support trait for enabling a few common operation on lazy static values.</p>
|
||||
<p>This is implemented by each defined lazy static, and
|
||||
used by the free functions in this crate.</p>
|
||||
</div></details><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"></div><script type="text/javascript" src="../implementors/lazy_static/trait.LazyStatic.js" data-ignore-extern-crates="" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="lazy_static" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0 (a55dd71d5 2022-09-19)" ></div></body></html>
|
||||
Reference in New Issue
Block a user