Enum branchy::Symbol [−][src]
pub enum Symbol<Nt, T> { Nonterminal(Nt), Terminal(T), }
Expand description
Used to describe non-terminal and terminal symbols in Rule
s
and grammar input sequences for Expander::expand()
.
Variants
Expand description
Variant for non-terminal symbols - ones which can be further expanded, can appear on left-hand side of rules and cannot appear in a successful expansion result.
Expand description
Variant for terminal symbols - ones which will not be replaced during expansion, cannot appear on left-hand side of rules and will be the only ones in a successful expansion result.
Implementations
impl<Nt, T> Symbol<Nt, T>
[src]
impl<Nt, T> Symbol<Nt, T>
[src]pub fn is_terminal(&self) -> bool
[src]
pub fn is_terminal(&self) -> bool
[src]pub fn is_nonterminal(&self) -> bool
[src]
pub fn is_nonterminal(&self) -> bool
[src]Returns true
if the Symbol
is Nonterminal
.
pub fn unwrap_nonterm(self) -> Nt
[src]
pub fn unwrap_nonterm(self) -> Nt
[src]Returns the contained Nonterminal
value,
consuming the self
value.
Panics
Panics if the self
value is actually Terminal
.
pub fn expect_nonterm(self, message: &'static str) -> Nt
[src]
pub fn expect_nonterm(self, message: &'static str) -> Nt
[src]Returns the contained Nonterminal
value,
consuming the self
value.
Panics
Panics with a custom message
if the self
value is actually Terminal
.
pub fn unwrap_term(self) -> T
[src]
pub fn unwrap_term(self) -> T
[src]Returns the contained Terminal
value,
consuming the self
value.
Panics
Panics if the self
value is actually Nonterminal
.
pub fn expect_term(self, message: &'static str) -> T
[src]
pub fn expect_term(self, message: &'static str) -> T
[src]Returns the contained Terminal
value,
consuming the self
value.
Panics
Panics with a custom message
if the self
value is actually Nonterminal
.
Trait Implementations
impl<Nt: Copy, T: Copy> Copy for Symbol<Nt, T>
[src]
impl<Nt, T> StructuralPartialEq for Symbol<Nt, T>
[src]
Auto Trait Implementations
impl<Nt, T> RefUnwindSafe for Symbol<Nt, T> where
Nt: RefUnwindSafe,
T: RefUnwindSafe,
Nt: RefUnwindSafe,
T: RefUnwindSafe,
impl<Nt, T> Send for Symbol<Nt, T> where
Nt: Send,
T: Send,
Nt: Send,
T: Send,
impl<Nt, T> Sync for Symbol<Nt, T> where
Nt: Sync,
T: Sync,
Nt: Sync,
T: Sync,
impl<Nt, T> Unpin for Symbol<Nt, T> where
Nt: Unpin,
T: Unpin,
Nt: Unpin,
T: Unpin,
impl<Nt, T> UnwindSafe for Symbol<Nt, T> where
Nt: UnwindSafe,
T: UnwindSafe,
Nt: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,