pub trait StringInternerTrait {
type Symbol: Clone + Eq + Hash + Debug;
// Required methods
fn intern(&mut self, s: &str) -> Self::Symbol;
fn resolve(&self, symbol: &Self::Symbol) -> String;
}Expand description
A trait for abstracting string interning operations.
This trait allows for benchmarking different string interning strategies by providing a common interface for interning and resolving strings.
Required Associated Types§
Required Methods§
Sourcefn resolve(&self, symbol: &Self::Symbol) -> String
fn resolve(&self, symbol: &Self::Symbol) -> String
Resolves an interned symbol back to its original string value.
This method is crucial for verifying correctness and for certain interning patterns, although not all “no interning” strategies would strictly need it for performance benchmarks.
§Arguments
symbol- The interned symbol or reference to resolve.
§Returns
An owned String containing the original value corresponding to the symbol.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".