wolfrpg_map_parser/command/set_variable_plus_command/
assignment.rs1#[cfg(feature = "serde")]
2use serde::{Serialize, Deserialize};
3use crate::command::set_variable_plus_command::assignment_operator::AssignmentOperator;
4use crate::command::set_variable_plus_command::variable_type::VariableType;
5
6#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
7#[derive(PartialEq, Clone)]
8pub struct Assignment {
9 operator: AssignmentOperator,
10 variable_type: VariableType
11}
12
13impl Assignment {
14 pub fn new(assignment: u8) -> Self {
15 Self {
16 operator: AssignmentOperator::new(assignment & 0x0f),
17 variable_type: VariableType::new(assignment >> 4)
18 }
19 }
20
21 pub fn operator(&self) -> &AssignmentOperator {
22 &self.operator
23 }
24
25 pub fn operator_mut(&mut self) -> &mut AssignmentOperator {
26 &mut self.operator
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}