pub struct RewriteRule<T: Clone + Eq> {
pub lhs: T,
pub rhs: T,
pub name: String,
pub conditions: Vec<T>,
}Expand description
A conditional rewrite rule over a term type T.
Fields§
§lhs: TLeft-hand side pattern.
rhs: TRight-hand side result.
name: StringHuman-readable name for the rule.
conditions: Vec<T>Conditions that must hold (as terms that must reduce to True/normal form).
Implementations§
Source§impl<T: Clone + Eq> RewriteRule<T>
impl<T: Clone + Eq> RewriteRule<T>
Sourcepub fn new(name: impl Into<String>, lhs: T, rhs: T) -> Self
pub fn new(name: impl Into<String>, lhs: T, rhs: T) -> Self
Creates a new unconditional rewrite rule.
Sourcepub fn conditional(
name: impl Into<String>,
lhs: T,
rhs: T,
conditions: Vec<T>,
) -> Self
pub fn conditional( name: impl Into<String>, lhs: T, rhs: T, conditions: Vec<T>, ) -> Self
Creates a new conditional rewrite rule.
Sourcepub fn is_conditional(&self) -> bool
pub fn is_conditional(&self) -> bool
Returns whether this rule has conditions.
Trait Implementations§
Source§impl<T: Clone + Clone + Eq> Clone for RewriteRule<T>
impl<T: Clone + Clone + Eq> Clone for RewriteRule<T>
Source§fn clone(&self) -> RewriteRule<T>
fn clone(&self) -> RewriteRule<T>
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 moreimpl<T: Eq + Clone + Eq> Eq for RewriteRule<T>
impl<T: Clone + Eq> StructuralPartialEq for RewriteRule<T>
Auto Trait Implementations§
impl<T> Freeze for RewriteRule<T>where
T: Freeze,
impl<T> RefUnwindSafe for RewriteRule<T>where
T: RefUnwindSafe,
impl<T> Send for RewriteRule<T>where
T: Send,
impl<T> Sync for RewriteRule<T>where
T: Sync,
impl<T> Unpin for RewriteRule<T>where
T: Unpin,
impl<T> UnsafeUnpin for RewriteRule<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for RewriteRule<T>where
T: 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