面试题答案
一键面试struct Point {
x: i32,
y: i32,
}
struct Rectangle {
top_left: Point,
bottom_right: Point,
}
fn sum_coordinates(rect: Rectangle) -> i32 {
match rect {
Rectangle {
top_left: Point { x: top_left_x, .. },
bottom_right: Point { y: bottom_right_y, .. },
} => top_left_x + bottom_right_y,
}
}