#[derive(Debug)] enum Shape { Circle { r: f64 }, Rect { w: f64, h: f64 }, Dot } fn main() { let mut shapes: Vec = Vec::new(); shapes.push(Shape::Circle { r: 1.0 }); shapes.push(Shape::Rect { w: 2.0, h: 3.0 }); shapes.push(Shape::Dot); shapes[2] = Shape::Rect { w: 1.0, h: 1.0 }; assert!(matches!(shapes[2],Shape::Rect {w:1.0,h:1.0})); }