mrusty. mruby safe bindings for Rust
[] (https://travis-ci.org/anima-engine/mrusty) [![Coverage Status] (https://coveralls.io/repos/github/anima-engine/mrusty/badge.svg?branch=master)] (https://coveralls.io/github/anima-engine/mrusty?branch=master) [] (https://crates.io/crates/mrusty)
mrusty lets you:
- run Ruby 1.9 files with a very restricted API (without having to install Ruby)
- reflect Rust
struct
s andenum
s in mruby and run them
It does all this in a safely neat way while also bringing spec testing and a REPL to the table.
Note: Starting with v0.4.0, mrusty will only work with Rust beta (1.9.0).
This is caused by a need to capture panic
s in mruby. Once this features
stabilizes (and it will in Rust 1.9.0), mrusty will return to stable Rust.
Documentation
Example
A very simple example of a Container struct
which will be passed to mruby and
which is perfectly callable.
// mrusty_class!
extern crate mrusty;
// Needs some undocumented, hidden calls.
use *;
let mruby = new;
// Cont should not flood the current namespace. We will add it with require.
mrusty_class!;
// Add file to the context, making it requirable.
mruby.;
// Add spec testing.
describe!;
let result = mruby.run.unwrap; // Returns Value.
println!; // Prints "3".