pub trait JsEngine:
Send
+ Sync
+ 'static {
// Required methods
fn eval(
&self,
source: &str,
exchange: JsExchange,
) -> Result<JsEvalResult, JsLanguageError>;
fn validate(&self, source: &str) -> Result<(), JsLanguageError>;
}Expand description
Abstraction over a JavaScript engine capable of evaluating expressions
against a JsExchange context.
Required Methods§
Sourcefn eval(
&self,
source: &str,
exchange: JsExchange,
) -> Result<JsEvalResult, JsLanguageError>
fn eval( &self, source: &str, exchange: JsExchange, ) -> Result<JsEvalResult, JsLanguageError>
Evaluate source JavaScript code with the given exchange context.
Returns the result including the (potentially mutated) exchange state.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".