pub struct Rule<A: Alphabet> {
pub pattern: Module<A>,
pub tokens: State<A>,
pub probability: f32,
pub previous: Option<A>,
pub next: Option<A>,
pub condition: Option<Condition>,
}Fields§
§pattern: Module<A>§tokens: State<A>§probability: f32§previous: Option<A>§next: Option<A>§condition: Option<Condition>Implementations§
Source§impl<A: Alphabet> Rule<A>
impl<A: Alphabet> Rule<A>
pub fn new<P: Into<Module<A>>, I: Into<Module<A>>, Iter: IntoIterator<Item = I>>( pattern: P, tokens: Iter, ) -> Rule<A>
pub fn with_previous(self, prev: Option<A>) -> Self
pub fn with_next(self, next: Option<A>) -> Self
pub fn with_probability(self, probability: f32) -> Self
pub fn with_condition(self, condition: Option<Condition>) -> Self
pub fn match_pattern( &self, pattern: &Module<A>, context: &Context<'_, A>, params: &Variables, variables: &Variables, ) -> bool
pub fn produce(&self, params: &Variables, variables: &Variables) -> State<A>
Trait Implementations§
impl<A: Alphabet> StructuralPartialEq for Rule<A>
Auto Trait Implementations§
impl<A> Freeze for Rule<A>where
A: Freeze,
impl<A> RefUnwindSafe for Rule<A>where
A: RefUnwindSafe,
impl<A> Send for Rule<A>where
A: Send,
impl<A> Sync for Rule<A>where
A: Sync,
impl<A> Unpin for Rule<A>where
A: Unpin,
impl<A> UnwindSafe for Rule<A>where
A: 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