pub struct Engine { /* private fields */ }Expand description
Engine for evaluating Lemma rules.
Pure Rust implementation that evaluates Lemma specs directly from the AST. Uses pre-built execution plans that are self-contained and ready for evaluation.
The engine never performs network calls. External @... references must be
pre-resolved before loading — either by including dependency sources
in the source map or by calling resolve_registry_references separately
(e.g. in a lemma fetch command).
Implementations§
Source§impl Engine
impl Engine
pub fn new() -> Self
pub fn with_limits(limits: ResourceLimits) -> Self
Sourcepub fn limits(&self) -> &ResourceLimits
pub fn limits(&self) -> &ResourceLimits
Resource limits configured for this engine.
Sourcepub fn load(
&mut self,
sources: impl IntoIterator<Item = (SourceType, impl Into<String>)>,
) -> Result<(), Errors>
pub fn load( &mut self, sources: impl IntoIterator<Item = (SourceType, impl Into<String>)>, ) -> Result<(), Errors>
Load Lemma sources in one planning pass. Pairs are (source_type, source_text).
Provenance is derived solely from SourceType: SourceType::Path and
SourceType::Volatile are workspace-local; SourceType::Dependency tags
repositories with that dependency id.
Sourcepub fn list(&self) -> Vec<ResolvedRepository>
pub fn list(&self) -> Vec<ResolvedRepository>
Every loaded repository in insertion order (workspace, embedded stdlib EMBEDDED_STDLIB_REPOSITORY, dependencies).
Returns listed spec rows (metadata only, no AST, no source text).
Sourcepub fn show(
&self,
repository: Option<&str>,
spec: &str,
effective: Option<&DateTimeValue>,
) -> Result<Show, Error>
pub fn show( &self, repository: Option<&str>, spec: &str, effective: Option<&DateTimeValue>, ) -> Result<Show, Error>
Spec interface and resolved temporal window at effective.
Show.data lists only data used by the spec’s rules.
Lemma source text is Self::source.
Sourcepub fn source(
&self,
repository: Option<&str>,
spec: Option<&str>,
effective: Option<&DateTimeValue>,
) -> Result<String, Error>
pub fn source( &self, repository: Option<&str>, spec: Option<&str>, effective: Option<&DateTimeValue>, ) -> Result<String, Error>
Formatted canonical Lemma source for a repository or one spec slice.
When spec is None, returns all specs in the repository sorted by name/effective.
When spec is Some, effective selects the temporal slice (default: now).
Sourcepub fn run(
&self,
repository: Option<&str>,
spec: &str,
effective: Option<&DateTimeValue>,
data: HashMap<String, String>,
rules: Option<&[String]>,
explain: bool,
) -> Result<Response, Error>
pub fn run( &self, repository: Option<&str>, spec: &str, effective: Option<&DateTimeValue>, data: HashMap<String, String>, rules: Option<&[String]>, explain: bool, ) -> Result<Response, Error>
Evaluate a spec.