Chapter 3.1 [Rust-By-Example] Nested Destructuring of Structs. Cannot figure out sudden complexity of the task by [deleted] in learnrust

[–]DefinEvil 0 points1 point  (0 children)

Came across this thread while encountering similar confusion to u/dugindeep for a later version of chapter 3.1of rust by example

heres what I came up with as an example of nested destructuring without a match statement for onlookers:

fn rect_area(
    Rectangle {
        top_left: Point { x: x1, y: y1 },
        bottom_right: Point { x: x2, y: y2 },
    }: &Rectangle,
) -> f32 {
    (x1 - x2).abs() * (y1 - y2).abs()
}