mruby/edge

A pure-Rust reimplementation of the mruby VM
for WebAssembly and embedded systems

🦀 Written in Rust 🌐 WebAssembly-first ⚡ Lightweight 🔒 Memory Safe

Overview

mruby/edge is an mruby-compatible virtual machine implementation written in Rust, specifically designed for WebAssembly environments and embedded systems. Execute mruby bytecode and Ruby source code with minimal footprint and maximum safety.

🌐

WebAssembly-first Design

Optimized for running Ruby code in browsers and edge computing environments. Deploy Ruby applications anywhere WebAssembly runs.

Lightweight Runtime

Minimal footprint and binary size suitable for constrained environments. Perfect for resource-limited devices and applications.

🔧

no_std Core

Can run in environments without standard library support. Ideal for bare-metal and embedded systems programming.

🔄

mruby Compatible

Executes mruby bytecode (.mrb files) and Ruby source code. Leverage existing mruby tools and libraries.

🦀

Rust Safety

Built with Rust for memory safety and reliability. Eliminate entire classes of bugs and security vulnerabilities.

Quick Start

Installation

Add this to your Cargo.toml:

[dependencies]
mrubyedge = "1.0"

Running Precompiled Bytecode

Load and execute a precompiled *.mrb file:

use mrubyedge::rite;
use mrubyedge::yamrb::vm;

// Bundle the compiled script at build time
const SCRIPT: &[u8] = include_bytes!("./examples/simple.mrb");

fn main() -> Result<(), Box> {
    let mut rite = rite::load(SCRIPT)?;
    let mut vm = vm::VM::open(&mut rite);
    let value = vm.run()?;
    println!("{:?}", value);
    Ok(())
}

Use Cases

  • Embedded Systems - Run Ruby in resource-constrained devices
  • WebAssembly Applications - Deploy Ruby code in browsers and serverless environments
  • Edge Computing - Lightweight Ruby runtime for edge nodes
  • Rust Integration - Embed Ruby scripting in Rust applications

Get Started Today

Check out the documentation and start building with mruby/edge