Struct rusty_lr::ProductionRule
source · pub struct ProductionRule<Term, NonTerm> {
pub name: NonTerm,
pub rule: Vec<Token<Term, NonTerm>>,
pub id: usize,
}Expand description
Production rule.
name -> Token0 Token1 Token2 …
Fields§
§name: NonTerm§rule: Vec<Token<Term, NonTerm>>§id: usizeid user assigned to this rule
Implementations§
source§impl<Term, NonTerm> ProductionRule<Term, NonTerm>
impl<Term, NonTerm> ProductionRule<Term, NonTerm>
sourcepub fn map<NewTerm, NewNonTerm>(
self,
term_map: impl Fn(Term) -> NewTerm,
nonterm_map: impl Fn(NonTerm) -> NewNonTerm,
) -> ProductionRule<NewTerm, NewNonTerm>
pub fn map<NewTerm, NewNonTerm>( self, term_map: impl Fn(Term) -> NewTerm, nonterm_map: impl Fn(NonTerm) -> NewNonTerm, ) -> ProductionRule<NewTerm, NewNonTerm>
Map terminal and non-terminal symbols to another type. This is useful when exporting & importing rules.
Trait Implementations§
source§impl<Term, NonTerm> Clone for ProductionRule<Term, NonTerm>
impl<Term, NonTerm> Clone for ProductionRule<Term, NonTerm>
source§fn clone(&self) -> ProductionRule<Term, NonTerm>
fn clone(&self) -> ProductionRule<Term, NonTerm>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl<Term, NonTerm> Debug for ProductionRule<Term, NonTerm>
impl<Term, NonTerm> Debug for ProductionRule<Term, NonTerm>
source§impl<Term, NonTerm> Default for ProductionRule<Term, NonTerm>
impl<Term, NonTerm> Default for ProductionRule<Term, NonTerm>
source§fn default() -> ProductionRule<Term, NonTerm>
fn default() -> ProductionRule<Term, NonTerm>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<Term, NonTerm> Freeze for ProductionRule<Term, NonTerm>where
NonTerm: Freeze,
impl<Term, NonTerm> RefUnwindSafe for ProductionRule<Term, NonTerm>where
NonTerm: RefUnwindSafe,
Term: RefUnwindSafe,
impl<Term, NonTerm> Send for ProductionRule<Term, NonTerm>
impl<Term, NonTerm> Sync for ProductionRule<Term, NonTerm>
impl<Term, NonTerm> Unpin for ProductionRule<Term, NonTerm>
impl<Term, NonTerm> UnwindSafe for ProductionRule<Term, NonTerm>where
NonTerm: UnwindSafe,
Term: 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)