This commit is contained in:
Nilstrieb 2023-03-17 16:23:44 +00:00
parent c457ac16c5
commit 773df37ae8
5 changed files with 5 additions and 5 deletions

View file

@ -92,7 +92,7 @@ So far we’ve just used tuples. But we can go even further. Structs of
</span></span><span style="display:flex;"><span> child: { name: String, unsafety: <span style="color:#66d9ef">bool</span> }, </span></span><span style="display:flex;"><span> child: { name: String, unsafety: <span style="color:#66d9ef">bool</span> },
</span></span><span style="display:flex;"><span>}; </span></span><span style="display:flex;"><span>};
</span></span></code></pre></div><p>Now we can nicely match on the <code>Household</code> struct containing the definition of the <code>Ferris</code> and <code>Corro</code> structs. This is equivalent to the following code:</p> </span></span></code></pre></div><p>Now we can nicely match on the <code>Household</code> struct containing the definition of the <code>Ferris</code> and <code>Corro</code> structs. This is equivalent to the following code:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-rust" data-lang="rust"><span style="display:flex;"><span><span style="color:#66d9ef">struct</span> <span style="color:#a6e22e">Feris</span> { <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-rust" data-lang="rust"><span style="display:flex;"><span><span style="color:#66d9ef">struct</span> <span style="color:#a6e22e">Ferris</span> {
</span></span><span style="display:flex;"><span> name: String, </span></span><span style="display:flex;"><span> name: String,
</span></span><span style="display:flex;"><span>} </span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span>

View file

@ -92,7 +92,7 @@ So far we’ve just used tuples. But we can go even further. Structs of
</span></span><span style="display:flex;"><span> child: { name: String, unsafety: <span style="color:#66d9ef">bool</span> }, </span></span><span style="display:flex;"><span> child: { name: String, unsafety: <span style="color:#66d9ef">bool</span> },
</span></span><span style="display:flex;"><span>}; </span></span><span style="display:flex;"><span>};
</span></span></code></pre></div><p>Now we can nicely match on the <code>Household</code> struct containing the definition of the <code>Ferris</code> and <code>Corro</code> structs. This is equivalent to the following code:</p> </span></span></code></pre></div><p>Now we can nicely match on the <code>Household</code> struct containing the definition of the <code>Ferris</code> and <code>Corro</code> structs. This is equivalent to the following code:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-rust" data-lang="rust"><span style="display:flex;"><span><span style="color:#66d9ef">struct</span> <span style="color:#a6e22e">Feris</span> { <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-rust" data-lang="rust"><span style="display:flex;"><span><span style="color:#66d9ef">struct</span> <span style="color:#a6e22e">Ferris</span> {
</span></span><span style="display:flex;"><span> name: String, </span></span><span style="display:flex;"><span> name: String,
</span></span><span style="display:flex;"><span>} </span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span>

View file

@ -66,7 +66,7 @@ So far we’ve just used tuples. But we can go even further. Structs of stru
</span></span><span style=display:flex><span> parent: { name: String }, </span></span><span style=display:flex><span> parent: { name: String },
</span></span><span style=display:flex><span> child: { name: String, unsafety: <span style=color:#66d9ef>bool</span> }, </span></span><span style=display:flex><span> child: { name: String, unsafety: <span style=color:#66d9ef>bool</span> },
</span></span><span style=display:flex><span>}; </span></span><span style=display:flex><span>};
</span></span></code></pre></div><p>Now we can nicely match on the <code>Household</code> struct containing the definition of the <code>Ferris</code> and <code>Corro</code> structs. This is equivalent to the following code:</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-rust data-lang=rust><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>Feris</span> { </span></span></code></pre></div><p>Now we can nicely match on the <code>Household</code> struct containing the definition of the <code>Ferris</code> and <code>Corro</code> structs. This is equivalent to the following code:</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-rust data-lang=rust><span style=display:flex><span><span style=color:#66d9ef>struct</span> <span style=color:#a6e22e>Ferris</span> {
</span></span><span style=display:flex><span> name: String, </span></span><span style=display:flex><span> name: String,
</span></span><span style=display:flex><span>} </span></span><span style=display:flex><span>}
</span></span><span style=display:flex><span> </span></span><span style=display:flex><span>

View file

@ -92,7 +92,7 @@ So far we&amp;rsquo;ve just used tuples. But we can go even further. Structs of
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> child: { name: String, unsafety: &lt;span style="color:#66d9ef">bool&lt;/span> }, &lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> child: { name: String, unsafety: &lt;span style="color:#66d9ef">bool&lt;/span> },
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}; &lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>};
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Now we can nicely match on the &lt;code>Household&lt;/code> struct containing the definition of the &lt;code>Ferris&lt;/code> and &lt;code>Corro&lt;/code> structs. This is equivalent to the following code:&lt;/p> &lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Now we can nicely match on the &lt;code>Household&lt;/code> struct containing the definition of the &lt;code>Ferris&lt;/code> and &lt;code>Corro&lt;/code> structs. This is equivalent to the following code:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-rust" data-lang="rust">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">struct&lt;/span> &lt;span style="color:#a6e22e">Feris&lt;/span> { &lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-rust" data-lang="rust">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">struct&lt;/span> &lt;span style="color:#a6e22e">Ferris&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> name: String, &lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> name: String,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>} &lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>

View file

@ -92,7 +92,7 @@ So far we&amp;rsquo;ve just used tuples. But we can go even further. Structs of
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> child: { name: String, unsafety: &lt;span style="color:#66d9ef">bool&lt;/span> }, &lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> child: { name: String, unsafety: &lt;span style="color:#66d9ef">bool&lt;/span> },
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}; &lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>};
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Now we can nicely match on the &lt;code>Household&lt;/code> struct containing the definition of the &lt;code>Ferris&lt;/code> and &lt;code>Corro&lt;/code> structs. This is equivalent to the following code:&lt;/p> &lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Now we can nicely match on the &lt;code>Household&lt;/code> struct containing the definition of the &lt;code>Ferris&lt;/code> and &lt;code>Corro&lt;/code> structs. This is equivalent to the following code:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-rust" data-lang="rust">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">struct&lt;/span> &lt;span style="color:#a6e22e">Feris&lt;/span> { &lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-rust" data-lang="rust">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">struct&lt;/span> &lt;span style="color:#a6e22e">Ferris&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> name: String, &lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> name: String,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>} &lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>