pub struct Engine { /* private fields */ }Expand description
Engine-scoped execution surface for JOSIE programs.
This keeps operator registration instance-local (no global singleton),
so different runtimes/projects can have different x.* extensions safely.
Implementations§
Source§impl Engine
impl Engine
Sourcepub fn register(
&mut self,
name: impl Into<String>,
operator: Operator,
) -> Option<Operator>
pub fn register( &mut self, name: impl Into<String>, operator: Operator, ) -> Option<Operator>
Register or replace an operator, typically in x.*.
Sourcepub fn check(&self, input: &Value) -> Result<Program, ValidationError>
pub fn check(&self, input: &Value) -> Result<Program, ValidationError>
Validate and parse program document.
Sourcepub fn compile(
&self,
program: &Program,
) -> Result<CompiledProgram, ValidationError>
pub fn compile( &self, program: &Program, ) -> Result<CompiledProgram, ValidationError>
Compile once.
Sourcepub fn run(&self, program: &Program) -> Result<ExecutionOutput, RuntimeError>
pub fn run(&self, program: &Program) -> Result<ExecutionOutput, RuntimeError>
Run one-shot.
Sourcepub fn run_compiled(
&self,
compiled: &CompiledProgram,
state: &mut State,
) -> Result<Value, RuntimeError>
pub fn run_compiled( &self, compiled: &CompiledProgram, state: &mut State, ) -> Result<Value, RuntimeError>
Run compiled program with caller-managed state.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Engine
impl RefUnwindSafe for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
impl UnwindSafe for Engine
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