pub struct ExecutionPlan {
pub spec_name: String,
pub facts: IndexMap<FactPath, FactData>,
pub rules: Vec<ExecutableRule>,
pub sources: HashMap<String, String>,
pub meta: HashMap<String, MetaValue>,
pub valid_from: Option<DateTimeValue>,
pub valid_to: Option<DateTimeValue>,
}Expand description
A complete execution plan ready for the evaluator
Contains the topologically sorted list of rules to execute, along with all facts. Self-contained structure - no spec lookups required during evaluation.
Fields§
§spec_name: StringMain spec name
facts: IndexMap<FactPath, FactData>Per-fact data in definition order: value, type-only, or spec reference.
rules: Vec<ExecutableRule>Rules to execute in topological order (sorted by dependencies)
sources: HashMap<String, String>Source code for error messages
meta: HashMap<String, MetaValue>Spec metadata
valid_from: Option<DateTimeValue>Temporal slice start (inclusive). None = -∞.
valid_to: Option<DateTimeValue>Temporal slice end (exclusive). None = +∞.
Implementations§
Source§impl ExecutionPlan
impl ExecutionPlan
Sourcepub fn schema(&self) -> SpecSchema
pub fn schema(&self) -> SpecSchema
Build a SpecSchema summarising all of this plan’s facts and
rules.
All facts with a typed schema (local and cross-spec) are included. Spec-reference facts (which have no schema type) are excluded. Only local rules (no cross-spec segments) are included. Facts and rules are sorted by source position (definition order).
Sourcepub fn schema_for_rules(
&self,
rule_names: &[String],
) -> Result<SpecSchema, Error>
pub fn schema_for_rules( &self, rule_names: &[String], ) -> Result<SpecSchema, Error>
Build a SpecSchema scoped to specific rules.
The returned schema contains only the facts needed by the given rules
(transitively, via needs_facts) and only those rules. This is the
“what do I need to evaluate these rules?” view.
Facts are sorted by source position (definition order).
Returns Err if any rule name is not found in the plan.
Sourcepub fn get_fact_path_by_str(&self, name: &str) -> Option<&FactPath>
pub fn get_fact_path_by_str(&self, name: &str) -> Option<&FactPath>
Look up a fact by its input key (e.g., “age” or “rules.base_price”).
Sourcepub fn get_rule(&self, name: &str) -> Option<&ExecutableRule>
pub fn get_rule(&self, name: &str) -> Option<&ExecutableRule>
Look up a local rule by its name (rule in the main spec).
Sourcepub fn get_rule_by_path(&self, rule_path: &RulePath) -> Option<&ExecutableRule>
pub fn get_rule_by_path(&self, rule_path: &RulePath) -> Option<&ExecutableRule>
Look up a rule by its full path.
Sourcepub fn get_fact_value(&self, path: &FactPath) -> Option<&LiteralValue>
pub fn get_fact_value(&self, path: &FactPath) -> Option<&LiteralValue>
Get the literal value for a fact path, if it exists and has a literal value.
Sourcepub fn with_fact_values(
self,
values: HashMap<String, String>,
limits: &ResourceLimits,
) -> Result<Self, Error>
pub fn with_fact_values( self, values: HashMap<String, String>, limits: &ResourceLimits, ) -> Result<Self, Error>
Provide string values for facts.
Parses each string to its expected type, validates constraints, and applies to the plan.
Trait Implementations§
Source§impl Clone for ExecutionPlan
impl Clone for ExecutionPlan
Source§fn clone(&self) -> ExecutionPlan
fn clone(&self) -> ExecutionPlan
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ExecutionPlan
impl Debug for ExecutionPlan
Source§impl<'de> Deserialize<'de> for ExecutionPlan
impl<'de> Deserialize<'de> for ExecutionPlan
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ExecutionPlan
impl RefUnwindSafe for ExecutionPlan
impl Send for ExecutionPlan
impl Sync for ExecutionPlan
impl Unpin for ExecutionPlan
impl UnsafeUnpin for ExecutionPlan
impl UnwindSafe for ExecutionPlan
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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