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

@ -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> child: { name: String, unsafety: <span style=color:#66d9ef>bool</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>}
</span></span><span style=display:flex><span>