From bbed4c6ef45a986163c75474a1a91a22a12c5c2c Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Sun, 24 May 2020 23:42:40 +0800 Subject: [PATCH] Docs. --- README.md | 16 +++++++++++++++- RELEASES.md | 5 +++-- src/token.rs | 4 ++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 24027eec..7801ebbd 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,8 @@ Rhai - Embedded Scripting for Rust Rhai is an embedded scripting language and evaluation engine for Rust that gives a safe and easy way to add scripting to any application. -Rhai's current features set: +Features +-------- * Easy-to-use language similar to JS+Rust with dynamic typing but _no_ garbage collector. * Tight integration with native Rust [functions](#working-with-functions) and [types](#custom-types-and-methods), @@ -38,6 +39,19 @@ Rhai's current features set: **Note:** Currently, the version is 0.14.2, so the language and API's may change before they stabilize. +What Rhai doesn't do +-------------------- + +Rhai's purpose is to provide a dynamic layer over Rust code, in the same spirit of _zero cost abstractions_. +It doesn't attempt to be a new language. For example: + +* No classes. Well, Rust doesn't either. On the other hand... +* No traits... so it is also not Rust. Do your Rusty stuff in Rust. +* No structures - definte your types in Rust instead; Rhai can seamless work with _any Rust type_. +* No first-class functions - Code your functions in Rust instead, and register them with Rhai. +* No closures - do your closure magic in Rust instead; [turn a Rhai scripted function into a Rust closure](#calling-rhai-functions-from-rust). +* It is best to expose an API in Rhai for scripts to call. All your core functionalities should be in Rust. + Installation ------------ diff --git a/RELEASES.md b/RELEASES.md index 42d2f77d..d5251d9c 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -17,7 +17,7 @@ Breaking changes `Result>`. * Default maximum limit on levels of nested function calls is fine-tuned and set to a different value. * Some operator functions are now built in (see _Speed enhancements_ below), so they are available even - when under `Engine::new_raw`. + under `Engine::new_raw`. New features ------------ @@ -31,7 +31,8 @@ Speed enhancements * Common operators (e.g. `+`, `>`, `==`) now call into highly efficient built-in implementations for standard types (i.e. `INT`, `FLOAT`, `bool`, `char`, `()` and some `String`) if not overridden by a registered function. - This yields a 5-10% speed benefit depending on script operator usage. + This yields a 5-10% speed benefit depending on script operator usage. Scripts running tight loops will see + significant speed-up. * Implementations of common operators for standard types are removed from the `ArithmeticPackage` and `LogicPackage` (and therefore the `CorePackage`) because they are now always available, even under `Engine::new_raw`. diff --git a/src/token.rs b/src/token.rs index 97df2d54..dda005a9 100644 --- a/src/token.rs +++ b/src/token.rs @@ -21,8 +21,8 @@ type LERR = LexError; /// A location (line number + character position) in the input script. /// -/// In order to keep footprint small, both line number and character position have 16-bit resolution, -/// meaning they go up to a maximum of 65,535 lines/characters per line. +/// In order to keep footprint small, both line number and character position have 16-bit unsigned resolution, +/// meaning they go up to a maximum of 65,535 lines and characters per line. /// Advancing beyond the maximum line length or maximum number of lines is not an error but has no effect. #[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub struct Position {