mirror of https://github.com/KaiserY/trpl-zh-cn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
365 B
20 lines
365 B
3 years ago
|
fn main() {
|
||
|
enum Message {
|
||
|
Quit,
|
||
|
Move { x: i32, y: i32 },
|
||
|
Write(String),
|
||
|
ChangeColor(i32, i32, i32),
|
||
|
}
|
||
|
|
||
|
// ANCHOR: here
|
||
|
impl Message {
|
||
|
fn call(&self) {
|
||
|
// method body would be defined here
|
||
|
}
|
||
|
}
|
||
|
|
||
|
let m = Message::Write(String::from("hello"));
|
||
|
m.call();
|
||
|
// ANCHOR_END: here
|
||
|
}
|