struct Point { x: f64, y: f64, } let p = Point { x: 0.0, y: 5.0 }; // vvvvvvvvv--- you can bind the value to a custom name like this let Point { x, y: height } = p; println!("{x}, {height}"); // will print "0.0, 5.0"
struct Point { x: f64, y: f64, } let p = Point { x: 0.0, y: 5.0 }; // vvvvvvvvv--- you can bind the value to a custom name like this let Point { x, y: height } = p; println!("{x}, {height}"); // will print "0.0, 5.0"