pub struct ExecutionPlan {
pub doc_name: String,
pub fact_schema: HashMap<FactPath, LemmaType>,
pub fact_values: HashMap<FactPath, LiteralValue>,
pub doc_refs: HashMap<FactPath, String>,
pub fact_sources: HashMap<FactPath, Source>,
pub rules: Vec<ExecutableRule>,
pub sources: HashMap<String, String>,
}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 document lookups required during evaluation.
Fields§
§doc_name: StringMain document name
fact_schema: HashMap<FactPath, LemmaType>Resolved schema types for value-holding facts.
This is the authoritative schema contract for adapters and validation.
fact_values: HashMap<FactPath, LiteralValue>Concrete literal values for facts (document-defined literals + user-provided values).
doc_refs: HashMap<FactPath, String>Document reference facts (path -> referenced document name).
fact_sources: HashMap<FactPath, Source>Fact-level source information for better errors in adapters/validation.
rules: Vec<ExecutableRule>Rules to execute in topological order (sorted by dependencies)
sources: HashMap<String, String>Source code for error messages
Implementations§
Source§impl ExecutionPlan
impl ExecutionPlan
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 path string (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 document).
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_values(
self,
values: HashMap<String, String>,
limits: &ResourceLimits,
) -> Result<Self, LemmaError>
pub fn with_values( self, values: HashMap<String, String>, limits: &ResourceLimits, ) -> Result<Self, LemmaError>
Provide string values for facts by parsing them to their expected types.
This is the main entry point for providing user-supplied string values. It parses each string value to the expected type, checks resource limits, and applies the values to the plan.
Sourcepub fn with_typed_values(
self,
values: HashMap<String, LiteralValue>,
limits: &ResourceLimits,
) -> Result<Self, LemmaError>
pub fn with_typed_values( self, values: HashMap<String, LiteralValue>, limits: &ResourceLimits, ) -> Result<Self, LemmaError>
Provide pre-typed values for facts with resource limit checking.
Use this for programmatic APIs where values are already parsed.
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 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> 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