mirror of
https://github.com/RGBCube/cstree
synced 2025-07-27 09:07:44 +00:00
make NodeCache
's interner accessible
This commit is contained in:
parent
78e54d59db
commit
cc5ea59d4b
1 changed files with 21 additions and 0 deletions
|
@ -133,6 +133,27 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get a reference to the interner used to deduplicate source text (strings).
|
||||||
|
///
|
||||||
|
/// See also [`interner_mut`](NodeCache::interner_mut).
|
||||||
|
pub fn interner(&self) -> &I {
|
||||||
|
&*self.interner
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get a mutable reference to the interner used to deduplicate source text (strings).
|
||||||
|
/// # Examples
|
||||||
|
/// ```
|
||||||
|
/// # use cstree::*;
|
||||||
|
/// # use cstree::interning::*;
|
||||||
|
/// let mut cache = NodeCache::new();
|
||||||
|
/// let interner = cache.interner_mut();
|
||||||
|
/// let key = interner.get_or_intern("foo");
|
||||||
|
/// assert_eq!(interner.resolve(&key), "foo");
|
||||||
|
/// ```
|
||||||
|
pub fn interner_mut(&mut self) -> &mut I {
|
||||||
|
&mut *self.interner
|
||||||
|
}
|
||||||
|
|
||||||
/// If this node cache was constructed with [`new`](NodeCache::new) or
|
/// If this node cache was constructed with [`new`](NodeCache::new) or
|
||||||
/// [`from_interner`](NodeCache::from_interner), returns the interner used to deduplicate source
|
/// [`from_interner`](NodeCache::from_interner), returns the interner used to deduplicate source
|
||||||
/// text (strings) to allow resolving tree tokens back to text and re-using the interner to build
|
/// text (strings) to allow resolving tree tokens back to text and re-using the interner to build
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue