diff --git a/src/main.rs b/examples/rhai_runner.rs similarity index 78% rename from src/main.rs rename to examples/rhai_runner.rs index 31ded9a5..1b6730a2 100644 --- a/src/main.rs +++ b/examples/rhai_runner.rs @@ -3,24 +3,8 @@ use std::fs::File; use std::io::prelude::*; use std::fmt::Display; -mod engine; -use engine::Engine; - -mod fn_register; -use fn_register::FnRegister; - -mod parser; - -// Todo (in no particular order): -// * Doc some examples -// * Maintaining state -// * Overloading -// * How it works -// * Vectors -// * Return -// * Tighten parser? -// * Errors with positions? -// * Remove empty box values? +extern crate rhai; +use rhai::{Engine, FnRegister}; fn showit(x: &mut T) -> () { println!("{}", x) @@ -51,3 +35,4 @@ fn main() { } } } + diff --git a/examples/assignment.rhai b/scripts/assignment.rhai similarity index 100% rename from examples/assignment.rhai rename to scripts/assignment.rhai diff --git a/examples/function_decl1.rhai b/scripts/function_decl1.rhai similarity index 100% rename from examples/function_decl1.rhai rename to scripts/function_decl1.rhai diff --git a/examples/function_decl2.rhai b/scripts/function_decl2.rhai similarity index 100% rename from examples/function_decl2.rhai rename to scripts/function_decl2.rhai diff --git a/examples/function_decl3.rhai b/scripts/function_decl3.rhai similarity index 100% rename from examples/function_decl3.rhai rename to scripts/function_decl3.rhai diff --git a/examples/if1.rhai b/scripts/if1.rhai similarity index 100% rename from examples/if1.rhai rename to scripts/if1.rhai diff --git a/examples/op1.rhai b/scripts/op1.rhai similarity index 100% rename from examples/op1.rhai rename to scripts/op1.rhai diff --git a/examples/op2.rhai b/scripts/op2.rhai similarity index 100% rename from examples/op2.rhai rename to scripts/op2.rhai diff --git a/examples/op3.rhai b/scripts/op3.rhai similarity index 100% rename from examples/op3.rhai rename to scripts/op3.rhai diff --git a/examples/speed_test.rhai b/scripts/speed_test.rhai similarity index 100% rename from examples/speed_test.rhai rename to scripts/speed_test.rhai diff --git a/examples/string.rhai b/scripts/string.rhai similarity index 100% rename from examples/string.rhai rename to scripts/string.rhai diff --git a/examples/while.rhai b/scripts/while.rhai similarity index 100% rename from examples/while.rhai rename to scripts/while.rhai diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 00000000..7386c075 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,19 @@ +//! Rhai - embedded scripting for Rust + + +// Todo (in no particular order): +// * Doc some examples +// * Maintaining state +// * Overloading +// * How it works +// * Vectors +// * Tighten parser? +// * Errors with positions? + +mod engine; + +mod fn_register; +mod parser; + +pub use engine::Engine; +pub use fn_register::FnRegister;