Struct gluon_base::symbol::SymbolModule
source · pub struct SymbolModule<'a> { /* private fields */ }
Expand description
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
Implementations§
source§impl<'a> SymbolModule<'a>
impl<'a> SymbolModule<'a>
pub fn new(module: String, symbols: &'a mut Symbols) -> SymbolModule<'a>
pub fn simple_symbol<N>(&mut self, name: N) -> Symbol
sourcepub fn symbol<N>(&mut self, name: SymbolData<N>) -> Symbol
pub fn symbol<N>(&mut self, name: SymbolData<N>) -> Symbol
Creates an unprefixed symbol, same as Symbols::symbol
pub fn contains_name<N>(&mut self, name: N) -> bool
sourcepub fn scoped_symbol(&mut self, name: &str) -> Symbol
pub 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.simple_symbol("a").as_ref(), "a");
assert_eq!(symbols.scoped_symbol("a").as_ref(), "test.a");
pub fn module(&self) -> &Name
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn symbols(&mut self) -> &mut Symbols
Trait Implementations§
source§impl<'a> Debug for SymbolModule<'a>
impl<'a> Debug for SymbolModule<'a>
source§impl<'s> DisplayEnv for SymbolModule<'s>
impl<'s> DisplayEnv for SymbolModule<'s>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for SymbolModule<'a>
impl<'a> Send for SymbolModule<'a>
impl<'a> Sync for SymbolModule<'a>
impl<'a> Unpin for SymbolModule<'a>
impl<'a> !UnwindSafe for SymbolModule<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more