wolfrpg_map_parser/command/db_management_command/
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
25
26
27
28
29
30
31
32
33
34
35
#[cfg(feature = "serde")]
use serde::Serialize;
use crate::command::db_management_command::db_type::DBType;
use crate::command::db_management_command::db_operation_type::DBOperationType;

#[cfg_attr(feature = "serde", derive(Serialize))]
pub struct Options {
    db_type: DBType,
    db_operation_type: DBOperationType
}

impl Options {
    pub fn new(options: u8) -> Self {
        Self {
            db_type: DBType::new(options & 0x0f),
            db_operation_type: DBOperationType::new(options >> 4),
        }
    }

    pub fn db_type(&self) -> &DBType {
        &self.db_type
    }

    pub fn db_type_mut(&mut self) -> &mut DBType {
        &mut self.db_type
    }

    pub fn db_operation_type(&self) -> &DBOperationType {
        &self.db_operation_type
    }

    pub fn db_operation_type_mut(&mut self) -> &mut DBOperationType {
        &mut self.db_operation_type
    }
}