rhai/doc/src/about/features.md

61 lines
2.3 KiB
Markdown
Raw Normal View History

2020-06-20 06:06:17 +02:00
Features
========
{{#include ../links.md}}
Easy
----
* Easy-to-use language similar to JS+Rust with dynamic typing.
2020-06-20 09:57:15 +02:00
* Tight integration with native Rust [functions]({{rootUrl}}/rust/functions.md) and [types]({{rootUrl}}/rust/custom.md), including [getters/setters]({{rootUrl}}/rust/getters-setters.md), [methods]({{rootUrl}}/rust/custom.md) and [indexers]({{rootUrl}}/rust/indexers.md).
2020-06-20 06:06:17 +02:00
* Freely pass Rust variables/constants into a script via an external [`Scope`].
2020-06-20 09:57:15 +02:00
* Easily [call a script-defined function]({{rootUrl}}/engine/call-fn.md) from Rust.
2020-06-20 06:06:17 +02:00
* Very few additional dependencies (right now only [`num-traits`](https://crates.io/crates/num-traits/) to do checked arithmetic operations);
for [`no-std`] builds, a number of additional dependencies are pulled in to provide for functionalities that used to be in `std`.
Fast
----
* Fairly low compile-time overhead.
* Fairly efficient evaluation (1 million iterations in 0.25 sec on a single core, 2.3 GHz Linux VM).
2020-06-20 09:57:15 +02:00
* Scripts are [optimized]({{rootUrl}}/engine/optimize.md) (useful for template-based machine-generated scripts) for repeated evaluations.
2020-06-20 06:06:17 +02:00
Dynamic
-------
2020-06-20 09:57:15 +02:00
* [Function overloading]({{rootUrl}}/language/overload.md).
2020-06-20 06:06:17 +02:00
2020-06-20 09:57:15 +02:00
* [Operator overloading]({{rootUrl}}/rust/operators.md).
2020-06-20 06:06:17 +02:00
* Organize code base with dynamically-loadable [modules].
Safe
----
* Relatively little `unsafe` code (yes there are some for performance reasons, and most `unsafe` code is limited to
one single source file, all with names starting with `"unsafe_"`).
Rugged
------
* Sand-boxed - the scripting [`Engine`], if declared immutable, cannot mutate the containing environment unless explicitly permitted (e.g. via a `RefCell`).
2020-06-20 09:57:15 +02:00
* Protected against malicious attacks (such as [stack-overflow]({{rootUrl}}/safety/max-call-stack.md), [over-sized data]({{rootUrl}}/safety/max-string-size.md), and [runaway scripts]({{rootUrl}}/safety/max-operations.md) etc.) that may come from untrusted third-party user-land scripts.
2020-06-20 06:06:17 +02:00
* Track script evaluation [progress] and manually terminate a script run.
Flexible
--------
* Re-entrant scripting [`Engine`] can be made `Send + Sync` (via the [`sync`] feature).
* Support for [minimal builds] by excluding unneeded language [features].
* Supports [most build targets](targets.md) including `no-std` and [WASM].