Rust provides a special kind of struct known as a tuple struct. Unlike a regular struct with named fields, a tuple struct groups fields together without names, making it useful for lightweight structures where naming each field isn't necessary.
A tuple struct looks like this:
You can create an instance of a tuple struct just like you would with a tuple and access its fields using dot notation.
Your task is to define a tuple struct called Rectangle
with two fields:
f32
.f32
.Then, implement a function area
that calculates and returns the area of the rectangle by multiplying its width and height.
Here's how your code will be tested:
If you get stuck, consider these hints:
rect.0
for width and rect.1
for height).