Add Dynamic::is_XXX API.

This commit is contained in:
Stephen Chung
2022-11-09 12:44:57 +08:00
parent ad018aaae3
commit ce046422f0
22 changed files with 327 additions and 91 deletions

View File

@@ -25,6 +25,11 @@ Breaking changes
New features
------------
### `Dynamic` detection API
* New methods are added to `Dynamic` in the form of `is_XXX()` where `XXX` is a type (e.g. `is_int`, `is_unit`, `is_bool`, `is_array`).
* This new API is to make it easier to detect the data type, instead of having to call `is::<XXX>()`.
### Loop expressions
* Loops (such as `loop`, `do`, `while` and `for`) can now act as _expressions_, with the `break` statement returning an optional value.
@@ -37,9 +42,9 @@ New features
* This is necessary when using Rhai across shared-library boundaries.
* A build script is used to extract the environment variable (`RHAI_AHASH_SEED`, if any) and splice it into the source code before compilation.
### No Timestamps
### `no_time` for no timestamps
* A new feature, `no_time`, is added to disable support timestamps.
* A new feature, `no_time`, is added to disable support for timestamps.
* This may be necessary when building for architectures without time support, such as raw WASM.
### Serializable `Scope`