Struct RustRuleContext

Source
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<'_, '_>

Source

pub fn value_to_base<T: BaseValue>(&self, x: Value) -> T

Convert from an egglog value to a Rust type.

Source

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.

See EGraph::value_to_container.

Source

pub fn base_to_value<T: BaseValue>(&self, x: T) -> Value

Convert from a Rust type to an egglog value.

Source

pub fn container_to_value<T: ContainerValue>(&mut self, x: T) -> Value

Convert from a Rust container type to an egglog value.

Source

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.

Source

pub fn union(&mut self, x: Value, y: Value)

Union two values in the e-graph. For more information, see egglog_bridge::UnionAction::union.

Source

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.

Source

pub fn remove(&mut self, table: &str, key: &[Value])

Remove a row from a table. For more information, see egglog_bridge::TableAction::remove.

Source

pub fn subsume(&mut self, table: &str, key: &[Value])

Subsume a row in a table. For more information, see egglog_bridge::TableAction::subsume.

Source

pub fn panic(&mut self) -> Option<()>

Panic. You should also return None from your callback if you call this function, which this function hopefully makes easier by always returning None so that you can use ?.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V