hax_rust_engine/ast/
identifiers.rs1use crate::symbol::Symbol;
8use hax_rust_engine_macros::*;
9use std::fmt;
10
11pub mod global_id;
12#[derive_group_for_ast]
14pub struct LocalId(pub Symbol);
15
16impl LocalId {
17 pub fn is_self(&self) -> bool {
19 self.0.as_ref() == "self"
20 }
21}
22
23impl fmt::Display for LocalId {
24 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
25 write!(f, "{}", self.0)
26 }
27}
28impl From<&hax_frontend_exporter::LocalIdent> for LocalId {
29 fn from(value: &hax_frontend_exporter::LocalIdent) -> Self {
30 Self(Symbol::new(&value.name))
31 }
32}
33impl From<&str> for LocalId {
34 fn from(name: &str) -> Self {
35 Self(Symbol::new(name))
36 }
37}
38
39pub use global_id::GlobalId;