Skip to main content

Module scripting

Module scripting 

Source
Expand description

Scripting support for custom diff analysis using Rhai.

This module provides a scripting interface for customizing diff analysis behavior using the Rhai scripting language. Scripts can define custom analyzers, validators, and transformations.

§Example

use legalis_diff::scripting::ScriptEngine;

let mut engine = ScriptEngine::new();

// Load a script
let script = r#"
    fn analyze_diff(diff) {
        let change_count = diff.changes.len();
        if change_count > 10 {
            return #{
                severity: "high",
                message: "Too many changes"
            };
        }
        return #{
            severity: "low",
            message: "Normal change count"
        };
    }
"#;

engine.load_script("analyzer", script).unwrap();

Structs§

ScriptAnalyzer
A script-based diff analyzer plugin.
ScriptChange
Script-friendly representation of a change.
ScriptDiff
Script-friendly representation of a diff.
ScriptEngine
A scripting engine for custom diff analysis.
ScriptImpact
Script-friendly representation of impact.