trpl-zh-cn/listings/ch06-enums-and-pattern-matching/no-listing-04-structs-similar-to-message-enum/src/main.rs

12 lines
277 B
Rust
Raw Normal View History

2022-02-06 16:43:51 +08:00
// ANCHOR: here
struct QuitMessage; // unit struct
struct MoveMessage {
x: i32,
y: i32,
}
struct WriteMessage(String); // tuple struct
struct ChangeColorMessage(i32, i32, i32); // tuple struct
// ANCHOR_END: here
fn main() {}