wren-rs

Embed the Wren programming language in your Rust program


License
MIT

Documentation

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"),
    }
}