wolfrpg_map_parser/command/
common_event_command.rs1#[cfg(feature = "serde")]
2use serde::{Serialize, Deserialize};
3use crate::command::common_event_command::event::Event;
4
5pub mod event;
6pub mod argument_count;
7pub mod options;
8
9#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
10#[derive(PartialEq, Clone)]
11pub enum CommonEventCommand {
12 CallEvent(Event),
13 ReserveEvent(Event)
14}
15
16impl CommonEventCommand {
17 pub(crate) fn parse_call_event(bytes: &[u8]) -> (usize, Self) {
18 let (bytes_read, command): (usize, Event) = Event::parse(bytes);
19
20 (bytes_read, Self::CallEvent(command))
21 }
22
23 pub(crate) fn parse_reserve_event(bytes: &[u8]) -> (usize, Self) {
24 let (bytes_read, command): (usize, Event) = Event::parse(bytes);
25
26 (bytes_read, Self::ReserveEvent(command))
27 }
28}