wolfrpg_map_parser/command/input_key_command/input_key/
basic.rs

1use crate::command::input_key_command::input_key::basic_options::BasicOptions;
2#[cfg(feature = "serde")]
3use serde::{Serialize, Deserialize};
4
5#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
6#[derive(PartialEq, Clone)]
7pub struct Basic {
8    options: BasicOptions
9}
10
11impl Basic {
12    pub(crate) fn parse(bytes: &[u8]) -> (usize, Self) {
13        let mut offset: usize = 0;
14
15        let options: u8 = bytes[offset];
16        let options: BasicOptions = BasicOptions::new(options);
17        offset += 1;
18
19        offset += 1; // input_type
20
21        offset += 2; // Padding
22
23        (offset, Self {
24            options
25        })
26    }
27
28    pub fn options(&self) -> &BasicOptions {
29        &self.options
30    }
31
32    pub fn options_mut(&mut self) -> &mut BasicOptions {
33        &mut self.options
34    }
35}