pub trait Provider: Debug + Send + Sync {
// Required methods
fn supports(&self, script_path: &str) -> bool;
fn run(
&self,
full_script_path: &Path,
args: Value,
methods: Arc<dyn RuntimeMethods>
) -> Result<(), ProviderError>;
}
Expand description
Trait for effect providers.
An effect provider is able to load an effect script and run it when given input parameters.
Required Methods§
sourcefn supports(&self, script_path: &str) -> bool
fn supports(&self, script_path: &str) -> bool
Returns if this provider supports the given effect
Parameters
script_path
: path to the script file describing this effect. This is thescript
field in the effect definition JSON.
Returns
true
if this provider can handle this script file, false
otherwise.
sourcefn run(
&self,
full_script_path: &Path,
args: Value,
methods: Arc<dyn RuntimeMethods>
) -> Result<(), ProviderError>
fn run( &self, full_script_path: &Path, args: Value, methods: Arc<dyn RuntimeMethods> ) -> Result<(), ProviderError>
Run the given effect to completion in a blocking fashion
Parameters
full_script_path
: resolved script pathargs
: arguments to the effectmethods
: instance interaction methods