hax_rust_engine/
symbol.rs1use std::ops::Deref;
7
8use hax_rust_engine_macros::*;
9
10#[derive_group_for_ast]
12pub struct Symbol(String);
13
14impl Symbol {
15 pub fn new(s: impl AsRef<str>) -> Self {
17 Self(s.as_ref().to_string())
18 }
19}
20
21impl Deref for Symbol {
22 type Target = str;
23
24 fn deref(&self) -> &Self::Target {
25 &self.0
26 }
27}
28
29impl AsRef<str> for Symbol {
30 fn as_ref(&self) -> &str {
31 &self.0
32 }
33}
34
35impl std::fmt::Display for Symbol {
36 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
37 write!(f, "{}", self.0)
38 }
39}