pub struct EvaluationContext<'a> {
pub current_doc: &'a LemmaDoc,
pub all_documents: &'a HashMap<String, LemmaDoc>,
pub sources: &'a HashMap<String, String>,
pub facts: HashMap<FactReference, LiteralValue>,
pub timeout_tracker: &'a TimeoutTracker,
pub limits: &'a ResourceLimits,
pub rule_results: HashMap<RulePath, OperationResult>,
pub operations: Vec<OperationRecord>,
}Expand description
Context for evaluating a Lemma document
Contains all state needed for a single evaluation:
- Facts (inputs)
- Rule results (computed values)
- Operation records (execution log)
- Timeout tracking
Fields§
§current_doc: &'a LemmaDocDocument being evaluated
all_documents: &'a HashMap<String, LemmaDoc>All loaded documents (needed when facts reference other documents)
sources: &'a HashMap<String, String>Source text for all documents (for error reporting) Maps source_id -> source text
facts: HashMap<FactReference, LiteralValue>Fact values (from document + overrides) Maps fact path -> concrete value Only contains facts that have actual values (not TypeAnnotations)
timeout_tracker: &'a TimeoutTrackerTimeout tracker (platform-specific)
limits: &'a ResourceLimitsResource limits including timeout
rule_results: HashMap<RulePath, OperationResult>Rule results computed so far (populated during execution) Maps RulePath -> operation result (either Value or Veto)
operations: Vec<OperationRecord>Operation records - records every operation
Implementations§
Source§impl<'a> EvaluationContext<'a>
impl<'a> EvaluationContext<'a>
Sourcepub fn new(
current_doc: &'a LemmaDoc,
all_documents: &'a HashMap<String, LemmaDoc>,
sources: &'a HashMap<String, String>,
facts: HashMap<FactReference, LiteralValue>,
timeout_tracker: &'a TimeoutTracker,
limits: &'a ResourceLimits,
) -> Self
pub fn new( current_doc: &'a LemmaDoc, all_documents: &'a HashMap<String, LemmaDoc>, sources: &'a HashMap<String, String>, facts: HashMap<FactReference, LiteralValue>, timeout_tracker: &'a TimeoutTracker, limits: &'a ResourceLimits, ) -> Self
Create a new evaluation context
Sourcepub fn check_timeout(&self) -> Result<(), LemmaError>
pub fn check_timeout(&self) -> Result<(), LemmaError>
Check if evaluation has exceeded timeout
Auto Trait Implementations§
impl<'a> Freeze for EvaluationContext<'a>
impl<'a> RefUnwindSafe for EvaluationContext<'a>
impl<'a> Send for EvaluationContext<'a>
impl<'a> Sync for EvaluationContext<'a>
impl<'a> Unpin for EvaluationContext<'a>
impl<'a> UnwindSafe for EvaluationContext<'a>
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
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>
Converts
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>
Converts
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