Skip to content

Commit

Permalink
deploy: 534737f
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamschi committed Aug 29, 2023
1 parent 6965b70 commit a841f93
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions print.html
Original file line number Diff line number Diff line change
Expand Up @@ -830,11 +830,11 @@ <h2 id="child-component-instancing"><a class="header" href="#child-component-ins
}
<span class="boring">}
</span></code></pre></pre>
<pre><code class="language-html">I contain ()! My size is &lt;B&gt;0&lt;/B&gt; bytes. I'm located at address 0x559f637aa500.
I contain ()! My size is &lt;B&gt;0&lt;/B&gt; bytes. I'm located at address 0x559f637aa500.
I contain 1! My size is &lt;B&gt;1&lt;/B&gt; bytes. I'm located at address 0x559f637aa508.
I contain 2! My size is &lt;B&gt;8&lt;/B&gt; bytes. I'm located at address 0x559f637aa500.
The container instance occupies &lt;B&gt;16&lt;/B&gt; bytes at 0x559f637aa500.
<pre><code class="language-html">I contain ()! My size is &lt;B&gt;0&lt;/B&gt; bytes. I'm located at address 0x55907f620500.
I contain ()! My size is &lt;B&gt;0&lt;/B&gt; bytes. I'm located at address 0x55907f620500.
I contain 1! My size is &lt;B&gt;1&lt;/B&gt; bytes. I'm located at address 0x55907f620508.
I contain 2! My size is &lt;B&gt;8&lt;/B&gt; bytes. I'm located at address 0x55907f620500.
The container instance occupies &lt;B&gt;16&lt;/B&gt; bytes at 0x55907f620500.
</code></pre>
<p>The layout here is somewhat implementation-defined, but generally what you should see is that the <code>MySize::&lt;()&gt;</code> instances take up no space inside the <code>Container</code> instance and don't displace other children in memory.</p>
<p>This is because Asteracea components contain no hidden instance state, which means they are sized to content (and padding requirements), all the way down to zero. <code>()</code> is Rust's <a href="https://doc.rust-lang.org/stable/std/primitive.unit.html">unit</a> type, the most convenient <a href="https://doc.rust-lang.org/nomicon/exotic-sizes.html#zero-sized-types-zsts">zero sized type</a>. The same applies to components without instance fields, of course.</p>
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion searchindex.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions static_components/ex_stateless_components_are_zero-sized.html
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ <h1 id="ex-stateless-components-are-zero-sized"><a class="header" href="#ex-stat
}
<span class="boring">}
</span></code></pre></pre>
<pre><code class="language-html">I contain ()! My size is &lt;B&gt;0&lt;/B&gt; bytes. I'm located at address 0x559f637aa500.
I contain ()! My size is &lt;B&gt;0&lt;/B&gt; bytes. I'm located at address 0x559f637aa500.
I contain 1! My size is &lt;B&gt;1&lt;/B&gt; bytes. I'm located at address 0x559f637aa508.
I contain 2! My size is &lt;B&gt;8&lt;/B&gt; bytes. I'm located at address 0x559f637aa500.
The container instance occupies &lt;B&gt;16&lt;/B&gt; bytes at 0x559f637aa500.
<pre><code class="language-html">I contain ()! My size is &lt;B&gt;0&lt;/B&gt; bytes. I'm located at address 0x55907f620500.
I contain ()! My size is &lt;B&gt;0&lt;/B&gt; bytes. I'm located at address 0x55907f620500.
I contain 1! My size is &lt;B&gt;1&lt;/B&gt; bytes. I'm located at address 0x55907f620508.
I contain 2! My size is &lt;B&gt;8&lt;/B&gt; bytes. I'm located at address 0x55907f620500.
The container instance occupies &lt;B&gt;16&lt;/B&gt; bytes at 0x55907f620500.
</code></pre>
<p>The layout here is somewhat implementation-defined, but generally what you should see is that the <code>MySize::&lt;()&gt;</code> instances take up no space inside the <code>Container</code> instance and don't displace other children in memory.</p>
<p>This is because Asteracea components contain no hidden instance state, which means they are sized to content (and padding requirements), all the way down to zero. <code>()</code> is Rust's <a href="https://doc.rust-lang.org/stable/std/primitive.unit.html">unit</a> type, the most convenient <a href="https://doc.rust-lang.org/nomicon/exotic-sizes.html#zero-sized-types-zsts">zero sized type</a>. The same applies to components without instance fields, of course.</p>
Expand Down

0 comments on commit a841f93

Please sign in to comment.