Merge pull request #110 from kumakichi/master

remove extra colon
This commit is contained in:
Dhghomon 2021-02-02 01:06:38 +09:00 committed by GitHub
commit 2453acdc22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7779,7 +7779,7 @@ Imagine that you have a function that returns `Cow<'static, str>`. If you tell t
And if you give it a `format!("{}", "My message").into()` then it will look at the type. This time it is a `String`, because `format!` makes a `String`. So this time it will select "Owned". And if you give it a `format!("{}", "My message").into()` then it will look at the type. This time it is a `String`, because `format!` makes a `String`. So this time it will select "Owned".
Here is an example to test `Cow`. We will put a number into a function that returns a `Cow<'static, str>`. Depending on the number, it will create a `&str` or a `String`. Then it uses `.into()` to turn it into a `Cow`. When you do that, it will choose either `Cow:::Borrowed` or `Cow::Owned`. Then we will match to see which one it chose. Here is an example to test `Cow`. We will put a number into a function that returns a `Cow<'static, str>`. Depending on the number, it will create a `&str` or a `String`. Then it uses `.into()` to turn it into a `Cow`. When you do that, it will choose either `Cow::Borrowed` or `Cow::Owned`. Then we will match to see which one it chose.
```rust ```rust
use std::borrow::Cow; use std::borrow::Cow;