pub struct StringRewritingSystem {
pub alphabet: Vec<char>,
pub rules: Vec<(String, String)>,
}Expand description
A string rewriting system (monoid presentation).
Fields§
§alphabet: Vec<char>Alphabet.
rules: Vec<(String, String)>Rules: (lhs, rhs) as strings over the alphabet.
Implementations§
Source§impl StringRewritingSystem
impl StringRewritingSystem
Sourcepub fn rewrite_step(&self, s: &str) -> Option<String>
pub fn rewrite_step(&self, s: &str) -> Option<String>
Applies one step of rewriting to a string (leftmost first match).
Sourcepub fn normalize(&self, s: &str, max_steps: usize) -> String
pub fn normalize(&self, s: &str, max_steps: usize) -> String
Applies rewriting until normal form (limit iterations).
Trait Implementations§
Source§impl Clone for StringRewritingSystem
impl Clone for StringRewritingSystem
Source§fn clone(&self) -> StringRewritingSystem
fn clone(&self) -> StringRewritingSystem
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 moreAuto Trait Implementations§
impl Freeze for StringRewritingSystem
impl RefUnwindSafe for StringRewritingSystem
impl Send for StringRewritingSystem
impl Sync for StringRewritingSystem
impl Unpin for StringRewritingSystem
impl UnsafeUnpin for StringRewritingSystem
impl UnwindSafe for StringRewritingSystem
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