pub struct RustRuleContext<'a, 'b> { /* private fields */ }Expand description
A wrapper around an ExecutionState for rules that are written in Rust.
See the rust_rule documentation for an example of how to use this.
Implementations§
Source§impl RustRuleContext<'_, '_>
impl RustRuleContext<'_, '_>
Sourcepub fn value_to_base<T: BaseValue>(&self, x: Value) -> T
pub fn value_to_base<T: BaseValue>(&self, x: Value) -> T
Convert from an egglog value to a Rust type.
Sourcepub fn value_to_container<T: ContainerValue>(
&mut self,
x: Value,
) -> Option<impl Deref<Target = T>>
pub fn value_to_container<T: ContainerValue>( &mut self, x: Value, ) -> Option<impl Deref<Target = T>>
Convert from an egglog value to reference of Rust container type.
Sourcepub fn base_to_value<T: BaseValue>(&self, x: T) -> Value
pub fn base_to_value<T: BaseValue>(&self, x: T) -> Value
Convert from a Rust type to an egglog value.
Sourcepub fn container_to_value<T: ContainerValue>(&mut self, x: T) -> Value
pub fn container_to_value<T: ContainerValue>(&mut self, x: T) -> Value
Convert from a Rust container type to an egglog value.
Sourcepub fn lookup(&mut self, table: &str, key: &[Value]) -> Option<Value>
pub fn lookup(&mut self, table: &str, key: &[Value]) -> Option<Value>
Do a table lookup. This is potentially a mutable operation!
For more information, see egglog_bridge::TableAction::lookup.
Sourcepub fn union(&mut self, x: Value, y: Value)
pub fn union(&mut self, x: Value, y: Value)
Union two values in the e-graph.
For more information, see egglog_bridge::UnionAction::union.
Sourcepub fn insert(&mut self, table: &str, row: impl Iterator<Item = Value>)
pub fn insert(&mut self, table: &str, row: impl Iterator<Item = Value>)
Insert a row into a table.
For more information, see egglog_bridge::TableAction::insert.
Sourcepub fn remove(&mut self, table: &str, key: &[Value])
pub fn remove(&mut self, table: &str, key: &[Value])
Remove a row from a table.
For more information, see egglog_bridge::TableAction::remove.
Auto Trait Implementations§
impl<'a, 'b> Freeze for RustRuleContext<'a, 'b>
impl<'a, 'b> !RefUnwindSafe for RustRuleContext<'a, 'b>
impl<'a, 'b> Send for RustRuleContext<'a, 'b>
impl<'a, 'b> Sync for RustRuleContext<'a, 'b>
impl<'a, 'b> Unpin for RustRuleContext<'a, 'b>
impl<'a, 'b> !UnwindSafe for RustRuleContext<'a, 'b>
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
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