2019-05-25 05:42:34 -05:00
|
|
|
|
|
|
|
<style>
|
2019-05-25 09:23:58 -05:00
|
|
|
body { margin: 0; }
|
|
|
|
pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; }
|
2019-05-25 05:42:34 -05:00
|
|
|
|
|
|
|
.comment { color: #7F9F7F; }
|
|
|
|
.string { color: #CC9393; }
|
|
|
|
.function { color: #93E0E3; }
|
|
|
|
.parameter { color: #94BFF3; }
|
|
|
|
.builtin { color: #DD6718; }
|
|
|
|
.text { color: #DCDCCC; }
|
|
|
|
.attribute { color: #BFEBBF; }
|
|
|
|
.literal { color: #DFAF8F; }
|
|
|
|
.macro { color: #DFAF8F; }
|
|
|
|
|
|
|
|
.keyword { color: #F0DFAF; }
|
|
|
|
.keyword\.unsafe { color: #F0DFAF; font-weight: bold; }
|
|
|
|
.keyword\.control { color: #DC8CC3; }
|
|
|
|
</style>
|
2019-05-25 09:23:58 -05:00
|
|
|
<pre><code><span class="attribute">#</span><span class="attribute">[</span><span class="attribute">derive</span><span class="attribute">(</span><span class="attribute">Clone</span><span class="attribute">,</span><span class="attribute"> </span><span class="attribute">Debug</span><span class="attribute">)</span><span class="attribute">]</span>
|
2019-05-25 05:42:34 -05:00
|
|
|
<span class="keyword">struct</span> <span class="function">Foo</span> {
|
2019-05-25 09:29:39 -05:00
|
|
|
<span class="keyword">pub</span> <span class="function">x</span>: <span class="text">i32</span>,
|
|
|
|
<span class="keyword">pub</span> <span class="function">y</span>: <span class="text">i32</span>,
|
2019-05-25 05:42:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
<span class="keyword">fn</span> <span class="function">foo</span><<span class="type function">T</span>>() -> <span class="type">T</span> {
|
|
|
|
<span class="macro">unimplemented</span><span class="macro">!</span>();
|
|
|
|
}
|
|
|
|
|
|
|
|
<span class="comment">// comment</span>
|
|
|
|
<span class="keyword">fn</span> <span class="function">main</span>() {
|
|
|
|
<span class="macro">println</span><span class="macro">!</span>(<span class="string">"Hello, {}!"</span>, <span class="literal">92</span>);
|
|
|
|
|
2019-05-25 09:23:58 -05:00
|
|
|
<span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable" data-binding-hash="9636295041291189729" style="color: hsl(51,57%,74%);">vec</span> = <span class="text">Vec</span>::<span class="text">new</span>();
|
2019-05-25 05:42:34 -05:00
|
|
|
<span class="keyword.control">if</span> <span class="keyword">true</span> {
|
2019-05-25 09:29:39 -05:00
|
|
|
<span class="variable" data-binding-hash="8496027264380925433" style="color: hsl(18,48%,55%);">vec</span>.<span class="text">push</span>(<span class="type">Foo</span> { <span class="field">x</span>: <span class="literal">0</span>, <span class="field">y</span>: <span class="literal">1</span> });
|
2019-05-25 05:42:34 -05:00
|
|
|
}
|
2019-05-25 09:23:58 -05:00
|
|
|
<span class="keyword.unsafe">unsafe</span> { <span class="variable" data-binding-hash="8496027264380925433" style="color: hsl(18,48%,55%);">vec</span>.<span class="text">set_len</span>(<span class="literal">0</span>); }
|
|
|
|
}</code></pre>
|