pub enum Symbol<T, NT> {
Terminal(T),
Nonterminal(NT),
}
Expand description
A symbol on the parse stack.
Generic over the type of terminal T
and nonterminal NT
.
Variants§
Implementations§
Source§impl<T, NT> Symbol<T, NT>
impl<T, NT> Symbol<T, NT>
Sourcepub fn unwrap_terminal(self) -> T
pub fn unwrap_terminal(self) -> T
Return the terminal wrapped in this symbol.
Panics if the symbol is not a terminal.
Sourcepub fn unwrap_nonterminal(self) -> NT
pub fn unwrap_nonterminal(self) -> NT
Return the nonterminal wrapped in this symbol.
Panics if the symbol is not a nonterminal.
Auto Trait Implementations§
impl<T, NT> Freeze for Symbol<T, NT>
impl<T, NT> RefUnwindSafe for Symbol<T, NT>where
T: RefUnwindSafe,
NT: RefUnwindSafe,
impl<T, NT> Send for Symbol<T, NT>
impl<T, NT> Sync for Symbol<T, NT>
impl<T, NT> Unpin for Symbol<T, NT>
impl<T, NT> UnwindSafe for Symbol<T, NT>where
T: UnwindSafe,
NT: UnwindSafe,
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