src/global/structs/status.rs

28 lines · 518 bytes

 1use typemap::Key;
 2
 3/// a struct for storing different info, currently only stores one info
 4#[derive(Clone)]
 5pub struct Status {
 6    pub popup_opened: bool,
 7    /// to prevent rerendering the same image
 8    pub render_image: bool,
 9}
10
11impl Key for Status {
12    type Value = Self;
13}
14
15impl Default for Status {
16    fn default() -> Self {
17        Self {
18            popup_opened: false,
19            render_image: true,
20        }
21    }
22}
23
24impl Status {
25    pub fn reset(&mut self) {
26        *self = Self::default();
27    }
28}