<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Rust on Daniel Correia</title><link>https://danielcorreia.org/tags/rust/</link><description>Recent content in Rust on Daniel Correia</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 12 Sep 2023 10:52:47 +0200</lastBuildDate><atom:link href="https://danielcorreia.org/tags/rust/index.xml" rel="self" type="application/rss+xml"/><item><title>Ownership and Borrowing in Rust</title><link>https://danielcorreia.org/til/rust/ownership/</link><pubDate>Tue, 12 Sep 2023 10:52:47 +0200</pubDate><guid>https://danielcorreia.org/til/rust/ownership/</guid><description>&lt;h1 id="ownership-and-borrowing-in-rust"&gt;Ownership and Borrowing in Rust&lt;/h1&gt;
&lt;h2 id="ownership"&gt;Ownership&lt;/h2&gt;
&lt;p&gt;The Book&lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt; states the following as the three rules of ownership in Rust:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Each value in Rust has an owner.&lt;/li&gt;
&lt;li&gt;There can only be one owner at a time.&lt;/li&gt;
&lt;li&gt;When the owner goes out of scope, the value will be dropped.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Going out of scope essentially means coming to the end of the trailing curly brace &amp;lsquo;}&amp;rsquo; of the one in which a value was introduced in.&lt;/p&gt;</description></item></channel></rss>