As titled.
In Rust, I need to use period syntax to access the elements inside a tuple like below (the x.0):
fn main() {
let x: (i32, f64, u8) = (500, 6.4, 1);
println!("{}", x.0);
}
My question is why Rust does not support using a square bracket syntax to access the elements inside a tuple like below which should be a more consistent way?
fn main() {
// !!! this snippet of code would not be compiled !!!
let x: (i32, f64, u8) = (500, 6.4, 1);
println!("{}", x[0]); // pay attention to the use of "x[0]" here.
}