pub struct BytecodeVm;Implementations§
Source§impl BytecodeVm
impl BytecodeVm
Sourcepub fn eval(
bytecode: &Bytecode,
ctx: &EvaluationContext,
) -> Result<bool, EngineError>
pub fn eval( bytecode: &Bytecode, ctx: &EvaluationContext, ) -> Result<bool, EngineError>
Evaluate a compiled CRUE bytecode condition to a boolean decision gate.
Sourcepub fn decode(bytecode: &Bytecode) -> Result<Vec<Instruction>, EngineError>
pub fn decode(bytecode: &Bytecode) -> Result<Vec<Instruction>, EngineError>
Decode raw CRUE bytecode into an explicit instruction sequence.
Sourcepub fn eval_program(
program: &[Instruction],
bytecode: &Bytecode,
ctx: &EvaluationContext,
) -> Result<VmExit, EngineError>
pub fn eval_program( program: &[Instruction], bytecode: &Bytecode, ctx: &EvaluationContext, ) -> Result<VmExit, EngineError>
Evaluate a decoded VM program against bytecode metadata/context.
Sourcepub fn eval_decision(
bytecode: &Bytecode,
ctx: &EvaluationContext,
on_true: Decision,
on_false: Decision,
) -> Result<Decision, EngineError>
pub fn eval_decision( bytecode: &Bytecode, ctx: &EvaluationContext, on_true: Decision, on_false: Decision, ) -> Result<Decision, EngineError>
Evaluate a compiled rule condition and emit a typed decision via VM instructions.
Sourcepub fn build_match_program(
bytecode: &Bytecode,
on_match: Decision,
) -> Result<Vec<Instruction>, EngineError>
pub fn build_match_program( bytecode: &Bytecode, on_match: Decision, ) -> Result<Vec<Instruction>, EngineError>
Build a decoded VM program that emits on_match when the bytecode condition matches,
and returns false (boolean) when it does not match.
Sourcepub fn eval_match_program(
program: &[Instruction],
bytecode: &Bytecode,
ctx: &EvaluationContext,
) -> Result<Option<Decision>, EngineError>
pub fn eval_match_program( program: &[Instruction], bytecode: &Bytecode, ctx: &EvaluationContext, ) -> Result<Option<Decision>, EngineError>
Evaluate a prebuilt match program and return:
Some(decision)when rule matched and emitted a decisionNonewhen rule condition evaluated to false
Auto Trait Implementations§
impl Freeze for BytecodeVm
impl RefUnwindSafe for BytecodeVm
impl Send for BytecodeVm
impl Sync for BytecodeVm
impl Unpin for BytecodeVm
impl UnsafeUnpin for BytecodeVm
impl UnwindSafe for BytecodeVm
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