pub struct RuleBuilder<'a> { /* private fields */ }Implementations§
Source§impl RuleBuilder<'_>
impl RuleBuilder<'_>
Sourcepub fn new_panic(&mut self, message: String) -> ExternalFunctionId
pub fn new_panic(&mut self, message: String) -> ExternalFunctionId
Register a runtime panic with a custom message and return its
id. When called via call_external_func, the panic writes
the message to the egraph’s panic side channel and triggers
early stop, so run_rules returns an Err carrying the
message rather than the calling thread unwinding.
Sourcepub fn set_no_decomp(&mut self, no_decomp: bool)
pub fn set_no_decomp(&mut self, no_decomp: bool)
If true, the query planner will skip tree-decomposition for
this rule. Mirrors
core_relations::QueryBuilder::set_no_decomp; set from the
:no-decomp rule option or the egglog --no-decomp CLI flag.
Sourcepub fn new_var(&mut self, ty: ColumnTy) -> Variable
pub fn new_var(&mut self, ty: ColumnTy) -> Variable
Bind a new variable of the given type in the query.
Sourcepub fn new_var_named(&mut self, ty: ColumnTy, name: &str) -> QueryEntry
pub fn new_var_named(&mut self, ty: ColumnTy, name: &str) -> QueryEntry
Bind a new variable of the given type in the query.
This method attaches the given name to the QueryEntry, which can
make debugging easier.
pub fn call_external_func( &mut self, func: ExternalFunctionId, args: &[QueryEntry], ret_ty: ColumnTy, panic_msg: impl FnOnce() -> String + 'static + Send, ) -> Variable
Sourcepub fn query_table(
&mut self,
func: FunctionId,
entries: &[QueryEntry],
is_subsumed: Option<bool>,
) -> Result<AtomId>
pub fn query_table( &mut self, func: FunctionId, entries: &[QueryEntry], is_subsumed: Option<bool>, ) -> Result<AtomId>
Add the given table atom to query. As elsewhere in the crate, the last argument is the “return value” of the function. Can also optionally check the subsumption bit.
Sourcepub fn query_prim(
&mut self,
func: ExternalFunctionId,
entries: &[QueryEntry],
_ret_ty: ColumnTy,
) -> Result<()>
pub fn query_prim( &mut self, func: ExternalFunctionId, entries: &[QueryEntry], _ret_ty: ColumnTy, ) -> Result<()>
Add the given primitive atom to query. As elsewhere in the crate, the last argument is the “return value” of the function.
Sourcepub fn subsume(&mut self, func: FunctionId, entries: &[QueryEntry])
pub fn subsume(&mut self, func: FunctionId, entries: &[QueryEntry])
Subsume the given entry in func.
entries should match the number of keys to the function.
Sourcepub fn lookup(
&mut self,
func: FunctionId,
entries: &[QueryEntry],
panic_msg: impl FnOnce() -> String + Send + 'static,
) -> Variable
pub fn lookup( &mut self, func: FunctionId, entries: &[QueryEntry], panic_msg: impl FnOnce() -> String + Send + 'static, ) -> Variable
Look up the value of a function in the database. If the value is not present, the configured default for the function is used.
For functions configured with DefaultVal::Fail, failing lookups will use panic_msg in
the panic output.
Sourcepub fn union(&mut self, l: QueryEntry, r: QueryEntry)
pub fn union(&mut self, l: QueryEntry, r: QueryEntry)
Merge the two values in the union-find.
Sourcepub fn set(&mut self, func: FunctionId, entries: &[QueryEntry])
pub fn set(&mut self, func: FunctionId, entries: &[QueryEntry])
Set the value of a function in the database.
Sourcepub fn remove(&mut self, table: FunctionId, entries: &[QueryEntry])
pub fn remove(&mut self, table: FunctionId, entries: &[QueryEntry])
Remove the value of a function from the database.
Auto Trait Implementations§
impl<'a> Freeze for RuleBuilder<'a>
impl<'a> !RefUnwindSafe for RuleBuilder<'a>
impl<'a> Send for RuleBuilder<'a>
impl<'a> Sync for RuleBuilder<'a>
impl<'a> Unpin for RuleBuilder<'a>
impl<'a> !UnwindSafe for RuleBuilder<'a>
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
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>
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>
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