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