wren-rs

Crates.iowren-rs
lib.rswren-rs
version0.1.0
sourcesrc
created_at2015-01-06 13:50:56.925955
updated_at2015-12-11 23:59:34.806356
descriptionEmbed the Wren programming language in your Rust program
homepagehttps://github.com/pwoolcoc/wren-rs
repositoryhttps://github.com/pwoolcoc/wren-rs
max_upload_size
id724
size3,168
Paul Woolcock (pwoolcoc)

documentation

README

Wren for Rust

You can use this library to interpret Wren code in your Rust programs.

Use

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"),
    }
}
Commit count: 10

cargo fmt