pub trait LogicEngine {
// Required methods
fn id(&self) -> EngineId;
fn paradigm(&self) -> Paradigm;
fn name(&self) -> &'static str;
fn can_handle(&self, node: &AstNode) -> bool;
fn evaluate(
&self,
node: &AstNode,
ctx: &EvalContext<'_>,
) -> Result<Verdict, EngineError>;
}Expand description
The core trait every logic engine must implement.
Implementations are stateless by design — all state lives in EvalContext.
This makes engines safe to share across threads and suitable for ROM.
Required Methods§
Sourcefn can_handle(&self, node: &AstNode) -> bool
fn can_handle(&self, node: &AstNode) -> bool
Whether this engine can handle the given AST node.
Called by the router before evaluate to avoid wasted work.
Sourcefn evaluate(
&self,
node: &AstNode,
ctx: &EvalContext<'_>,
) -> Result<Verdict, EngineError>
fn evaluate( &self, node: &AstNode, ctx: &EvalContext<'_>, ) -> Result<Verdict, EngineError>
Evaluate an AST node and return a Verdict.
Engines must be deterministic: same node + same ctx → same Verdict.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".