Update documentation for Juniper
This commit is contained in:
parent
9a8a7e01ed
commit
549c491c43
26 changed files with 132 additions and 126 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -47,7 +47,7 @@
|
|||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
|
||||
[<span class='inner'>−</span>]
|
||||
</a>
|
||||
</span><a id='src-0' class='srclink' href='../src/lazy_static/lib.rs.html#1-157' title='goto source code'>[src]</a></span></h1>
|
||||
</span><a id='src-0' class='srclink' href='../src/lazy_static/lib.rs.html#1-137' title='goto source code'>[src]</a></span></h1>
|
||||
<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
|
||||
|
@ -108,13 +108,37 @@ trait.</p>
|
|||
|
||||
<h1 id='implementation-details' class='section-header'><a href='#implementation-details'>Implementation details</a></h1>
|
||||
<p>The <code>Deref</code> implementation uses a hidden static variable that is guarded by a atomic check on each access. On stable Rust, the macro may need to allocate each static on the heap.</p>
|
||||
</div><h2 id='macros' class='section-header'><a href="#macros">Macros</a></h2>
|
||||
</div><h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2>
|
||||
<table>
|
||||
<tr class=' module-item'>
|
||||
<td><a class='mod' href='lazy/index.html'
|
||||
title='lazy_static::lazy'>lazy</a></td>
|
||||
<td class='docblock short'>
|
||||
|
||||
</td>
|
||||
</tr></table><h2 id='macros' class='section-header'><a href="#macros">Macros</a></h2>
|
||||
<table>
|
||||
<tr class=' module-item'>
|
||||
<td><a class='macro' href='macro.__lazy_static_create!.html'
|
||||
title='lazy_static::__lazy_static_create!'>__lazy_static_create!</a></td>
|
||||
<td class='docblock short'>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr class=' module-item'>
|
||||
<td><a class='macro' href='macro.lazy_static!.html'
|
||||
title='lazy_static::lazy_static!'>lazy_static!</a></td>
|
||||
<td class='docblock short'>
|
||||
|
||||
</td>
|
||||
</tr></table><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
|
||||
<table>
|
||||
<tr class=' module-item'>
|
||||
<td><a class='trait' href='trait.__Deref.html'
|
||||
title='lazy_static::__Deref'>__Deref</a></td>
|
||||
<td class='docblock short'>
|
||||
<p>The <code>Deref</code> trait is used to specify the functionality of dereferencing
|
||||
operations, like <code>*v</code>.</p>
|
||||
</td>
|
||||
</tr></table></section>
|
||||
<section id='search' class="content hidden"></section>
|
||||
|
|
|
@ -47,14 +47,14 @@
|
|||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
|
||||
[<span class='inner'>−</span>]
|
||||
</a>
|
||||
</span><a id='src-4' class='srclink' href='../src/lazy_static/lib.rs.html#75-157' title='goto source code'>[src]</a></span></h1>
|
||||
</span><a id='src-25' class='srclink' href='../src/lazy_static/lib.rs.html#90-137' title='goto source code'>[src]</a></span></h1>
|
||||
<pre class='rust macro'>
|
||||
<span class='macro'>macro_rules</span><span class='macro'>!</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='op'>*</span>) <span class='op'>=></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='op'>*</span>) <span class='op'>=></span> { ... };
|
||||
(<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>VIS</span>:<span class='ident'>ident</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='op'>*</span>) <span class='op'>=></span> { ... };
|
||||
(<span class='ident'>MAKE</span> <span class='ident'>TY</span>, <span class='ident'>PUB</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='macro-nonterminal'>$</span><span class='macro-nonterminal'>N</span>:<span class='ident'>ident</span>) <span class='op'>=></span> { ... };
|
||||
(<span class='ident'>MAKE</span> <span class='ident'>TY</span>, <span class='ident'>PRIV</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='macro-nonterminal'>$</span><span class='macro-nonterminal'>N</span>:<span class='ident'>ident</span>) <span class='op'>=></span> { ... };
|
||||
(@<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>VIS</span>:<span class='ident'>ident</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='op'>*</span>) <span class='op'>=></span> { ... };
|
||||
(@<span class='ident'>MAKE</span> <span class='ident'>TY</span>, <span class='ident'>PUB</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='macro-nonterminal'>$</span><span class='macro-nonterminal'>N</span>:<span class='ident'>ident</span>) <span class='op'>=></span> { ... };
|
||||
(@<span class='ident'>MAKE</span> <span class='ident'>TY</span>, <span class='ident'>PRIV</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='macro-nonterminal'>$</span><span class='macro-nonterminal'>N</span>:<span class='ident'>ident</span>) <span class='op'>=></span> { ... };
|
||||
() <span class='op'>=></span> { ... };
|
||||
}</pre>
|
||||
</section>
|
||||
|
|
|
@ -1 +1 @@
|
|||
initSidebarItems({"macro":[["lazy_static!",""]]});
|
||||
initSidebarItems({"macro":[["__lazy_static_create!",""],["lazy_static!",""]],"mod":[["lazy",""]],"trait":[["__Deref","The `Deref` trait is used to specify the functionality of dereferencing operations, like `*v`."]]});
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="generator" content="rustdoc">
|
||||
<meta name="description" content="Source to the Rust file `/home/travis/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-0.1.16/src/lib.rs`.">
|
||||
<meta name="description" content="Source to the Rust file `/home/travis/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-0.2.1/src/lib.rs`.">
|
||||
<meta name="keywords" content="rust, rustlang, rust-lang">
|
||||
|
||||
<title>lib.rs.html -- source</title>
|
||||
|
@ -179,26 +179,6 @@
|
|||
<span id="135">135</span>
|
||||
<span id="136">136</span>
|
||||
<span id="137">137</span>
|
||||
<span id="138">138</span>
|
||||
<span id="139">139</span>
|
||||
<span id="140">140</span>
|
||||
<span id="141">141</span>
|
||||
<span id="142">142</span>
|
||||
<span id="143">143</span>
|
||||
<span id="144">144</span>
|
||||
<span id="145">145</span>
|
||||
<span id="146">146</span>
|
||||
<span id="147">147</span>
|
||||
<span id="148">148</span>
|
||||
<span id="149">149</span>
|
||||
<span id="150">150</span>
|
||||
<span id="151">151</span>
|
||||
<span id="152">152</span>
|
||||
<span id="153">153</span>
|
||||
<span id="154">154</span>
|
||||
<span id="155">155</span>
|
||||
<span id="156">156</span>
|
||||
<span id="157">157</span>
|
||||
</pre><pre class='rust '>
|
||||
<span class='doccomment'>/*!
|
||||
A macro for declaring lazily evaluated statics.
|
||||
|
@ -270,74 +250,54 @@ The `Deref` implementation uses a hidden static variable that is guarded by a at
|
|||
|
||||
*/</span>
|
||||
|
||||
<span class='attribute'>#<span class='op'>!</span>[<span class='ident'>cfg_attr</span>(<span class='ident'>feature</span><span class='op'>=</span><span class='string'>"nightly"</span>, <span class='ident'>feature</span>(<span class='ident'>const_fn</span>, <span class='ident'>core_intrinsics</span>))]</span>
|
||||
<span class='attribute'>#<span class='op'>!</span>[<span class='ident'>crate_type</span> <span class='op'>=</span> <span class='string'>"dylib"</span>]</span>
|
||||
<span class='attribute'>#<span class='op'>!</span>[<span class='ident'>cfg_attr</span>(<span class='ident'>feature</span><span class='op'>=</span><span class='string'>"nightly"</span>, <span class='ident'>feature</span>(<span class='ident'>const_fn</span>, <span class='ident'>allow_internal_unstable</span>, <span class='ident'>core_intrinsics</span>))]</span>
|
||||
|
||||
<span class='attribute'>#<span class='op'>!</span>[<span class='ident'>no_std</span>]</span>
|
||||
|
||||
<span class='attribute'>#[<span class='ident'>cfg</span>(<span class='ident'>not</span>(<span class='ident'>feature</span><span class='op'>=</span><span class='string'>"nightly"</span>))]</span>
|
||||
<span class='kw'>pub</span> <span class='kw'>mod</span> <span class='ident'>lazy</span>;
|
||||
|
||||
<span class='attribute'>#[<span class='ident'>cfg</span>(<span class='ident'>all</span>(<span class='ident'>feature</span><span class='op'>=</span><span class='string'>"nightly"</span>, <span class='ident'>not</span>(<span class='ident'>feature</span><span class='op'>=</span><span class='string'>"spin_no_std"</span>)))]</span>
|
||||
<span class='attribute'>#[<span class='ident'>path</span><span class='op'>=</span><span class='string'>"nightly_lazy.rs"</span>]</span>
|
||||
<span class='kw'>pub</span> <span class='kw'>mod</span> <span class='ident'>lazy</span>;
|
||||
|
||||
<span class='attribute'>#[<span class='ident'>cfg</span>(<span class='ident'>all</span>(<span class='ident'>feature</span><span class='op'>=</span><span class='string'>"nightly"</span>, <span class='ident'>feature</span><span class='op'>=</span><span class='string'>"spin_no_std"</span>))]</span>
|
||||
<span class='attribute'>#[<span class='ident'>path</span><span class='op'>=</span><span class='string'>"core_lazy.rs"</span>]</span>
|
||||
<span class='kw'>pub</span> <span class='kw'>mod</span> <span class='ident'>lazy</span>;
|
||||
|
||||
<span class='kw'>pub</span> <span class='kw'>use</span> <span class='ident'>core</span>::<span class='ident'>ops</span>::<span class='ident'>Deref</span> <span class='kw'>as</span> <span class='ident'>__Deref</span>;
|
||||
|
||||
<span class='attribute'>#[<span class='ident'>macro_export</span>]</span>
|
||||
<span class='attribute'>#[<span class='ident'>cfg_attr</span>(<span class='ident'>feature</span><span class='op'>=</span><span class='string'>"nightly"</span>, <span class='ident'>allow_internal_unstable</span>)]</span>
|
||||
<span class='macro'>macro_rules</span><span class='macro'>!</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='op'>*</span>) <span class='op'>=></span> {
|
||||
<span class='macro'>lazy_static</span><span class='macro'>!</span>(<span class='ident'>PRIV</span>, $(<span class='attribute'>#[<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>attr</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='macro-nonterminal'>$</span><span class='macro-nonterminal'>T</span> <span class='op'>=</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>e</span>; $(<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>t</span>)<span class='op'>*</span>);
|
||||
<span class='macro'>lazy_static</span><span class='macro'>!</span>(@<span class='ident'>PRIV</span>, $(<span class='attribute'>#[<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>attr</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='macro-nonterminal'>$</span><span class='macro-nonterminal'>T</span> <span class='op'>=</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>e</span>; $(<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>t</span>)<span class='op'>*</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='op'>*</span>) <span class='op'>=></span> {
|
||||
<span class='macro'>lazy_static</span><span class='macro'>!</span>(<span class='ident'>PUB</span>, $(<span class='attribute'>#[<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>attr</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='macro-nonterminal'>$</span><span class='macro-nonterminal'>T</span> <span class='op'>=</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>e</span>; $(<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>t</span>)<span class='op'>*</span>);
|
||||
<span class='macro'>lazy_static</span><span class='macro'>!</span>(@<span class='ident'>PUB</span>, $(<span class='attribute'>#[<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>attr</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='macro-nonterminal'>$</span><span class='macro-nonterminal'>T</span> <span class='op'>=</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>e</span>; $(<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>t</span>)<span class='op'>*</span>);
|
||||
};
|
||||
(<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>VIS</span>:<span class='ident'>ident</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='op'>*</span>) <span class='op'>=></span> {
|
||||
<span class='macro'>lazy_static</span><span class='macro'>!</span>(<span class='ident'>MAKE</span> <span class='ident'>TY</span>, <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>VIS</span>, $(<span class='attribute'>#[<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>attr</span>]</span>)<span class='op'>*</span>, <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>N</span>);
|
||||
<span class='kw'>impl</span> ::<span class='ident'>std</span>::<span class='ident'>ops</span>::<span class='ident'>Deref</span> <span class='kw'>for</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>N</span> {
|
||||
(@<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>VIS</span>:<span class='ident'>ident</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='op'>*</span>) <span class='op'>=></span> {
|
||||
<span class='macro'>lazy_static</span><span class='macro'>!</span>(@<span class='ident'>MAKE</span> <span class='ident'>TY</span>, <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>VIS</span>, $(<span class='attribute'>#[<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>attr</span>]</span>)<span class='op'>*</span>, <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>N</span>);
|
||||
<span class='kw'>impl</span> <span class='macro-nonterminal'>$</span><span class='kw'>crate</span>::<span class='macro-nonterminal'>__Deref</span> <span class='kw'>for</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>N</span> {
|
||||
<span class='kw'>type</span> <span class='ident'>Target</span> <span class='op'>=</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>T</span>;
|
||||
<span class='attribute'>#[<span class='ident'>allow</span>(<span class='ident'>unsafe_code</span>)]</span>
|
||||
<span class='kw'>fn</span> <span class='ident'>deref</span><span class='op'><</span><span class='lifetime'>'a</span><span class='op'>></span>(<span class='kw-2'>&</span><span class='lifetime'>'a</span> <span class='self'>self</span>) <span class='op'>-></span> <span class='kw-2'>&</span><span class='lifetime'>'a</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>T</span> {
|
||||
<span class='kw'>unsafe</span> {
|
||||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span>
|
||||
<span class='kw'>fn</span> <span class='ident'>__static_ref_initialize</span>() <span class='op'>-></span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>T</span> { <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>e</span> }
|
||||
|
||||
<span class='kw'>unsafe</span> {
|
||||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>sync</span>::{<span class='ident'>Once</span>, <span class='ident'>ONCE_INIT</span>};
|
||||
|
||||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span>
|
||||
<span class='kw'>fn</span> <span class='ident'>require_sync</span><span class='op'><</span><span class='ident'>T</span>: <span class='ident'>Sync</span><span class='op'>></span>(_: <span class='kw-2'>&</span><span class='ident'>T</span>) { }
|
||||
|
||||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span>
|
||||
<span class='attribute'>#[<span class='ident'>cfg</span>(<span class='ident'>feature</span><span class='op'>=</span><span class='string'>"nightly"</span>)]</span>
|
||||
<span class='kw'>unsafe</span> <span class='kw'>fn</span> <span class='ident'>__stability</span>() <span class='op'>-></span> <span class='kw-2'>&</span><span class='lifetime'>'static</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>T</span> {
|
||||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>cell</span>::<span class='ident'>UnsafeCell</span>;
|
||||
|
||||
<span class='kw'>struct</span> <span class='ident'>SyncCell</span>(<span class='ident'>UnsafeCell</span><span class='op'><</span><span class='prelude-ty'>Option</span><span class='op'><</span><span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>T</span><span class='op'>>></span>);
|
||||
<span class='kw'>unsafe</span> <span class='kw'>impl</span> <span class='ident'>Sync</span> <span class='kw'>for</span> <span class='ident'>SyncCell</span> {}
|
||||
|
||||
<span class='kw'>static</span> <span class='ident'>DATA</span>: <span class='ident'>SyncCell</span> <span class='op'>=</span> <span class='ident'>SyncCell</span>(<span class='ident'>UnsafeCell</span>::<span class='ident'>new</span>(<span class='prelude-val'>None</span>));
|
||||
<span class='kw'>static</span> <span class='ident'>ONCE</span>: <span class='ident'>Once</span> <span class='op'>=</span> <span class='ident'>ONCE_INIT</span>;
|
||||
<span class='ident'>ONCE</span>.<span class='ident'>call_once</span>(<span class='op'>||</span> {
|
||||
<span class='op'>*</span><span class='ident'>DATA</span>.<span class='number'>0</span>.<span class='ident'>get</span>() <span class='op'>=</span> <span class='prelude-val'>Some</span>(<span class='ident'>__static_ref_initialize</span>());
|
||||
});
|
||||
<span class='kw'>match</span> <span class='op'>*</span><span class='ident'>DATA</span>.<span class='number'>0</span>.<span class='ident'>get</span>() {
|
||||
<span class='prelude-val'>Some</span>(<span class='kw-2'>ref</span> <span class='ident'>x</span>) <span class='op'>=></span> <span class='ident'>x</span>,
|
||||
<span class='prelude-val'>None</span> <span class='op'>=></span> ::<span class='ident'>std</span>::<span class='ident'>intrinsics</span>::<span class='ident'>unreachable</span>(),
|
||||
<span class='macro'>__lazy_static_create</span><span class='macro'>!</span>(<span class='ident'>LAZY</span>, <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>T</span>);
|
||||
<span class='ident'>LAZY</span>.<span class='ident'>get</span>(<span class='ident'>__static_ref_initialize</span>)
|
||||
}
|
||||
}
|
||||
|
||||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span>
|
||||
<span class='attribute'>#[<span class='ident'>cfg</span>(<span class='ident'>not</span>(<span class='ident'>feature</span><span class='op'>=</span><span class='string'>"nightly"</span>))]</span>
|
||||
<span class='kw'>unsafe</span> <span class='kw'>fn</span> <span class='ident'>__stability</span>() <span class='op'>-></span> <span class='kw-2'>&</span><span class='lifetime'>'static</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>T</span> {
|
||||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>mem</span>::<span class='ident'>transmute</span>;
|
||||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>boxed</span>::<span class='ident'>Box</span>;
|
||||
|
||||
<span class='kw'>static</span> <span class='kw-2'>mut</span> <span class='ident'>DATA</span>: <span class='op'>*</span><span class='kw'>const</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>T</span> <span class='op'>=</span> <span class='number'>0</span> <span class='kw'>as</span> <span class='op'>*</span><span class='kw'>const</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>T</span>;
|
||||
<span class='kw'>static</span> <span class='kw-2'>mut</span> <span class='ident'>ONCE</span>: <span class='ident'>Once</span> <span class='op'>=</span> <span class='ident'>ONCE_INIT</span>;
|
||||
<span class='ident'>ONCE</span>.<span class='ident'>call_once</span>(<span class='op'>||</span> {
|
||||
<span class='ident'>DATA</span> <span class='op'>=</span> <span class='ident'>transmute</span>::<span class='op'><</span><span class='ident'>Box</span><span class='op'><</span><span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>T</span><span class='op'>></span>, <span class='op'>*</span><span class='kw'>const</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>T</span><span class='op'>></span>(
|
||||
<span class='ident'>Box</span>::<span class='ident'>new</span>(<span class='ident'>__static_ref_initialize</span>()));
|
||||
});
|
||||
<span class='kw-2'>&</span><span class='op'>*</span><span class='ident'>DATA</span>
|
||||
}
|
||||
|
||||
<span class='kw'>let</span> <span class='ident'>static_ref</span> <span class='op'>=</span> <span class='ident'>__stability</span>();
|
||||
<span class='ident'>require_sync</span>(<span class='ident'>static_ref</span>);
|
||||
<span class='ident'>static_ref</span>
|
||||
<span class='ident'>__stability</span>()
|
||||
}
|
||||
}
|
||||
}
|
||||
<span class='macro'>lazy_static</span><span class='macro'>!</span>($(<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>t</span>)<span class='op'>*</span>);
|
||||
};
|
||||
(<span class='ident'>MAKE</span> <span class='ident'>TY</span>, <span class='ident'>PUB</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='macro-nonterminal'>$</span><span class='macro-nonterminal'>N</span>:<span class='ident'>ident</span>) <span class='op'>=></span> {
|
||||
(@<span class='ident'>MAKE</span> <span class='ident'>TY</span>, <span class='ident'>PUB</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='macro-nonterminal'>$</span><span class='macro-nonterminal'>N</span>:<span class='ident'>ident</span>) <span class='op'>=></span> {
|
||||
<span class='attribute'>#[<span class='ident'>allow</span>(<span class='ident'>missing_copy_implementations</span>)]</span>
|
||||
<span class='attribute'>#[<span class='ident'>allow</span>(<span class='ident'>non_camel_case_types</span>)]</span>
|
||||
<span class='attribute'>#[<span class='ident'>allow</span>(<span class='ident'>dead_code</span>)]</span>
|
||||
|
@ -346,7 +306,7 @@ The `Deref` implementation uses a hidden static variable that is guarded by a at
|
|||
<span class='attribute'>#[<span class='ident'>doc</span>(<span class='ident'>hidden</span>)]</span>
|
||||
<span class='kw'>pub</span> <span class='kw'>static</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>N</span>: <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>N</span> <span class='op'>=</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>N</span> {<span class='ident'>__private_field</span>: ()};
|
||||
};
|
||||
(<span class='ident'>MAKE</span> <span class='ident'>TY</span>, <span class='ident'>PRIV</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='macro-nonterminal'>$</span><span class='macro-nonterminal'>N</span>:<span class='ident'>ident</span>) <span class='op'>=></span> {
|
||||
(@<span class='ident'>MAKE</span> <span class='ident'>TY</span>, <span class='ident'>PRIV</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='macro-nonterminal'>$</span><span class='macro-nonterminal'>N</span>:<span class='ident'>ident</span>) <span class='op'>=></span> {
|
||||
<span class='attribute'>#[<span class='ident'>allow</span>(<span class='ident'>missing_copy_implementations</span>)]</span>
|
||||
<span class='attribute'>#[<span class='ident'>allow</span>(<span class='ident'>non_camel_case_types</span>)]</span>
|
||||
<span class='attribute'>#[<span class='ident'>allow</span>(<span class='ident'>dead_code</span>)]</span>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="generator" content="rustdoc">
|
||||
<meta name="description" content="Source to the Rust file `/home/travis/.cargo/registry/src/github.com-1ecc6299db9ec823/traitobject-0.0.1/src/lib.rs`.">
|
||||
<meta name="description" content="Source to the Rust file `/home/travis/.cargo/registry/src/github.com-1ecc6299db9ec823/traitobject-0.0.3/src/lib.rs`.">
|
||||
<meta name="keywords" content="rust, rustlang, rust-lang">
|
||||
|
||||
<title>lib.rs.html -- source</title>
|
||||
|
@ -71,6 +71,13 @@
|
|||
<span id="27">27</span>
|
||||
<span id="28">28</span>
|
||||
<span id="29">29</span>
|
||||
<span id="30">30</span>
|
||||
<span id="31">31</span>
|
||||
<span id="32">32</span>
|
||||
<span id="33">33</span>
|
||||
<span id="34">34</span>
|
||||
<span id="35">35</span>
|
||||
<span id="36">36</span>
|
||||
</pre><pre class='rust '>
|
||||
<span class='attribute'>#<span class='op'>!</span>[<span class='ident'>cfg_attr</span>(<span class='ident'>test</span>, <span class='ident'>deny</span>(<span class='ident'>warnings</span>))]</span>
|
||||
<span class='attribute'>#<span class='op'>!</span>[<span class='ident'>deny</span>(<span class='ident'>missing_docs</span>)]</span>
|
||||
|
@ -101,6 +108,13 @@
|
|||
<span class='kw'>unsafe</span> { <span class='macro'>assert</span><span class='macro'>!</span>(<span class='kw-2'>&</span><span class='number'>7</span> <span class='op'>==</span> <span class='ident'>mem</span>::<span class='ident'>transmute</span>::<span class='op'><</span>_, <span class='kw-2'>&</span><span class='ident'>i32</span><span class='op'>></span>(<span class='ident'>data</span>(<span class='ident'>x</span>))) };
|
||||
}
|
||||
|
||||
<span class='doccomment'>/// A trait implemented for all trait objects.</span>
|
||||
<span class='doccomment'>///</span>
|
||||
<span class='doccomment'>/// Implementations for all traits in std are provided.</span>
|
||||
<span class='kw'>pub</span> <span class='kw'>unsafe</span> <span class='kw'>trait</span> <span class='ident'>Trait</span> {}
|
||||
|
||||
<span class='kw'>mod</span> <span class='ident'>impls</span>;
|
||||
|
||||
</pre>
|
||||
</section>
|
||||
<section id='search' class="content hidden"></section>
|
||||
|
|
|
@ -47,11 +47,19 @@
|
|||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
|
||||
[<span class='inner'>−</span>]
|
||||
</a>
|
||||
</span><a id='src-0' class='srclink' href='../src/traitobject/lib.rs.html#1-28' title='goto source code'>[src]</a></span></h1>
|
||||
</span><a id='src-0' class='srclink' href='../src/traitobject/lib.rs.html#1-35' title='goto source code'>[src]</a></span></h1>
|
||||
<div class='docblock'>
|
||||
<h1 id='traitobject' class='section-header'><a href='#traitobject'>traitobject</a></h1>
|
||||
<p>Unsafe helpers for working with raw TraitObjects.</p>
|
||||
</div><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2>
|
||||
</div><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
|
||||
<table>
|
||||
<tr class=' module-item'>
|
||||
<td><a class='trait' href='trait.Trait.html'
|
||||
title='traitobject::Trait'>Trait</a></td>
|
||||
<td class='docblock short'>
|
||||
<p>A trait implemented for all trait objects.</p>
|
||||
</td>
|
||||
</tr></table><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2>
|
||||
<table>
|
||||
<tr class=' module-item'>
|
||||
<td><a class='fn' href='fn.data.html'
|
||||
|
|
|
@ -1 +1 @@
|
|||
initSidebarItems({"fn":[["data","Get the data pointer from this trait object."],["data_mut","Get the data pointer from this trait object, mutably."]]});
|
||||
initSidebarItems({"fn":[["data","Get the data pointer from this trait object."],["data_mut","Get the data pointer from this trait object, mutably."]],"trait":[["Trait","A trait implemented for all trait objects."]]});
|
Loading…
Reference in a new issue