Crates.io | wren-rs |
lib.rs | wren-rs |
version | 0.1.0 |
source | src |
created_at | 2015-01-06 13:50:56.925955 |
updated_at | 2015-12-11 23:59:34.806356 |
description | Embed the Wren programming language in your Rust program |
homepage | https://github.com/pwoolcoc/wren-rs |
repository | https://github.com/pwoolcoc/wren-rs |
max_upload_size | |
id | 724 |
size | 3,168 |
You can use this library to interpret Wren code in your Rust programs.
extern crate wren;
use std::default::Default;
use wren::{VM, Error};
fn main() {
let source = r#"
class Unicorn {
hasHorn {
return true
}
}
"#;
let vm = VM::new(Default::default()); // loads the VM with the default VM config
match vm.interpret("Test", source) {
Err(Error::CompileError(msg)) => println!("Compile Error: {}", msg),
Err(Error::RuntimeError(msg)) => println!("Runtime Error: {}", msg),
Err(Error::UnknownError(msg)) => println!("Unknown Error: {}", msg),
_ => println!("Successfully ran wren source"),
}
}