| Crates.io | sal-rhai |
| lib.rs | sal-rhai |
| version | 0.1.0 |
| created_at | 2025-07-01 06:03:05.399287+00 |
| updated_at | 2025-07-01 06:03:05.399287+00 |
| description | SAL Rhai - Rhai scripting integration for the System Abstraction Layer |
| homepage | |
| repository | https://git.threefold.info/herocode/sal |
| max_upload_size | |
| id | 1732815 |
| size | 229,943 |
sal-rhai)The sal-rhai package provides Rhai scripting integration for the SAL (System Abstraction Layer) ecosystem. This package serves as the central integration point that registers all SAL modules with the Rhai scripting engine, enabling powerful automation and scripting capabilities.
Add this to your Cargo.toml:
[dependencies]
sal-rhai = "0.1.0"
This package integrates the following SAL modules with Rhai:
sal-os): File operations, downloads, package managementsal-process): Command execution, process controlsal-text): String manipulation, templates, text replacementsal-net): HTTP requests, network utilitiessal-git): Repository management, Git commandssal-postgresclient, sal-redisclient): Database connectivitysal-virt): Container and virtualization toolssal-vault): Encryption, key management, digital signaturessal-mycelium, sal-zinit-client): Specialized system toolsuse sal_rhai::{register, exec};
use rhai::Engine;
// Create and configure Rhai engine with all SAL modules
let mut engine = Engine::new();
register(&mut engine).expect("Failed to register SAL modules");
// Execute Rhai script with SAL functions available
let result = exec(&mut engine, r#"
// Use SAL functions in Rhai scripts
let files = find_files("/tmp", "*.txt");
println("Found " + files.len() + " text files");
let result = run("echo 'Hello from SAL!'");
println("Command output: " + result.stdout);
"#).expect("Script execution failed");
This package is primarily used by the herodo binary to provide Rhai scripting capabilities with full access to SAL functionality.
The package provides comprehensive error handling that converts SAL errors into Rhai-compatible error types, ensuring smooth script execution and meaningful error messages.
This package depends on all other SAL packages to provide complete functionality registration. It serves as the integration hub for the entire SAL ecosystem.