mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-06-12 20:37:32 +02:00
Reorder struct pattern examples (#2749)
I generally like to start with that second case since imo it's the simplest one before going on to the case that uses a tuple sub-pattern to break up the `x` field.
This commit is contained in:
parent
77b201c4cb
commit
dbd1a09031
@ -7,8 +7,8 @@ struct Foo {
|
||||
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:?}"),
|
||||
Foo { x: (1, b), y } => println!("x.0 = 1, b = {b}, y = {y}"),
|
||||
Foo { y, .. } => println!("y = {y}, other fields were ignored"),
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user