pub struct ExecutionPlan {
pub spec_name: String,
pub commentary: Option<String>,
pub data: IndexMap<DataPath, DataDefinition>,
pub rules: Vec<ExecutableRule>,
pub max_register_count: u16,
pub reference_evaluation_order: Vec<DataPath>,
pub meta: HashMap<String, MetaValue>,
pub resolved_types: ResolvedSpecTypes,
pub signature_index: HashMap<Vec<(String, i32)>, (String, Arc<LemmaType>)>,
pub effective: EffectiveDate,
pub sources: Vec<SpecSource>,
}Expand description
A complete execution plan ready for the evaluator
Contains the topologically sorted list of rules to execute, along with all data. Self-contained structure - no spec lookups required during evaluation.
Fields§
§spec_name: StringMain spec name
commentary: Option<String>Optional commentary from the """...""" block in the spec source.
data: IndexMap<DataPath, DataDefinition>Per-data data in definition order: value, type-only, or spec reference.
rules: Vec<ExecutableRule>Rules to execute in topological order (sorted by dependencies)
max_register_count: u16Maximum register file size across all rules; sizes [EvaluationContext::register_values].
reference_evaluation_order: Vec<DataPath>Order in which DataDefinition::Reference entries must be resolved
at evaluation time so that chained references (reference → reference →
data) copy values in the correct sequence. Empty when the plan has no
references.
meta: HashMap<String, MetaValue>Spec metadata
resolved_types: ResolvedSpecTypesMain-spec types from planning. [ResolvedSpecTypes::unit_index] is expression-scope
units (local types plus direct uses imports). Rule-result units live on each
[ExecutableRule::rule_type], not in this index.
signature_index: HashMap<Vec<(String, i32)>, (String, Arc<LemmaType>)>Reverse index: canonical-form unit signature Vec<(unit_name, exponent)> →
(unit_name, owning type). Built from expression-scope units during planning so
cross-type Multiply/Divide arithmetic can deterministically resolve a combined
signature back to a single named unit. Ambiguous signatures (the same key matched
by units in two distinct types) are rejected at planning time.
effective: EffectiveDate§sources: Vec<SpecSource>Canonical source for all specs in this plan (one entry per spec, includes repository). Reconstructed from AST — not raw file content.
Implementations§
Source§impl ExecutionPlan
impl ExecutionPlan
Sourcepub fn local_rule_names(&self) -> Vec<String>
pub fn local_rule_names(&self) -> Vec<String>
Build a SpecSchema describing this plan’s public IO contract.
Only data transitively reachable from live branches of at least one local rule is included. Spec-reference data (which have no schema type) are also excluded. Only local rules (no cross-spec segments) are included. Data are sorted local-first, then by source position within each depth.
If the caller supplies a DataOverlay, branches whose conditions are
definitively false given those values are pruned, reducing the returned
data set to only what is still needed.
Names of local (main-spec) rules in plan topological order.
pub fn schema(&self, overlay: &DataOverlay) -> SpecSchema
Sourcepub fn interface_schema(&self, overlay: &DataOverlay) -> SpecSchema
pub fn interface_schema(&self, overlay: &DataOverlay) -> SpecSchema
Every typed data input and local rule — the full spec surface.
Excludes DataDefinition::Reference (with bindings) and imports; those
are not caller inputs.
Sourcepub fn schema_for_rules(
&self,
rule_names: &[String],
overlay: &DataOverlay,
) -> Result<SpecSchema, Error>
pub fn schema_for_rules( &self, rule_names: &[String], overlay: &DataOverlay, ) -> Result<SpecSchema, Error>
Build a SpecSchema scoped to specific rules.
The returned schema contains only the data needed by the given rules
(transitively, through live arms of normalized expressions)
and only those rules. This is the “what do I need to evaluate these rules?”
view. DataDefinition::Reference entries (with bindings) are omitted —
their values are fixed in the spec.
When the caller supplies a DataOverlay, branches whose conditions are
definitively false given those values are pruned, reducing the returned
data set to only what is still needed.
Data are sorted local-first, then by source position within each depth.
Returns Err if any rule name is not found in the plan.
Sourcepub fn get_data_path_by_str(&self, name: &str) -> Option<&DataPath>
pub fn get_data_path_by_str(&self, name: &str) -> Option<&DataPath>
Look up a data by its input key (e.g., “age” or “rules.base_price”).
Sourcepub fn validated_response_rule_names(
&self,
rules: Option<&[String]>,
) -> Result<HashSet<String>, Error>
pub fn validated_response_rule_names( &self, rules: Option<&[String]>, ) -> Result<HashSet<String>, Error>
Validate caller-requested rule names and return canonical local rule names.
None means all local rules. Some(&[]) is an error. Unknown names in Some slice error.
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 collect_needed_data_paths(
&self,
rule_names: &[String],
overlay: &DataOverlay,
) -> Result<HashSet<DataPath>, Error>
pub fn collect_needed_data_paths( &self, rule_names: &[String], overlay: &DataOverlay, ) -> Result<HashSet<DataPath>, Error>
Collect the data paths statically referenced by the named local rules.
Walks the live branches of each named rule transitively: rule-target
data references extend the walk to the referenced rules. Branches whose
conditions are definitively decided by overlay-known values are pruned,
mirroring ExecutionPlan::schema_for_rules.
Returns Err if any rule name is not found in the plan.
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_data_value(&self, path: &DataPath) -> Option<&LiteralValue>
pub fn get_data_value(&self, path: &DataPath) -> Option<&LiteralValue>
Get the literal value for a data path, if it exists and has a literal value.
Trait Implementations§
Source§impl Clone for ExecutionPlan
impl Clone for ExecutionPlan
Source§fn clone(&self) -> ExecutionPlan
fn clone(&self) -> ExecutionPlan
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more