I’m playing with the following code and can’t seem to find an example where I can get the values of one of the coordinates.
enum Coordinates {
Point1 { x: i32, y: i32 },
Point2 { x: i32, y: i32 },
}
fn main() {
let p1 = Coordinates::Point1{ x: 0, y: 45};
let x = p1.x; //Doesn't work
}
How can I get the value of x or y?
Thanks! Yeah, I’m not actually trying to do anything useful with this code. Just testing out the concepts that I’m reading about.