Struct gluon_base::symbol::SymbolModule
[−]
[src]
pub struct SymbolModule<'a> { /* fields omitted */ }
SymbolModule
wraps a Symbols
struct and adds a prefix to all symbols created by the symbol
method.
While this prefix does not affect the uniques of a Symbol
in any way, it does make the origin of a
symbol clearer when pretty printing it
Methods
impl<'a> SymbolModule<'a>
[src]
fn new(module: String, symbols: &'a mut Symbols) -> SymbolModule<'a>
fn symbol<N>(&mut self, name: N) -> Symbol where N: Into<NameBuf> + AsRef<Name>
Creates an unprefixed symbol, same as Symbols::symbol
fn scoped_symbol(&mut self, name: &str) -> Symbol
Creates a symbol which is prefixed by the module
argument passed in new
let mut symbols = Symbols::new(); let mut symbols = SymbolModule::new(String::from("test"), &mut symbols); assert_eq!(symbols.symbol("a").as_ref(), "a"); assert_eq!(symbols.scoped_symbol("a").as_ref(), "test.a");