In tuple structs, the fields are not named but indexed.
As an example, here is a Color tuple struct that defines an RGB color
on 8-bit values. The declaration uses parenthesis instead of curly
braces:
struct Color(u8, u8, u8);For defining an instance we use also parenthesis and specify the values in the order of definition:
let yellow = Color(0xff, 0xff, 0);To access values from an instance, we use integer indices:
println!("red={}, green={}, blue={}", yellow.0, yellow.1, yellow.2);red=255, green=255, blue=0