wolfrpg_map_parser/command/
show_text_command.rs1use crate::byte_utils::parse_string;
2#[cfg(feature = "serde")]
3use serde::{Serialize, Deserialize};
4
5#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
6#[derive(PartialEq, Clone)]
7pub struct ShowTextCommand {
8 text: String
9}
10
11impl ShowTextCommand {
12 pub(crate) fn parse(bytes: &[u8]) -> (usize, Self) {
13 let mut offset: usize = 0;
14 offset += 2; let (bytes_read, text): (usize, String) = parse_string(&bytes[offset..]);
17 offset += bytes_read;
18
19 offset += 1; (offset, Self {
22 text
23 })
24 }
25
26 pub fn text(&self) -> &str {
27 &self.text
28 }
29
30 pub fn text_mut(&mut self) -> &mut String {
31 &mut self.text
32 }
33}