1#[derive(Clone, Debug, Eq, PartialEq)]
3pub struct Xstr {
4 type_name: String,
5 value: String,
6}
7
8impl Xstr {
9 pub fn new(type_name: String, value: String) -> Self {
17 Self { type_name, value }
18 }
19
20 pub fn type_name(&self) -> &str {
21 &self.type_name
22 }
23
24 pub fn value(&self) -> &str {
25 &self.value
26 }
27
28 pub fn to_axon_code(&self) -> String {
30 format!("xstr(\"{}\", \"{}\")", self.type_name(), self.value())
31 }
32}
33
34impl std::fmt::Display for Xstr {
35 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
36 write!(f, "{}(\"{}\")", self.type_name(), self.value())
37 }
38}