| Crates.io | rurust |
| lib.rs | rurust |
| version | 0.2.0 |
| created_at | 2016-05-15 12:52:27.288825+00 |
| updated_at | 2021-02-13 15:16:54.318661+00 |
| description | High level Ruby VM bindings |
| homepage | |
| repository | https://github.com/dylanmckay/rurust |
| max_upload_size | |
| id | 5076 |
| size | 33,476 |
A Rust wrapper over the MRI Ruby VM.
Allows you to create a Ruby VM, eval code, plug classes,
define modules, and insert C functions into the environment.
For a more high level library, take a look at plugger.
extern fn callable_from_ruby() {
println!("Hello World!");
}
fn main() {
let mut vm = rurust::VM::new().unwrap();
vm.class("Rust").
method("hello_world", callable_from_ruby as *const _, 0).
method("foo", callable_from_ruby as *const _, 0).
build();
loop {
let mut line = String::new();
std::io::stdin().read_line(&mut line).unwrap();
let result = vm.eval(&line);
println!("{:?}", result);
}
}