pub struct Goal {
pub pattern: String,
pub expression: Option<Expression>,
pub status: GoalStatus,
pub sub_goals: Vec<Goal>,
pub candidate_rules: Vec<String>,
pub bindings: Bindings,
pub depth: usize,
}Expand description
Represents a goal to prove/achieve in backward chaining
Fields§
§pattern: StringTarget pattern to prove (e.g., “User.IsVIP == true”)
expression: Option<Expression>Parsed expression AST (if available)
status: GoalStatusCurrent status of this goal
sub_goals: Vec<Goal>Sub-goals that need to be proven first
candidate_rules: Vec<String>Rules that can potentially derive this goal
bindings: BindingsVariable bindings accumulated during proof
depth: usizeDepth of this goal in the search tree
Implementations§
Source§impl Goal
impl Goal
Sourcepub fn with_expression(pattern: String, expression: Expression) -> Self
pub fn with_expression(pattern: String, expression: Expression) -> Self
Create a new goal with parsed expression
Sourcepub fn is_unprovable(&self) -> bool
pub fn is_unprovable(&self) -> bool
Check if this goal is unprovable
Sourcepub fn all_subgoals_proven(&self) -> bool
pub fn all_subgoals_proven(&self) -> bool
Check if all sub-goals are proven
Sourcepub fn add_subgoal(&mut self, goal: Goal)
pub fn add_subgoal(&mut self, goal: Goal)
Add a sub-goal
Sourcepub fn add_candidate_rule(&mut self, rule_name: String)
pub fn add_candidate_rule(&mut self, rule_name: String)
Add a candidate rule that can derive this goal
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Goal
impl RefUnwindSafe for Goal
impl Send for Goal
impl Sync for Goal
impl Unpin for Goal
impl UnwindSafe for Goal
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