Skip to content

Commit 6eae7f5

Browse files
author
Rust Cookbook Maintainer
committed
Build cookbook at fbe78b7
1 parent f92b10f commit 6eae7f5

File tree

5 files changed

+26
-28
lines changed

5 files changed

+26
-28
lines changed

graph.png

29.2 KB
Loading

mem/global_static.html

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -188,20 +188,19 @@ <h2 id="declare-lazily-evaluated-constant"><a class="header" href="#declare-lazi
188188
show_access("Jim");
189189
}</code></pre></pre>
190190
<h2 id="stdcell"><a class="header" href="#stdcell">Std:cell</a></h2>
191-
<p><a href="https://doc.rust-lang.org/beta/std/cell/struct.OnceCell.html"><code>OnceCell</code></a> is included in the standard library as an alternative.</p>
192-
<pre><pre class="playground"><code class="language-rust edition2021"><span class="boring">#![allow(unused)]
193-
</span><span class="boring">fn main() {
194-
</span>use std::cell::OnceCell;
195-
196-
let cell = OnceCell::new();
197-
assert!(cell.get().is_none());
198-
199-
let value: &amp;String = cell.get_or_init(|| {
200-
"Hello, World!".to_string()
201-
});
202-
assert_eq!(value, "Hello, World!");
203-
assert!(cell.get().is_some());
204-
<span class="boring">}</span></code></pre></pre>
191+
<p><a href="https://doc.rust-lang.org/stable/std/cell/struct.OnceCell.html"><code>OnceCell</code></a> is included in the standard library as an alternative.</p>
192+
<pre><pre class="playground"><code class="language-rust edition2021">use std::cell::OnceCell;
193+
194+
fn main() {
195+
let cell = OnceCell::new();
196+
assert!(cell.get().is_none());
197+
198+
let value: &amp;String = cell.get_or_init(|| {
199+
"Hello, World!".to_string()
200+
});
201+
assert_eq!(value, "Hello, World!");
202+
assert!(cell.get().is_some());
203+
}</code></pre></pre>
205204
<!--
206205
Links, in a few categories. Follow the existing structure.
207206
Keep lines sorted.

print.html

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3945,20 +3945,19 @@ <h2 id="declare-lazily-evaluated-constant"><a class="header" href="#declare-lazi
39453945
show_access("Jim");
39463946
}</code></pre></pre>
39473947
<h2 id="stdcell"><a class="header" href="#stdcell">Std:cell</a></h2>
3948-
<p><a href="https://doc.rust-lang.org/beta/std/cell/struct.OnceCell.html"><code>OnceCell</code></a> is included in the standard library as an alternative.</p>
3949-
<pre><pre class="playground"><code class="language-rust edition2021"><span class="boring">#![allow(unused)]
3950-
</span><span class="boring">fn main() {
3951-
</span>use std::cell::OnceCell;
3948+
<p><a href="https://doc.rust-lang.org/stable/std/cell/struct.OnceCell.html"><code>OnceCell</code></a> is included in the standard library as an alternative.</p>
3949+
<pre><pre class="playground"><code class="language-rust edition2021">use std::cell::OnceCell;
39523950

3953-
let cell = OnceCell::new();
3954-
assert!(cell.get().is_none());
3951+
fn main() {
3952+
let cell = OnceCell::new();
3953+
assert!(cell.get().is_none());
39553954

3956-
let value: &amp;String = cell.get_or_init(|| {
3957-
"Hello, World!".to_string()
3958-
});
3959-
assert_eq!(value, "Hello, World!");
3960-
assert!(cell.get().is_some());
3961-
<span class="boring">}</span></code></pre></pre>
3955+
let value: &amp;String = cell.get_or_init(|| {
3956+
"Hello, World!".to_string()
3957+
});
3958+
assert_eq!(value, "Hello, World!");
3959+
assert!(cell.get().is_some());
3960+
}</code></pre></pre>
39623961
<!--
39633962
Links, in a few categories. Follow the existing structure.
39643963
Keep lines sorted.

searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

searchindex.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)