mod shapes; use shapes::{Rectangle, Shape, Triangle}; fn main() { let shape = create_shape(); let area = match shape { Shape::Rectangle(rectangle) => rectangle.width * rectangle.height, Shape::Triangle(triangle) => triangle.width * triangle.height / 2, }; } fn create_shape() -> Shape { Shape::Rectangle(Rectangle { width: 10, height: 25 }) }