mirror of
https://github.com/rust-unofficial/patterns
synced 2024-11-18 15:25:37 +00:00
deploy: c7be15d387
This commit is contained in:
parent
7df5d56249
commit
c2345a93fe
@ -188,9 +188,9 @@ fn main() {
|
||||
}
|
||||
</code></pre></pre>
|
||||
<p>This works fine because we are passing a <code>&String</code> type as a parameter.
|
||||
If we comment in the last two lines this example fails because a <code>&str</code> type
|
||||
will not coerce to a <code>&String</code> type. We can fix this by simply modifying the
|
||||
type for our argument.</p>
|
||||
If we remove the comments on the last two lines, the example will fail. This
|
||||
is because a <code>&str</code> type will not coerce to a <code>&String</code> type. We can fix this
|
||||
by simply modifying the type for our argument.</p>
|
||||
<p>For instance, if we change our function declaration to:</p>
|
||||
<pre><code class="language-rust ignore">fn three_vowels(word: &str) -> bool {
|
||||
</code></pre>
|
||||
|
@ -245,9 +245,9 @@ fn main() {
|
||||
}
|
||||
</code></pre></pre>
|
||||
<p>This works fine because we are passing a <code>&String</code> type as a parameter.
|
||||
If we comment in the last two lines this example fails because a <code>&str</code> type
|
||||
will not coerce to a <code>&String</code> type. We can fix this by simply modifying the
|
||||
type for our argument.</p>
|
||||
If we remove the comments on the last two lines, the example will fail. This
|
||||
is because a <code>&str</code> type will not coerce to a <code>&String</code> type. We can fix this
|
||||
by simply modifying the type for our argument.</p>
|
||||
<p>For instance, if we change our function declaration to:</p>
|
||||
<pre><code class="language-rust ignore">fn three_vowels(word: &str) -> bool {
|
||||
</code></pre>
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user