Hello, for our use case, we have an initial population of a StringInterner with values, and then there is a long period in which only symbol resolution is needed. To reduce memory usage during the second period, we'd like to be able to resolve interned symbols without the additional memory overhead for interning new strings.
I propose to add a new struct, which will only allow to resolve strings from a given backend
pub struct StringResolver<B>
{
backend: B,
}
impl<B> StringResolver<B>
where
B: Backend,
{
pub fn resolve(&self, symbol: <B as Backend>::Symbol) -> Option<&str> {
...
}
pub unsafe fn resolve_unchecked(&self, symbol: <B as Backend>::Symbol) -> &str {
...
}
}
We will also add a method to convert StringInterners to a StringResolver
impl<B, H> StringInterner<B, H>
{
pub fn into_resolver(self)->StringResolver<B>{
....
}
}
I'd be happy to make a PR for this if this is approved
Hello, for our use case, we have an initial population of a
StringInternerwith values, and then there is a long period in which only symbol resolution is needed. To reduce memory usage during the second period, we'd like to be able to resolve interned symbols without the additional memory overhead for interning new strings.I propose to add a new struct, which will only allow to resolve strings from a given backend
We will also add a method to convert
StringInterners to aStringResolverI'd be happy to make a PR for this if this is approved