Struct hydro_lang::rewrites::properties::PropertyDatabase
source · pub struct PropertyDatabase { /* private fields */ }
Expand description
Structure for tracking expressions known to have particular algebraic properties.
§Schema
Each field in this struct corresponds to an algebraic property, and contains the list of
expressions that satisfy the property. Currently only commutative
.
§Interface
“Tag” an expression with a property and it will add it to that table. For example, Self::add_commutative_tag
.
Can also run a check to see if an expression satisfies a property.
Implementations§
source§impl PropertyDatabase
impl PropertyDatabase
sourcepub fn add_commutative_tag<'a, I, A, F: Fn(&mut A, I), Ctx, Q: QuotedWithContext<'a, F, Ctx> + Clone>(
&mut self,
expr: Q,
ctx: &Ctx,
) -> Q
pub fn add_commutative_tag<'a, I, A, F: Fn(&mut A, I), Ctx, Q: QuotedWithContext<'a, F, Ctx> + Clone>( &mut self, expr: Q, ctx: &Ctx, ) -> Q
Tags the expression as commutative.
pub fn is_tagged_commutative(&self, expr: &Expr) -> bool
Trait Implementations§
source§impl Default for PropertyDatabase
impl Default for PropertyDatabase
source§fn default() -> PropertyDatabase
fn default() -> PropertyDatabase
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PropertyDatabase
impl RefUnwindSafe for PropertyDatabase
impl !Send for PropertyDatabase
impl !Sync for PropertyDatabase
impl Unpin for PropertyDatabase
impl UnwindSafe for PropertyDatabase
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more