pub struct AstEngine {
pub structure: StructureAst,
pub constraints: ConstraintSet,
}Expand description
The main AST engine that owns both Structure and Constraint data.
Provides apply() to execute actions and preview() to dry-run them.
Fields§
§structure: StructureAstThe structure AST.
constraints: ConstraintSetThe constraint set.
Implementations§
Source§impl AstEngine
impl AstEngine
Sourcepub fn apply(&mut self, action: &Action) -> Result<ApplyResult, OperationError>
pub fn apply(&mut self, action: &Action) -> Result<ApplyResult, OperationError>
Apply an action to the AST, returning the result or an error.
§Errors
Returns OperationError if the action cannot be applied.
Sourcepub fn preview(&self, action: &Action) -> Result<PreviewResult, OperationError>
pub fn preview(&self, action: &Action) -> Result<PreviewResult, OperationError>
Preview an action without applying it (dry-run).
Clones self, applies the action on the clone, and derives what
would happen — new holes created and constraints affected —
without mutating the original engine.
§Errors
Returns OperationError if the action is invalid.
Trait Implementations§
Source§impl ProjectionAPI for AstEngine
impl ProjectionAPI for AstEngine
Source§fn nodes(&self) -> Vec<ProjectedNode>
fn nodes(&self) -> Vec<ProjectedNode>
Return all nodes in DFS traversal order with display information.
Source§fn children(&self, node: NodeId) -> Vec<SlotEntry>
fn children(&self, node: NodeId) -> Vec<SlotEntry>
Get named slot entries (children) for a specific node.
Source§fn inspect(&self, node: NodeId) -> Option<NodeDetail>
fn inspect(&self, node: NodeId) -> Option<NodeDetail>
Get detailed information about a node including constraints.
Source§fn hole_candidates(&self, hole: NodeId) -> Vec<CandidateKind>
fn hole_candidates(&self, hole: NodeId) -> Vec<CandidateKind>
Get candidate types that can fill a hole node.
Source§fn available_actions(&self) -> Vec<AvailableAction>
fn available_actions(&self) -> Vec<AvailableAction>
Get all available actions that can be performed on the AST.
Source§fn why_not_editable(&self, node: NodeId) -> Option<NotEditableReason>
fn why_not_editable(&self, node: NodeId) -> Option<NotEditableReason>
Check if a node cannot be edited and return the reason.
Source§fn completeness(&self) -> CompletenessSummary
fn completeness(&self) -> CompletenessSummary
Get a summary of AST completeness status.
Auto Trait Implementations§
impl Freeze for AstEngine
impl RefUnwindSafe for AstEngine
impl Send for AstEngine
impl Sync for AstEngine
impl Unpin for AstEngine
impl UnsafeUnpin for AstEngine
impl UnwindSafe for AstEngine
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