Struct move_model::symbol::SymbolPool
source · pub struct SymbolPool { /* private fields */ }
Expand description
A pool of symbols. Allows to lookup a symbol by a string representation, and discover the string representation of an existing symbol. This struct does not need be mutable for operations on it, which is important so references to it can be freely passed around.
Implementations§
source§impl SymbolPool
impl SymbolPool
sourcepub fn new() -> SymbolPool
pub fn new() -> SymbolPool
Creates a new SymbolPool.
sourcepub fn make(&self, s: &str) -> Symbol
pub fn make(&self, s: &str) -> Symbol
Looks up a symbol by its string representation. If a symbol with this representation already exists, it will be returned, otherwise a new one will be created in the pool. The implementation uses internally a RefCell for storing symbols, so the pool does not need to be mutable.