pub struct ExecutionPlan {
pub spec_name: String,
pub commentary: Option<String>,
pub data: IndexMap<DataPath, DataDefinition>,
pub rules: Vec<ExecutableRule>,
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)
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 schema(&self) -> SpecSchema
pub fn schema(&self) -> SpecSchema
Build a SpecSchema describing this plan’s public IO contract.
Only data transitively reachable from at least one local rule (via
needs_data) are included. Spec-reference data (which have no schema
type) are also excluded. Only local rules (no cross-spec segments) are
included. Data and rules are sorted by source position (definition
order).
Sourcepub fn interface_schema(&self) -> SpecSchema
pub fn interface_schema(&self) -> SpecSchema
Every typed data input and local rule — the full spec surface.
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 data needed by the given rules
(transitively, via needs_data) and only those rules. This is the
“what do I need to evaluate these rules?” view.
Data are sorted by source position (definition order).
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 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_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.
Sourcepub fn set_data_values(
self,
values: HashMap<String, DataValueInput>,
limits: &ResourceLimits,
) -> Result<Self, Error>
pub fn set_data_values( self, values: HashMap<String, DataValueInput>, limits: &ResourceLimits, ) -> Result<Self, Error>
Provide typed data values from a client.
Parses each value to its expected type, validates constraints, and applies to the plan.
Sourcepub fn with_defaults(self) -> Self
pub fn with_defaults(self) -> Self
Promote declared defaults on type declarations into concrete DataDefinition::Value entries.
Call BEFORE Self::set_data_values so user-provided values override defaults.
Reference resolution is handled by the evaluator at runtime.
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 moreSource§impl Debug for ExecutionPlan
impl Debug for ExecutionPlan
Source§impl From<&ExecutionPlan> for ExecutionPlanSerialized
impl From<&ExecutionPlan> for ExecutionPlanSerialized
Source§fn from(plan: &ExecutionPlan) -> Self
fn from(plan: &ExecutionPlan) -> Self
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