pub struct TableAction { /* private fields */ }Expand description
This is an intern-able struct that holds all the data needed
to do table operations with an ExecutionState, assuming
that the FunctionId for the table is known ahead of time.
Implementations§
Source§impl TableAction
impl TableAction
Sourcepub fn new(egraph: &EGraph, func: FunctionId) -> TableAction
pub fn new(egraph: &EGraph, func: FunctionId) -> TableAction
Create a new TableAction to be used later.
This requires access to the egglog_bridge::EGraph.
Sourcepub fn kind(&self) -> TableKind
pub fn kind(&self) -> TableKind
Whether this table is a Function (no auto-insert) or a
Constructor (mints a fresh eclass id on miss).
Sourcepub fn input_arity(&self) -> usize
pub fn input_arity(&self) -> usize
Number of input columns (schema minus the trailing output column).
Sourcepub fn lookup(&self, state: &ExecutionState<'_>, key: &[Value]) -> Option<Value>
pub fn lookup(&self, state: &ExecutionState<'_>, key: &[Value]) -> Option<Value>
Look up a row and return its return-value column, or None if the
key is not present. This is a pure read: it never inserts a row,
regardless of the table’s configured DefaultVal.
For the lookup-or-insert behavior that mints fresh eclass IDs for
constructors, use TableAction::lookup_or_insert.
Sourcepub fn row_count(&self, state: &ExecutionState<'_>) -> usize
pub fn row_count(&self, state: &ExecutionState<'_>) -> usize
Return the current number of rows in this table.
Sourcepub fn for_each(&self, state: &ExecutionState<'_>, f: impl FnMut(ScanEntry<'_>))
pub fn for_each(&self, state: &ExecutionState<'_>, f: impl FnMut(ScanEntry<'_>))
Iterate this table’s rows, calling f on each function row.
Mirrors EGraph::for_each but reaches the table through an
ExecutionState — so it’s callable from primitive bodies via
the typed Read-style API.
Sourcepub fn for_each_while(
&self,
state: &ExecutionState<'_>,
f: impl FnMut(ScanEntry<'_>) -> bool,
)
pub fn for_each_while( &self, state: &ExecutionState<'_>, f: impl FnMut(ScanEntry<'_>) -> bool, )
Like TableAction::for_each, but stops as soon as f
returns false.
Sourcepub fn lookup_or_insert(
&self,
state: &mut ExecutionState<'_>,
key: &[Value],
) -> Option<Value>
pub fn lookup_or_insert( &self, state: &mut ExecutionState<'_>, key: &[Value], ) -> Option<Value>
Look up a row, inserting the configured default value if absent.
For constructor tables this mints a fresh eclass ID; for custom
functions (no default) this behaves identically to
TableAction::lookup.
This is a write operation — only safe in action contexts. See issue #772.
Sourcepub fn insert(
&self,
state: &mut ExecutionState<'_>,
row: impl Iterator<Item = Value>,
)
pub fn insert( &self, state: &mut ExecutionState<'_>, row: impl Iterator<Item = Value>, )
Insert a row into this table.
Sourcepub fn remove(&self, state: &mut ExecutionState<'_>, key: &[Value])
pub fn remove(&self, state: &mut ExecutionState<'_>, key: &[Value])
Delete a row from this table.
Sourcepub fn subsume(
&self,
state: &mut ExecutionState<'_>,
key: impl Iterator<Item = Value>,
)
pub fn subsume( &self, state: &mut ExecutionState<'_>, key: impl Iterator<Item = Value>, )
Subsume a row in this table.
Trait Implementations§
Source§impl Clone for TableAction
impl Clone for TableAction
Source§fn clone(&self) -> TableAction
fn clone(&self) -> TableAction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TableAction
impl Debug for TableAction
Source§impl Hash for TableAction
impl Hash for TableAction
Source§impl PartialEq for TableAction
impl PartialEq for TableAction
impl Eq for TableAction
impl StructuralPartialEq for TableAction
Auto Trait Implementations§
impl Freeze for TableAction
impl RefUnwindSafe for TableAction
impl Send for TableAction
impl Sync for TableAction
impl Unpin for TableAction
impl UnwindSafe for TableAction
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
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