wolfrpg_map_parser/command/db_management_command/
options.rs1#[cfg(feature = "serde")]
2use serde::{Serialize, Deserialize};
3use crate::command::db_management_command::db_type::DBType;
4use crate::command::db_management_command::db_operation_type::DBOperationType;
5
6#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
7#[derive(PartialEq, Clone)]
8pub struct Options {
9 db_type: DBType,
10 db_operation_type: DBOperationType
11}
12
13impl Options {
14 pub fn new(options: u8) -> Self {
15 Self {
16 db_type: DBType::new(options & 0x0f),
17 db_operation_type: DBOperationType::new(options >> 4),
18 }
19 }
20
21 pub fn db_type(&self) -> &DBType {
22 &self.db_type
23 }
24
25 pub fn db_type_mut(&mut self) -> &mut DBType {
26 &mut self.db_type
27 }
28
29 pub fn db_operation_type(&self) -> &DBOperationType {
30 &self.db_operation_type
31 }
32
33 pub fn db_operation_type_mut(&mut self) -> &mut DBOperationType {
34 &mut self.db_operation_type
35 }
36}