1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-03-20 14:31:15 +02:00

15 lines
352 B
Rust
Raw Normal View History

2022-12-21 16:36:30 +01:00
struct Foo {
x: (u32, u32),
y: u32,
}
#[rustfmt::skip]
fn main() {
let foo = Foo { x: (1, 2), y: 3 };
match foo {
Foo { x: (1, b), y } => println!("x.0 = 1, b = {b}, y = {y}"),
Foo { y: 2, x: i } => println!("y = 2, x = {i:?}"),
2022-12-21 16:36:30 +01:00
Foo { y, .. } => println!("y = {y}, other fields were ignored"),
}
}