Area Trait
Define a trait Area with a method area(&self) -> f64. Implement it for a Circle struct (with field radius: f64). Use the formula 3.14159 * radius * radius. Print the area of a circle with radius 5.0.
Expected output:
text
Area: 78.53975
Hints:
trait Area { fn area(&self) -> f64; }struct Circle { radius: f64 }- Multiply:
3.14159 * self.radius * self.radius
rust
fn main() {
}