pub struct Interner { /* private fields */ }Expand description
Node-id interner. to_id is the single place id Strings live.
Implementations§
Source§impl Interner
impl Interner
pub fn new() -> Self
pub fn intern(&mut self, id: &str) -> NodeIndex
pub fn get(&self, id: &str) -> Option<NodeIndex>
Sourcepub fn resolve(&self, ix: NodeIndex) -> &str
pub fn resolve(&self, ix: NodeIndex) -> &str
Resolve an index back to its id string.
§Panics
Panics if ix did not come from this interner’s intern/get.
Indices are dense and append-only within one Interner instance;
they are not portable across instances, and an out-of-range index
panics rather than silently returning a wrong or empty string.
Sourcepub fn kind(&self, ix: NodeIndex) -> IdKind
pub fn kind(&self, ix: NodeIndex) -> IdKind
Look up the kind classified for ix at intern time.
§Panics
Panics if ix did not come from this interner’s intern/get —
see Interner::resolve.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Interner
impl RefUnwindSafe for Interner
impl Send for Interner
impl Sync for Interner
impl Unpin for Interner
impl UnsafeUnpin for Interner
impl UnwindSafe for Interner
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