pub struct Production { /* private fields */ }Expand description
Represents production rules in an L-System.
These are rules
that may be represented in the form A -> B, where
A (called here the ProductionHead) is the symbol
that will be matched again, and the symbols after
the arrow (in this case the B, called here the ProductionBody is what
the symbols matching the head in the input string / axiom will be replaced with.
See:
Implementations§
Source§impl Production
impl Production
pub fn new(head: ProductionHead, body: ProductionBody) -> Self
pub fn head(&self) -> &ProductionHead
pub fn body(&self) -> Result<&ProductionBody>
Sourcepub fn matches(&self, string: &ProductionString, index: usize) -> bool
pub fn matches(&self, string: &ProductionString, index: usize) -> bool
Returns true iff this production’s Production::head matches the given
string’s index position of the string.
pub fn add_body(&mut self, body: ProductionBody)
Sourcepub fn all_bodies(&self) -> &Vec<ProductionBody>
pub fn all_bodies(&self) -> &Vec<ProductionBody>
Returns a reference to all of the bodies that this production contains
Trait Implementations§
Source§impl Clone for Production
impl Clone for Production
Source§fn clone(&self) -> Production
fn clone(&self) -> Production
Returns a duplicate 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 Debug for Production
impl Debug for Production
Source§impl Hash for Production
impl Hash for Production
Source§impl PartialEq for Production
impl PartialEq for Production
Source§impl SymbolIterable for Production
impl SymbolIterable for Production
Source§fn all_symbols_iter(&self) -> impl Iterator<Item = Symbol>
fn all_symbols_iter(&self) -> impl Iterator<Item = Symbol>
Iterate over all symbols contained in the object.
Source§fn all_symbols<C: FromIterator<Symbol>>(&self) -> C
fn all_symbols<C: FromIterator<Symbol>>(&self) -> C
Creates a collection of all the symbols that
[
self.all_symbols_iter] iterates over. Read moreimpl Eq for Production
Auto Trait Implementations§
impl Freeze for Production
impl RefUnwindSafe for Production
impl Send for Production
impl Sync for Production
impl Unpin for Production
impl UnwindSafe for Production
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