pub struct Canonicalizer {
pub sort_commutative: bool,
pub flatten_nested: bool,
pub elim_double_neg: bool,
}Expand description
Expression canonicalizer with configurable rules.
Fields§
§sort_commutative: boolWhether to sort commutative operands (AND, OR).
flatten_nested: boolWhether to flatten nested same-op expressions.
elim_double_neg: boolWhether to eliminate double negations.
Implementations§
Source§impl Canonicalizer
impl Canonicalizer
Sourcepub fn with_sort_commutative(self, v: bool) -> Self
pub fn with_sort_commutative(self, v: bool) -> Self
Set whether to sort commutative operands.
Sourcepub fn with_flatten_nested(self, v: bool) -> Self
pub fn with_flatten_nested(self, v: bool) -> Self
Set whether to flatten nested same-op expressions.
Sourcepub fn with_elim_double_neg(self, v: bool) -> Self
pub fn with_elim_double_neg(self, v: bool) -> Self
Set whether to eliminate double negations.
Sourcepub fn canonicalize(&self, expr: &TLExpr) -> (TLExpr, CanonicalStats)
pub fn canonicalize(&self, expr: &TLExpr) -> (TLExpr, CanonicalStats)
Canonicalize an expression, returning the normalized form and stats.
Sourcepub fn canonical_key(&self, expr: &TLExpr) -> String
pub fn canonical_key(&self, expr: &TLExpr) -> String
Produce a deterministic canonical key string for cache use.
Trait Implementations§
Source§impl Clone for Canonicalizer
impl Clone for Canonicalizer
Source§fn clone(&self) -> Canonicalizer
fn clone(&self) -> Canonicalizer
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 Canonicalizer
impl Debug for Canonicalizer
Auto Trait Implementations§
impl Freeze for Canonicalizer
impl RefUnwindSafe for Canonicalizer
impl Send for Canonicalizer
impl Sync for Canonicalizer
impl Unpin for Canonicalizer
impl UnsafeUnpin for Canonicalizer
impl UnwindSafe for Canonicalizer
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