From 049ad3b6fd9fbd9317b60a9b2bf103b1482b65e4 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Tue, 29 Dec 2020 15:36:42 +0800 Subject: [PATCH] Move rhai-repl and rhai-doc to bin. --- RELEASES.md | 1 + doc/src/SUMMARY.md | 15 ++++++++------- doc/src/start/bin.md | 24 ++++++++++++++++++++++++ doc/src/start/examples/rust.md | 5 ----- examples/README.md | 2 +- src/bin/README.md | 12 ++++++++++++ {examples => src/bin}/rhai-repl.rs | 0 {examples => src/bin}/rhai-run.rs | 0 8 files changed, 46 insertions(+), 13 deletions(-) create mode 100644 doc/src/start/bin.md create mode 100644 src/bin/README.md rename {examples => src/bin}/rhai-repl.rs (100%) rename {examples => src/bin}/rhai-run.rs (100%) diff --git a/RELEASES.md b/RELEASES.md index ba43f472..bd6357b2 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -33,6 +33,7 @@ Enhancements * `Engine::register_static_module` now supports sub-module paths (e.g. `foo::bar::baz`). * `Engine::register_custom_operator` now accepts reserved symbols. * `Engine::register_custom_operator` now returns an error if given a precedence of zero. +* The examples `repl` and `rhai_runner` are moved into `bin` and renamed `rhai-repl` and `rhai-run` respectively. Version 0.19.8 diff --git a/doc/src/SUMMARY.md b/doc/src/SUMMARY.md index 4b3e7e30..39643675 100644 --- a/doc/src/SUMMARY.md +++ b/doc/src/SUMMARY.md @@ -16,7 +16,8 @@ The Rhai Scripting Language 2. [Minimal](start/builds/minimal.md) 3. [no-std](start/builds/no-std.md) 4. [WebAssembly (WASM)](start/builds/wasm.md) - 5. [Examples](start/examples/index.md) + 5. [Tools](start/bin.md) + 6. [Examples](start/examples/index.md) 1. [Rust](start/examples/rust.md) 2. [Scripts](start/examples/scripts.md) 3. [Using the `Engine`](engine/index.md) @@ -34,22 +35,22 @@ The Rhai Scripting Language 1. [String Parameters in Rust Functions](rust/strings.md) 3. [Register a Generic Rust Function](rust/generic.md) 4. [Register a Fallible Rust Function](rust/fallible.md) - 6. [Override a Built-in Function](rust/override.md) - 7. [Operator Overloading](rust/operators.md) - 8. [Register any Rust Type and its Methods](rust/custom.md) + 5. [Override a Built-in Function](rust/override.md) + 6. [Operator Overloading](rust/operators.md) + 7. [Register any Rust Type and its Methods](rust/custom.md) 1. [Property Getters and Setters](rust/getters-setters.md) 2. [Indexers](rust/indexers.md) 3. [Disable Custom Types](rust/disable-custom.md) 4. [Printing Custom Types](rust/print-custom.md) - 9. [Modules](rust/modules/index.md) + 8. [Modules](rust/modules/index.md) 1. [Create from Rust](rust/modules/create.md) 2. [Create from AST](rust/modules/ast.md) 3. [Module Resolvers](rust/modules/resolvers.md) 1. [Custom Module Resolvers](rust/modules/imp-resolver.md) - 10. [Plugins](plugins/index.md) + 9. [Plugins](plugins/index.md) 1. [Export a Rust Module](plugins/module.md) 2. [Export a Rust Function](plugins/function.md) - 11. [Packages](rust/packages/index.md) + 10. [Packages](rust/packages/index.md) 1. [Built-in Packages](rust/packages/builtin.md) 2. [Custom Packages](rust/packages/create.md) 5. [Rhai Language Reference](language/index.md) diff --git a/doc/src/start/bin.md b/doc/src/start/bin.md new file mode 100644 index 00000000..a006cad9 --- /dev/null +++ b/doc/src/start/bin.md @@ -0,0 +1,24 @@ +Rhai Tools +========== + +{{#include ../links.md}} + +A number of Rhai tools can be found in the `src/bin` directory: + +| Tool | Description | +| ------------------------------------------------- | ----------------------------------------------------------- | +| [`rhai-repl`]({{repoTree}}/examples/rhai-repl.rs) | a simple REPL, interactively evaluate statements from stdin | +| [`rhai-run`]({{repoTree}}/examples/rhai-run.rs) | runs each filename passed to it as a Rhai script | + +`rhai-repl` is particularly useful - it allows one to interactively try out Rhai's +language features in a standard REPL (**R**ead-**E**val-**P**rint **L**oop). + + +Running a Tool +-------------- + +Tools can be run with the following command: + +```bash +cargo run --bin {tool_name} +``` diff --git a/doc/src/start/examples/rust.md b/doc/src/start/examples/rust.md index 0b343a52..b46d7249 100644 --- a/doc/src/start/examples/rust.md +++ b/doc/src/start/examples/rust.md @@ -11,15 +11,10 @@ A number of examples can be found in the `examples` directory: | [`custom_types_and_methods`]({{repoTree}}/examples/custom_types_and_methods.rs) | shows how to register a custom Rust type and methods for it | | [`hello`]({{repoTree}}/examples/hello.rs) | simple example that evaluates an expression and prints the result | | [`reuse_scope`]({{repoTree}}/examples/reuse_scope.rs) | evaluates two pieces of code in separate runs, but using a common [`Scope`] | -| [`rhai-repl`]({{repoTree}}/examples/rhai-repl.rs) | a simple REPL, interactively evaluate statements from stdin | -| [`rhai-run`]({{repoTree}}/examples/rhai-run.rs) | runs each filename passed to it as a Rhai script | | [`serde`]({{repoTree}}/examples/serde.rs) | example to serialize and deserialize Rust types with [`serde`](https://crates.io/crates/serde).
The [`serde`] feature is required to run | | [`simple_fn`]({{repoTree}}/examples/simple_fn.rs) | shows how to register a simple function | | [`strings`]({{repoTree}}/examples/strings.rs) | shows different ways to register functions taking string arguments | -The `rhai-repl` example is a particularly good one as it allows one to interactively try out Rhai's -language features in a standard REPL (**R**ead-**E**val-**P**rint **L**oop). - Running Examples ---------------- diff --git a/examples/README.md b/examples/README.md index 610f388e..a3468bcb 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,7 +1,7 @@ Sample Applications =================== -Sample applications written in Rhai. +Sample applications that use the Rhai scripting engine. How to Run diff --git a/src/bin/README.md b/src/bin/README.md new file mode 100644 index 00000000..1ba7e865 --- /dev/null +++ b/src/bin/README.md @@ -0,0 +1,12 @@ +Rhai Tools +========== + +Tools written in Rhai. + + +How to Run +---------- + +```bash +cargo run --bin sample_app_to_run +``` diff --git a/examples/rhai-repl.rs b/src/bin/rhai-repl.rs similarity index 100% rename from examples/rhai-repl.rs rename to src/bin/rhai-repl.rs diff --git a/examples/rhai-run.rs b/src/bin/rhai-run.rs similarity index 100% rename from examples/rhai-run.rs rename to src/bin/rhai-run.rs