You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-07-05 06:00:30 +02:00
Add direct call to talk
in trait implementation slide (#2787)
I think it'd be helpful to also show a direct call to `talk`, so that it's clear that both trait methods can be called directly.
This commit is contained in:
@ -22,6 +22,7 @@ impl Pet for Dog {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let fido = Dog { name: String::from("Fido"), age: 5 };
|
let fido = Dog { name: String::from("Fido"), age: 5 };
|
||||||
|
dbg!(fido.talk());
|
||||||
fido.greet();
|
fido.greet();
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user