Browse Source

Moved structs to another place

master
Julio Biason 6 years ago
parent
commit
be9e8af116
  1. 58
      porque-rust.html

58
porque-rust.html

@ -74,7 +74,7 @@
<div class="slides">
<section>
<section data-background="_images/rust-ferris.png" data-header>
<h1 class="semi-opaque">Porque Rust</h1>
<h2 class="semi-opaque">Porque Rust</h2>
</section>
</section>
@ -306,7 +306,9 @@ error[E0382]: borrow of moved value: `a`
5 | println!("{}", a)
| ^ value borrowed here after move
|
= note: move occurs because `a` has type `std::string::String`, which does not implement the `Copy` trait
= note: move occurs because `a` has type
`std::string::String`, which does not
implement the `Copy` trait
</code></pre>
<aside class="notes">
@ -354,6 +356,11 @@ fn main() {
Uma região de memória tem apenas um dono.
</p>
<p class="fragment">
Passar um valor (região de memória) de uma variável
para outra, troca o dono.
</p>
<p class="fragment">
A região é desalocada quando o dono sair de escopo.
</p>
@ -373,7 +380,7 @@ fn main() {
<h3>Regras do Borrow Checker</h3>
<p class="fragment">
Uma região de memória pode ter inifitas referências.
Uma região de memória pode ter infinitas referências.
</p>
<p class="fragment">
@ -533,23 +540,6 @@ presente.abrir()</code></pre>
<section>
<section>
<h2>Tipos Algébricos</h2>
<p class="fragment">(structs)</p>
</section>
<section>
<h3>struct</h3>
<pre><code class="hljs rust" data-trim>
struct Present {
package_color: String,
content: String
}
</code></pre>
<aside class="notes">
</aside>
</section>
<section>
@ -684,6 +674,23 @@ OK(())
</section>
</section>
<section>
<h2>Structs</h2>
<section>
<pre><code class="hljs rust" data-trim>
struct Present {
package_color: String,
content: String
}
</code></pre>
<aside class="notes">
Structs em Rust são basicamente o mesmo que em C.
</aside>
</section>
</section>
<section>
<section>
<h2>Traits/Generics</h2>
@ -729,6 +736,17 @@ fn get_summary(summarizable: T) -&gt; String
where T: Summary
{
...
}
</code></pre>
</section>
<section>
<h2>Structs genéricas</h2>
<pre><code class="hljs rust" data-trim>
struct Point<T> {
x: T,
y: T
}
</code></pre>
</section>

Loading…
Cancel
Save