pub struct ConstraintArena<F> { /* private fields */ }Expand description
Arena-allocated constraint DAG.
Nodes reference each other by
ExprId (index into nodes).
Cell nodes are automatically deduplicated:
calling cell() twice with the same
ProgramCell returns the same ExprId.
Implementations§
Source§impl<F: TowerField> ConstraintArena<F>
impl<F: TowerField> ConstraintArena<F>
pub fn new() -> Self
Sourcepub fn alloc(&mut self, expr: ConstraintExpr<F>) -> ExprId
pub fn alloc(&mut self, expr: ConstraintExpr<F>) -> ExprId
Allocate a new expression node. Returns its ID.
Sourcepub fn get(&self, id: ExprId) -> &ConstraintExpr<F>
pub fn get(&self, id: ExprId) -> &ConstraintExpr<F>
Read a node by ID.
pub fn is_empty(&self) -> bool
Sourcepub fn shift_cells(&mut self, offset: usize)
pub fn shift_cells(&mut self, offset: usize)
Shift all Cell node col_idx by offset.
Used when embedding a chiplet’s AST into
a combined program where column indices
are offset.
Sourcepub fn cell(&mut self, cell: ProgramCell) -> ExprId
pub fn cell(&mut self, cell: ProgramCell) -> ExprId
Create or reuse a cell reference. Automatically deduplicates: same ProgramCell -> same ExprId.
Trait Implementations§
Source§impl<F: TowerField> Clone for ConstraintArena<F>
impl<F: TowerField> Clone for ConstraintArena<F>
Source§impl<F: TowerField> Default for ConstraintArena<F>
impl<F: TowerField> Default for ConstraintArena<F>
Auto Trait Implementations§
impl<F> Freeze for ConstraintArena<F>
impl<F> RefUnwindSafe for ConstraintArena<F>
impl<F> Send for ConstraintArena<F>
impl<F> Sync for ConstraintArena<F>
impl<F> Unpin for ConstraintArena<F>
impl<F> UnsafeUnpin for ConstraintArena<F>
impl<F> UnwindSafe for ConstraintArena<F>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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