[][src]Struct gluon_base::symbol::SymbolModule

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

Implementations

impl<'a> SymbolModule<'a>[src]

pub fn new(module: String, symbols: &'a mut Symbols) -> SymbolModule<'a>[src]

pub fn simple_symbol<N>(&mut self, name: N) -> Symbol where
    N: Into<NameBuf> + AsRef<Name>, 
[src]

pub fn symbol<N>(&mut self, name: SymbolData<N>) -> Symbol where
    N: Into<NameBuf> + AsRef<Name>, 
[src]

Creates an unprefixed symbol, same as Symbols::symbol

pub fn contains_name<N>(&mut self, name: N) -> bool where
    N: AsRef<Name>, 
[src]

pub fn scoped_symbol(&mut self, name: &str) -> Symbol[src]

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[src]

pub fn len(&self) -> usize[src]

pub fn is_empty(&self) -> bool[src]

pub fn symbols(&mut self) -> &mut Symbols[src]

Trait Implementations

impl<'a> Debug for SymbolModule<'a>[src]

impl<'s> DisplayEnv for SymbolModule<'s>[src]

type Ident = Symbol

impl<'a> IdentEnv for SymbolModule<'a>[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<Id> AsId<Id> for Id where
    Id: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.