aoe_djin/dat/
common.rs

1use std::fmt;
2
3#[derive(Protocol, Debug, Clone)]
4pub struct DeString {
5    _delimiter: u16,
6    len: u16,
7    #[protocol(length_prefix(elements("len")))]
8    pub content: String,
9}
10
11impl fmt::Display for DeString {
12    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13        write!(f, "{}", self.content)
14    }
15}
16
17impl PartialEq for DeString {
18    fn eq(&self, other: &Self) -> bool {
19        self.content == other.content
20            && self.len == other.len
21            && self._delimiter == other._delimiter
22    }
23}
24
25impl PartialEq<&str> for DeString {
26    fn eq(&self, other: &&str) -> bool {
27        &self.content == other
28    }
29}
30
31impl PartialEq<String> for DeString {
32    fn eq(&self, other: &String) -> bool {
33        &self.content == other
34    }
35}