pub type ScriptResult<T> = Result<T, Box<EvalAltResult>>;
Expand description
A type alias for the result of script execution within the FormattingEngine
.
This alias simplifies error handling when executing Rhai scripts, encapsulating
either a successful result (T
) or an error (Box<EvalAltResult>
).
§Examples
use script_format::{
FormattingEngine,
ScriptResult,
};
fn execute_script(script: &str) -> ScriptResult<()> {
let mut engine = FormattingEngine::new(false);
engine.format("data", 42, script)?;
Ok(())
}
§Type Parameters
T
- The type of the successful result.
Aliased Type§
enum ScriptResult<T> {
Ok(T),
Err(Box<EvalAltResult>),
}