Improve E0599 explanation
This commit is contained in:
parent
97f3eeec82
commit
e9ae64cca7
1 changed files with 15 additions and 0 deletions
|
@ -9,3 +9,18 @@ let x = Mouth;
|
|||
x.chocolate(); // error: no method named `chocolate` found for type `Mouth`
|
||||
// in the current scope
|
||||
```
|
||||
|
||||
In this case, you need to implement the `chocolate` method to fix the error:
|
||||
|
||||
```
|
||||
struct Mouth;
|
||||
|
||||
impl Mouth {
|
||||
fn chocolate(&self) { // We implement the `chocolate` method here.
|
||||
println!("Hmmm! I love chocolate!");
|
||||
}
|
||||
}
|
||||
|
||||
let x = Mouth;
|
||||
x.chocolate(); // ok!
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue