rebuild pages at 830db27

This commit is contained in:
Steve Klabnik
2016-07-30 20:45:16 +00:00
parent e0a0d4c510
commit c981fc3559
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -222,7 +222,7 @@ reference. Yet, we needed a <code>&amp;</code> for <code>p2</code> but not <code
<p>This feature is called ‘automatic referencing’, and calling methods is one
of the few places in Rust that has behavior like this. Here’s how it works:
when you call a method with <code>self.(</code>, Rust will automatically add in <code>&amp;</code>s
or <code>&amp;mut</code>s to match the signature. In other words, these are the same:</p>
or <code>&amp;mut</code>s to match the signature. In other words, these three are the same:</p>
<pre><code class="language-rust"># #[derive(Debug,Copy,Clone)]
# struct Point {
# x: f64,
@@ -241,6 +241,7 @@ or <code>&amp;mut</code>s to match the signature. In other words, these are the
# let p2 = Point { x: 5.0, y: 6.5 };
p1.distance(&amp;p2);
(&amp;p1).distance(&amp;p2);
Point::distance(&amp;p1, &amp;p2);
</code></pre>
<p>The first one looks much, much cleaner. Here’s another example:</p>
<pre><code class="language-rust">let mut s = String::from(&quot;Hello,&quot;);
+2 -1
View File
@@ -2950,7 +2950,7 @@ reference. Yet, we needed a <code>&amp;</code> for <code>p2</code> but not <code
<p>This feature is called ‘automatic referencing’, and calling methods is one
of the few places in Rust that has behavior like this. Here’s how it works:
when you call a method with <code>self.(</code>, Rust will automatically add in <code>&amp;</code>s
or <code>&amp;mut</code>s to match the signature. In other words, these are the same:</p>
or <code>&amp;mut</code>s to match the signature. In other words, these three are the same:</p>
<pre><code class="language-rust"># #[derive(Debug,Copy,Clone)]
# struct Point {
# x: f64,
@@ -2969,6 +2969,7 @@ or <code>&amp;mut</code>s to match the signature. In other words, these are the
# let p2 = Point { x: 5.0, y: 6.5 };
p1.distance(&amp;p2);
(&amp;p1).distance(&amp;p2);
Point::distance(&amp;p1, &amp;p2);
</code></pre>
<p>The first one looks much, much cleaner. Here’s another example:</p>
<pre><code class="language-rust">let mut s = String::from(&quot;Hello,&quot;);