1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#[derive(Clone, Copy)] #[derive(Debug)] #[derive(Default)] pub struct BarState { pub show: bool, pub percent: f64, } impl BarState { pub fn close(&mut self) { self.show = false; } pub fn update(&mut self, percent: f64) { self.percent = percent; } }