Rustcript Seahorse Logo High Resolution
v1.0 Public Release

The Brain for your
Rust Engine

A secure, high-performance embedded scripting language designed to orchestrate Rust applications without recompilation.

Core Philosophy

Engine vs. Brain

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.

The Engine (Rust)

Compiled once. Handles infrastructure, networking, and heavy lifting.

The Brain (Rustcript)

Hot-swappable. Defines quests, workflows, and business rules.

Execution Pipeline
src/main.rs
Host Application
Rustcript Interpreter
Parsing • Optimization • Sandboxing
logic.rc
UserData

Why Embed Rustcript?

Safe Native Interop

Expose Rust structs (DB connections, configs) directly to scripts via the RustcriptObject trait.

Sandboxed & Secure

Scripts can't touch the filesystem by default. You explicitly grant permissions or define a sandbox root.

Resilient

Built-in instruction limiter prevents infinite loops from freezing your main application.

No Garbage Collector

Relies on Rust's predictable memory management (Arc/Clone). No "stop-the-world" pauses.

Full Capabilities

A comprehensive toolset for modern scripting needs.

Flexible Syntax

Combines natural assignment (x = 10) with clear, space-separated commands.

Rich Type System

Integers, floats, booleans, strings, tuples, vectors, and hashmaps.

Structured Control

Modern if/else, match, while, for, foreach, and try/catch.

Modular Design

Import script files into others with namespacing support.

Standard Library

Built-in methods for strings, collections, math, random, and JSON.

Error Reporting

Runtime errors reported with exact source line numbers.

First-Class Funcs

Store functions in variables and pass them as arguments.

Full Functions

Supports arguments, return values, scope isolation, and recursion.

Rust Interop

Safely wrap native Rust structs and expose them via RustcriptObject.

Security First

OS exec and File I/O disabled by default. Must be enabled at compile time.

Sandboxed I/O

File operations confined to designated directory. Granular permissions.

Execution Safety

Instruction counter prevents infinite loops from hanging the host.

Use Cases

Rustcript excels as a "glue language" to orchestrate Rust components.

Embedded Scripting

Define application behavior (quests, dialogues, AI) that can be changed without recompiling.

ETL & Data Pipelines

Automate complex data processing workflows: extract, transform, and load using sandboxed I/O.

Automated Testing

Write readable, step-by-step test cases for applications using the gated os.exec module.

Dynamic Config

Go beyond static files by using scripts to define configuration that changes based on logic.

Report Generation

Define the structure and content of automated reports, pulling data from various sources.

Microservice Logic

Implement business logic (validation, routing) within a high-performance Rust service.

The Enterprise Advantage

Beyond technical features, Rustcript delivers strategic value by bridging the gap between high-performance engineering and the dynamic needs of your business.

Speed & Agility

Update business rules on-the-fly by editing a script. Deploy logic changes in minutes, not hours, without recompiling the core Rust service.

Team Empowerment

The simple syntax allows non-Rust developers (analysts, QA) to write and manage logic, freeing up core engineers to focus on infrastructure.

Reduced Complexity

Externalize volatile logic to keep your core Rust codebase smaller, more stable, and easier to maintain, preventing technical debt.

Advanced Orchestration

Perfect for microservices. Use Rust for high-speed message consumption and Rustcript to dynamically filter, route, and process payloads.

Powerful Automation

Automate internal business processes, from generating complex custom reports to performing dynamic data cleanup tasks.

Flexible CI/CD Testing

Write powerful, readable end-to-end test scenarios as scripts, allowing QA to build comprehensive test suites without touching core code.

Clean, Explicit, Powerful

Explore the official examples to see the language in action.

Compilation & Integration

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.

Recommended

Method 1: Direct Cargo Integration

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.

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" }
main.rs
use rustcript::{Interpreter, Value, RustcriptObject};
// ... your application logic ...

Method 2: FFI (Non-Rust Projects)

For integration with Python, C#, C++, etc., compile Rustcript into a C-compatible dynamic library (.so / .dll).

Step 1: Expose API
// 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()
}
Step 2: Cargo.toml
[lib]
crate-type = ["cdylib"]

Comprehensive Testing

The project includes a comprehensive test suite to ensure correctness and prevent regressions, divided into Rust-native tests and script-based E2E tests.

Part 1: Rust Unit Tests

Internal Logic

These tests validate the core library functionality, such as the parser, type system, and the public API.

Run all library tests:
cargo test
Run with detailed output:
cargo test -- --nocapture

Part 2: End-to-End Script Tests

Regression

The tests/test_runner.rc script executes all example scripts to verify behavior from a user's perspective.

1. Build with required features:
cargo build --release --features "os_access file_io"
2. Standard Run (Default Limits):
./target/release/rustcript tests/test_runner.rc
3. Unlimited Run (No Safety Limit):
./target/release/rustcript --unlimited tests/test_runner.rc
AI-Powered Development

Built for the AI Era

The AI_INSTRUCTIONS.md File

We 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.

System Prompting & Persona

Primes the AI to act as a language specialist.

Deep Architectural Insights

Explains internal logic (AST, jump_map, state machine) for better reasoning.

Few-Shot Learning Zone

Examples formatted as Task -> Thought Process -> Correct Code.

User Prompt:
"Write a script that reads 'config.json' and checks for maintenance mode."
AI Response (Trained on Manual):
import 'json'
if io.exists('config.json') [
  content = io.read('config.json')
  cfg = json.parse(content)
  if cfg.maintenance_mode [
    print 'System is down.'
  ]
]

Community & Documentation

Join the conversation and help shape the future of Rustcript.

Official Manual

The comprehensive guide to syntax, features, standard library, and host integration.

Read the Manual

github.com/.../MANUAL.md

GitHub Discussions

Connect with other members. Introduce yourself, ask questions, or share scripts.

💬 General
💡 Ideas
🙏 Q&A
🙌 Show & Tell
Go to GitHub Discussions →

Contribution Policy

Want to contribute? Please discuss your idea in Discussions or an Issue before submitting a PR.