Type Alias ScriptResult

Source
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>),
}

Variants§

§1.0.0

Ok(T)

Contains the success value

§1.0.0

Err(Box<EvalAltResult>)

Contains the error value