wolfrpg_map_parser/command/input_key_command/input_key/
key_options.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#[cfg(feature = "serde")]
use serde::{Serialize, Deserialize};

#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(PartialEq)]
pub struct KeyOptions {
    wait_for_input: bool
}

impl KeyOptions {
    pub fn new(options: u8) -> Self {
        Self {
            wait_for_input: options & 0b10000000 != 0
        }
    }

    pub fn wait_for_input(&self) -> bool {
        self.wait_for_input
    }

    pub fn wait_for_input_mut(&mut self) -> &mut bool {
        &mut self.wait_for_input
    }
}