Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/shadownrx/windows/llms.txt

Use this file to discover all available pages before exploring further.

Alongside the AssemblyScript module, NEX OS ships a full Rust WebAssembly engine in wasm-engine/ that handles operations too complex for AssemblyScript’s constrained type system. Rust brings the full power of a systems programming language to the browser: ownership semantics, zero-cost abstractions, rich trait implementations, and access to the entire Rust crate ecosystem — all compiled down to a compact .wasm binary. Where AssemblyScript is the right tool for simple numeric functions, the Rust engine is deployed wherever the logic demands it.

Directory Structure

wasm-engine/
├── src/
│   └── lib.rs      # WASM module: system calculations, C++ transpiler, process management
├── Cargo.toml      # Rust project configuration and dependencies
└── Cargo.lock      # Deterministic dependency lock file
The pre-compiled binary committed to the repository at public/process_utils.wasm is built from the AssemblyScript source (assembly/index.ts) — not from the Rust engine. The asconfig.json targets public/process_utils.wasm as its output and that file ships with a .wasm.map source map consistent with an AssemblyScript build. You only need to compile the Rust engine separately if you modify wasm-engine/src/lib.rs. See the Recompilation section below.

What the Rust Engine Powers

The Rust WASM module backs three distinct capabilities inside NEX OS:

System Calculations

High-frequency CPU and memory metric calculations for the Task Manager, running at native speed without saturating the JS thread.

C++ Transpiler

The Dev-C++ 2026 application’s cppEngine.ts utility calls into the Rust WASM module to parse and transpile C++ source code inside the browser.

Process Management

Operations over the simulated process table — sorting, filtering, and aggregating process telemetry data for the Task Manager’s process list.

Rust vs. AssemblyScript: Choosing the Right Engine

Both engines compile to WebAssembly and live behind the same useWasmEngine hook interface, but they serve different authoring and capability needs.
ConcernAssemblyScriptRust
SyntaxTypeScript-likeRust (ownership, lifetimes, traits)
Learning curveLow for TypeScript devsHigher — requires Rust knowledge
Type systemStrict numeric types onlyFull type system, generics, traits
Complex algorithmsPossible but limitedIdiomatic and well-supported
Crate ecosystemNoneFull crates.io access
Build toolchainasc (npm script)wasm-pack or cargo
Best forSimple numeric functionsComplex business logic, parsers, transpilers
If you are adding a new numeric utility (e.g., a new load formula or a threshold counter), prefer AssemblyScript — it compiles with a single npm run build:as command. Reserve the Rust engine for operations that need complex data structures, string manipulation, or Rust crates.

Integration: The cppEngine.ts Bridge

The Dev-C++ 2026 app (src/components/apps/DevCpp2026.tsx) exposes a full in-browser C++ IDE. When a user compiles code, the frontend delegates the parsing and transpilation work to the Rust WASM engine through the cppEngine.ts utility at src/utils/cppEngine.ts. This utility acts as the bridge between the React component layer and the Rust binary:
  1. The IDE component calls cppEngine.ts with the raw C++ source string.
  2. cppEngine.ts loads the Rust WASM binary and invokes the exported Rust function.
  3. The Rust function in lib.rs processes the C++ source and returns the result.
  4. cppEngine.ts passes the output back to the IDE for display.
This pattern keeps the React component clean and the heavy parsing logic isolated inside the Rust module, where it runs at full native speed.

Recompilation

The Rust WASM module requires a different toolchain from the AssemblyScript module. You will need wasm-pack installed, or you can use the lower-level cargo command directly. wasm-pack produces optimized, browser-ready output with JavaScript bindings automatically generated:
# Install wasm-pack once
cargo install wasm-pack

# Build the Rust WASM module
cd wasm-engine
wasm-pack build --target web --out-dir ../public

Option 2: cargo directly

For more control over the output format, build directly with cargo:
cd wasm-engine
cargo build --target wasm32-unknown-unknown --release
The Rust toolchain requires the wasm32-unknown-unknown target. Install it with:
rustup target add wasm32-unknown-unknown
Without this target, cargo build will fail with a linker error.

The Pre-Compiled Binary

The public/process_utils.wasm file committed to the repository is a pre-compiled binary built from the AssemblyScript source. It works out of the box — no Rust toolchain required for day-to-day development. It is loaded by the wasmLoader utility at startup:
// src/utils/wasmLoader.ts
export async function initWasm() {
  const response = await fetch('/process_utils.wasm');
  const buffer = await response.arrayBuffer();
  const result = await WebAssembly.instantiate(buffer);
  return result.instance.exports;
}
Both the AssemblyScript and Rust engines can target public/process_utils.wasm. Running npm run build:as regenerates that file from AssemblyScript. Running wasm-pack build from wasm-engine/ replaces it with the Rust output. The binary committed to the repository is from AssemblyScript — rebuild with wasm-pack from wasm-engine/ to activate the full Rust engine.

Project Structure in Context

The Rust engine is one of two WebAssembly layers in the NEX OS codebase. Here is where it fits relative to the full project:
windows/
├── assembly/
│   └── index.ts              # AssemblyScript source (calculateLoad, getRank)
├── wasm-engine/
│   ├── src/
│   │   └── lib.rs            # Rust WASM source (system calc, C++ transpiler, process mgmt)
│   ├── Cargo.toml            # Rust manifest
│   └── Cargo.lock            # Locked dependencies
├── public/
│   └── process_utils.wasm    # Pre-compiled binary (AssemblyScript build, served statically)
└── src/
    └── utils/
        ├── wasmLoader.ts     # Fetches and instantiates the binary
        ├── useWasmEngine.ts  # React hook with JS fallback
        └── cppEngine.ts      # Bridge for Dev-C++ 2026 → Rust WASM

Further Reading

WASM Overview

Understand why NEX OS uses WebAssembly, see the performance numbers, and learn about the useWasmEngine hook.

AssemblyScript Module

Write TypeScript-like WASM functions, run the build pipeline, and integrate with React components.

Build docs developers (and LLMs) love