wren-rs 0.1.0

Embed the Wren programming language in your Rust program
docs.rs failed to build wren-rs-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

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