A secure, high-performance embedded scripting language designed to orchestrate Rust applications without recompilation.
Rust is the high-performance Engine. Rustcript is the flexible Brain. This separation allows you to update logic on-the-fly without recompiling the host.
Compiled once. Handles infrastructure, networking, and heavy lifting.
Hot-swappable. Defines quests, workflows, and business rules.
Expose Rust structs (DB connections, configs) directly to scripts via the RustcriptObject trait.
Scripts can't touch the filesystem by default. You explicitly grant permissions or define a sandbox root.
Built-in instruction limiter prevents infinite loops from freezing your main application.
Relies on Rust's predictable memory management (Arc/Clone). No "stop-the-world" pauses.
A comprehensive toolset for modern scripting needs.
Combines natural assignment (x = 10) with clear, space-separated commands.
Integers, floats, booleans, strings, tuples, vectors, and hashmaps.
Modern if/else, match, while, for, foreach, and try/catch.
Import script files into others with namespacing support.
Built-in methods for strings, collections, math, random, and JSON.
Runtime errors reported with exact source line numbers.
Store functions in variables and pass them as arguments.
Supports arguments, return values, scope isolation, and recursion.
Safely wrap native Rust structs and expose them via RustcriptObject.
OS exec and File I/O disabled by default. Must be enabled at compile time.
File operations confined to designated directory. Granular permissions.
Instruction counter prevents infinite loops from hanging the host.
Rustcript excels as a "glue language" to orchestrate Rust components.
Define application behavior (quests, dialogues, AI) that can be changed without recompiling.
Automate complex data processing workflows: extract, transform, and load using sandboxed I/O.
Write readable, step-by-step test cases for applications using the gated os.exec module.
Go beyond static files by using scripts to define configuration that changes based on logic.
Define the structure and content of automated reports, pulling data from various sources.
Implement business logic (validation, routing) within a high-performance Rust service.
Beyond technical features, Rustcript delivers strategic value by bridging the gap between high-performance engineering and the dynamic needs of your business.
Update business rules on-the-fly by editing a script. Deploy logic changes in minutes, not hours, without recompiling the core Rust service.
The simple syntax allows non-Rust developers (analysts, QA) to write and manage logic, freeing up core engineers to focus on infrastructure.
Externalize volatile logic to keep your core Rust codebase smaller, more stable, and easier to maintain, preventing technical debt.
Perfect for microservices. Use Rust for high-speed message consumption and Rustcript to dynamically filter, route, and process payloads.
Automate internal business processes, from generating complex custom reports to performing dynamic data cleanup tasks.
Write powerful, readable end-to-end test scenarios as scripts, allowing QA to build comprehensive test suites without touching core code.
Explore the official examples to see the language in action.
Rustcript is fundamentally a library crate, designed to be embedded as a scripting engine within a larger host application. Choose the method that fits your project.
The easiest and most robust way to use Rustcript in another Rust project is to add it as a local path dependency in your project's Cargo.toml.
[package]
name = "my_awesome_app"
version = "0.1.0"
edition = "2021"
[dependencies]
# Point this to your local rustcript folder.
rustcript = { path = "/path/to/rustcript" }
use rustcript::{Interpreter, Value, RustcriptObject};
// ... your application logic ...
For integration with Python, C#, C++, etc., compile Rustcript into a C-compatible dynamic library (.so / .dll).
// In lib.rs or ffi.rs
use rustcript::Interpreter;
use std::ffi::{CStr, CString};
use std::os::raw::c_char;
#[no_mangle]
pub extern "C" fn rustcript_run_script(
source_code: *const c_char
) -> *mut c_char {
let c_str = unsafe { CStr::from_ptr(source_code) };
let source = c_str.to_str().unwrap_or("");
// ... run logic ...
let res = "OK".to_string();
CString::new(res).unwrap().into_raw()
}
[lib]
crate-type = ["cdylib"]
The project includes a comprehensive test suite to ensure correctness and prevent regressions, divided into Rust-native tests and script-based E2E tests.
These tests validate the core library functionality, such as the parser, type system, and the public API.
The tests/test_runner.rc script executes all example scripts to verify behavior from a user's perspective.
AI_INSTRUCTIONS.md FileWe treat AI as a first-class user. The project includes a dedicated "Prompt Engineering" document that acts as a single source of truth to turn any AI into an expert Rustcript developer.
Primes the AI to act as a language specialist.
Explains internal logic (AST, jump_map, state machine) for better reasoning.
Examples formatted as Task -> Thought Process -> Correct Code.
Join the conversation and help shape the future of Rustcript.
The comprehensive guide to syntax, features, standard library, and host integration.
github.com/.../MANUAL.md
Connect with other members. Introduce yourself, ask questions, or share scripts.
Want to contribute? Please discuss your idea in Discussions or an Issue before submitting a PR.