pub struct ConstraintContextObj { /* private fields */ }Expand description
The object of a ConstraintContext, with the layout of the native one and a stable identity.
Only the local array changes after construction. Its handle is replaced by native append, so shared context inspection must use interior mutability. Parent links and their captured local prefix are immutable and acyclic.
Implementations§
Source§impl ConstraintContextObj
impl ConstraintContextObj
Sourcepub fn append(&self, constraint: impl IntoArg<Constraint>) -> Result<()>
pub fn append(&self, constraint: impl IntoArg<Constraint>) -> Result<()>
Append constraint to the local entries (sym.ConstraintContextAppend).
Do not append to the active context of a running native visitor.
Sourcepub fn local_size(&self) -> i64
pub fn local_size(&self) -> i64
Return the number of local entries, excluding captured ancestors.
Sourcepub fn snapshot(&self) -> ConstraintContext
pub fn snapshot(&self) -> ConstraintContext
Capture the visible prefix in an independently extensible child.
Sourcepub fn for_each(&self, callback: impl FnMut(&Constraint))
pub fn for_each(&self, callback: impl FnMut(&Constraint))
Call callback on each visible constraint, in inherited and then local order.
The callback may append without entering this iteration; each borrowed constraint is valid only during its callback.
Sourcepub fn to_array(&self) -> Array<Constraint>
pub fn to_array(&self) -> Array<Constraint>
Return the visible constraints in inherited and then local order, as an independent array.
Later appends do not change it; constraint nodes and expressions remain shared.