pub struct GlobalCtx<S, G = ()> { /* private fields */ }Expand description
Global name table: maps names → dense GlobalVarId, stores (sort, eclass) per id.
Implementations§
Source§impl<S: Copy, G: Copy> GlobalCtx<S, G>
impl<S: Copy, G: Copy> GlobalCtx<S, G>
pub fn new() -> Self
pub fn insert(&mut self, name: String, sort: S, eclass: G) -> GlobalVarId
Sourcepub fn get(&self, name: &str) -> Option<(GlobalVarId, S, G)>
pub fn get(&self, name: &str) -> Option<(GlobalVarId, S, G)>
Resolver lookup: name → (GlobalVarId, sort, eclass).
Sourcepub fn binding(&self, gid: GlobalVarId) -> G
pub fn binding(&self, gid: GlobalVarId) -> G
Runtime: resolve a GlobalVarId to its bound eclass.
Sourcepub fn sort(&self, gid: GlobalVarId) -> S
pub fn sort(&self, gid: GlobalVarId) -> S
Compile-time: resolve a GlobalVarId to its sort.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn truncate(&mut self, n: usize)
Source§impl<S: Copy> GlobalCtx<S, ()>
impl<S: Copy> GlobalCtx<S, ()>
Sourcepub fn insert_sort(&mut self, name: String, sort: S) -> GlobalVarId
pub fn insert_sort(&mut self, name: String, sort: S) -> GlobalVarId
Convenience for tests: insert with no eclass binding.
Trait Implementations§
Auto Trait Implementations§
impl<S, G> Freeze for GlobalCtx<S, G>
impl<S, G> RefUnwindSafe for GlobalCtx<S, G>
impl<S, G> Send for GlobalCtx<S, G>
impl<S, G> Sync for GlobalCtx<S, G>
impl<S, G> Unpin for GlobalCtx<S, G>
impl<S, G> UnsafeUnpin for GlobalCtx<S, G>
impl<S, G> UnwindSafe for GlobalCtx<S, G>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more