wolfrpg_map_parser/command/common_event_command/
argument_count.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
#[cfg(feature = "serde")]
use serde::Serialize;

#[cfg_attr(feature = "serde", derive(Serialize))]
pub struct ArgumentCount {
    number_arguments: u8,
    string_arguments: u8
}

impl ArgumentCount {
    pub fn new(argument_count: u8) -> Self {
        Self {
            number_arguments: argument_count & 0x0f,
            string_arguments: argument_count >> 4,
        }
    }

    pub fn number_arguments(&self) -> u8 {
        self.number_arguments
    }

    pub fn number_arguments_mut(&mut self) -> &mut u8 {
        &mut self.number_arguments
    }

    pub fn string_arguments(&self) -> u8 {
        self.string_arguments
    }

    pub fn string_arguments_mut(&mut self) -> &mut u8 {
        &mut self.string_arguments
    }
}