最佳答案
struct Point {
x: f64,
y: f64,
}
enum Shape {
Circle(Point, f64),
Rectangle(Point, Point),
}
let my_shape = Shape::Circle(Point { x: 0.0, y: 0.0 }, 10.0);
I want to print out circle
's second property, which is 10.0 here.
I tried my_shape.last
and my_shape.second
, but neither worked.
What should I do in order to print out 10.0 in this case?