mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-23 04:29:41 +00:00
slice.md, fixed gramatical error
If you want know more -> If you want to know more
This commit is contained in:
@ -85,7 +85,7 @@ fn main() {
|
|||||||
let mut s = String::from("hello world");
|
let mut s = String::from("hello world");
|
||||||
|
|
||||||
// Here, &s is `&String` type, but `first_word` need a `&str` type.
|
// Here, &s is `&String` type, but `first_word` need a `&str` type.
|
||||||
// It works because `&String` can be implicitly converted to `&str. If you want know more, this is called `Deref coercion`.
|
// It works because `&String` can be implicitly converted to `&str. If you want to know more, this is called `Deref coercion`.
|
||||||
let word = first_word(&s);
|
let word = first_word(&s);
|
||||||
|
|
||||||
s.clear(); // error!
|
s.clear(); // error!
|
||||||
|
Reference in New Issue
Block a user