mirror of
https://github.com/Noratrieb/blog.git
synced 2026-01-14 20:35:02 +01:00
deploy: cb46b7fb71
This commit is contained in:
parent
c457ac16c5
commit
773df37ae8
5 changed files with 5 additions and 5 deletions
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue