Skip to main content

ScriptRuntime

Trait ScriptRuntime 

Source
pub trait ScriptRuntime {
    // Required methods
    fn evaluate(&mut self, source: &str) -> Result<String, String>;
    fn update(
        &mut self,
        source: &str,
        state_json: &str,
    ) -> Result<String, String>;
}
Expand description

The engine contract every rcus scripting backend implements.

Required Methods§

Source

fn evaluate(&mut self, source: &str) -> Result<String, String>

Evaluates source as an expression and returns its JSON result.

Source

fn update(&mut self, source: &str, state_json: &str) -> Result<String, String>

Evaluates a view module and calls its view(state) export with state_json, returning the JSON view spec it produced.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§