Complete the code to define a tuple struct named Color with three u8 fields.
struct Color([1]);The tuple struct Color has three u8 fields representing RGB values.
Complete the code to create an instance of the tuple struct Point with values 10 and 20.
let p = Point([1]);Point(10, 20) inside the parentheses again.To create an instance of a tuple struct, provide the values inside parentheses without extra syntax.
Fix the error in accessing the first field of the tuple struct instance c.
let red = c.[1];c.red which is invalid for tuple structs.Tuple struct fields are accessed by their index starting at 0.
Fill both blanks to define a tuple struct Rectangle with two f64 fields and create an instance with values 5.0 and 10.0.
struct Rectangle([1]); let rect = Rectangle([2]);
i32 instead of f64.The struct Rectangle has two f64 fields. The instance is created with 5.0 and 10.0.
Fill all three blanks to define a tuple struct Circle with a f64 radius, create an instance with radius 7.5, and access the radius field.
struct Circle([1]); let c = Circle([2]); let r = c.[3];
c.radius which is invalid.The tuple struct Circle has one f64 field. The instance is created with 7.5. The field is accessed by index 0.
