Open Luro02 opened 4 years ago
enum Example { Variant1 { field: usize, }, Variant2 { field: usize, }, } impl Example { pub fn set_field(&mut self, value: usize) -> &mut Self { match &mut self { Self::Variant1 { field } | Self::Variant2 { field } => { field = value; } } self } }