wolfrpg_map_parser/command/string_condition_command/
condition.rs

1#[cfg(feature = "serde")]
2use serde::{Serialize, Deserialize};
3use crate::common::u32_or_string::U32OrString;
4use crate::command::string_condition_command::operator::Operator;
5
6#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
7#[derive(PartialEq, Clone)]
8pub struct Condition {
9    variable: u32,
10    operator: Operator,
11    value: U32OrString
12}
13
14impl Condition {
15    pub fn new(variable: u32, operator: Operator, value: U32OrString) -> Condition {
16        Condition {
17            variable,
18            operator,
19            value
20        }
21    }
22
23    pub fn variable(&self) -> u32 {
24        self.variable
25    }
26
27    pub fn variable_mut(&mut self) -> &mut u32 {
28        &mut self.variable
29    }
30
31    pub fn operator(&self) -> &Operator {
32        &self.operator
33    }
34
35    pub fn operator_mut(&mut self) -> &mut Operator {
36        &mut self.operator
37    }
38
39    pub fn value(&self) -> &U32OrString {
40        &self.value
41    }
42
43    pub fn value_mut(&mut self) -> &mut U32OrString {
44        &mut self.value
45    }
46}