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]
15pub struct LocalId(pub Symbol);
16
17impl LocalId {
18 pub fn is_self(&self) -> bool {
20 self.0.as_ref() == "self"
21 }
22}
23
24impl fmt::Display for LocalId {
25 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26 write!(f, "{}", self.0)
27 }
28}
29impl From<&hax_frontend_exporter::LocalIdent> for LocalId {
30 fn from(value: &hax_frontend_exporter::LocalIdent) -> Self {
31 Self(Symbol::new(&value.name))
32 }
33}
34impl From<&str> for LocalId {
35 fn from(name: &str) -> Self {
36 Self(Symbol::new(name))
37 }
38}
39
40pub use global_id::GlobalId;