Change version to 0.15.1.
This commit is contained in:
parent
95f94a3348
commit
13cde456e5
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rhai"
|
name = "rhai"
|
||||||
version = "0.16.0"
|
version = "0.15.1"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
authors = ["Jonathan Turner", "Lukáš Hozda", "Stephen Chung"]
|
authors = ["Jonathan Turner", "Lukáš Hozda", "Stephen Chung"]
|
||||||
description = "Embedded scripting for Rust"
|
description = "Embedded scripting for Rust"
|
||||||
|
18
README.md
18
README.md
@ -37,7 +37,7 @@ Features
|
|||||||
to do checked arithmetic operations); for [`no-std`](#optional-features) builds, a number of additional dependencies are
|
to do checked arithmetic operations); for [`no-std`](#optional-features) builds, a number of additional dependencies are
|
||||||
pulled in to provide for functionalities that used to be in `std`.
|
pulled in to provide for functionalities that used to be in `std`.
|
||||||
|
|
||||||
**Note:** Currently, the version is `0.16.0`, so the language and API's may change before they stabilize.
|
**Note:** Currently, the version is `0.15.1`, so the language and API's may change before they stabilize.
|
||||||
|
|
||||||
What Rhai doesn't do
|
What Rhai doesn't do
|
||||||
--------------------
|
--------------------
|
||||||
@ -71,7 +71,7 @@ Install the Rhai crate on [`crates.io`](https::/crates.io/crates/rhai/) by addin
|
|||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rhai = "0.16.0"
|
rhai = "0.15.1"
|
||||||
```
|
```
|
||||||
|
|
||||||
Use the latest released crate version on [`crates.io`](https::/crates.io/crates/rhai/):
|
Use the latest released crate version on [`crates.io`](https::/crates.io/crates/rhai/):
|
||||||
@ -315,7 +315,7 @@ Functions declared with `private` are hidden and cannot be called from Rust (see
|
|||||||
```rust
|
```rust
|
||||||
// Define functions in a script.
|
// Define functions in a script.
|
||||||
let ast = engine.compile(true,
|
let ast = engine.compile(true,
|
||||||
r"
|
r#"
|
||||||
// a function with two parameters: String and i64
|
// a function with two parameters: String and i64
|
||||||
fn hello(x, y) {
|
fn hello(x, y) {
|
||||||
x.len + y
|
x.len + y
|
||||||
@ -335,7 +335,7 @@ let ast = engine.compile(true,
|
|||||||
private hidden() {
|
private hidden() {
|
||||||
throw "you shouldn't see me!";
|
throw "you shouldn't see me!";
|
||||||
}
|
}
|
||||||
")?;
|
"#)?;
|
||||||
|
|
||||||
// A custom scope can also contain any variables/constants available to the functions
|
// A custom scope can also contain any variables/constants available to the functions
|
||||||
let mut scope = Scope::new();
|
let mut scope = Scope::new();
|
||||||
@ -522,7 +522,7 @@ The following primitive types are supported natively:
|
|||||||
| **Floating-point number** (disabled with [`no_float`]) | `f32`, `f64` _(default)_ | `"f32"` or `"f64"` | `"123.4567"` etc. |
|
| **Floating-point number** (disabled with [`no_float`]) | `f32`, `f64` _(default)_ | `"f32"` or `"f64"` | `"123.4567"` etc. |
|
||||||
| **Boolean value** | `bool` | `"bool"` | `"true"` or `"false"` |
|
| **Boolean value** | `bool` | `"bool"` | `"true"` or `"false"` |
|
||||||
| **Unicode character** | `char` | `"char"` | `"A"`, `"x"` etc. |
|
| **Unicode character** | `char` | `"char"` | `"A"`, `"x"` etc. |
|
||||||
| **Immutable Unicode string** | `rhai::ImmutableString` (implemented as `Rc<String>` or `Arc<String>`, _not_ `&str`) | `"string"` | `"hello"` etc. |
|
| **Immutable Unicode string** | `rhai::ImmutableString` (implemented as `Rc<String>` or `Arc<String>`) | `"string"` | `"hello"` etc. |
|
||||||
| **Array** (disabled with [`no_index`]) | `rhai::Array` | `"array"` | `"[ ?, ?, ? ]"` |
|
| **Array** (disabled with [`no_index`]) | `rhai::Array` | `"array"` | `"[ ?, ?, ? ]"` |
|
||||||
| **Object map** (disabled with [`no_object`]) | `rhai::Map` | `"map"` | `#{ "a": 1, "b": 2 }` |
|
| **Object map** (disabled with [`no_object`]) | `rhai::Map` | `"map"` | `#{ "a": 1, "b": 2 }` |
|
||||||
| **Timestamp** (implemented in the [`BasicTimePackage`](#packages)) | `std::time::Instant` | `"timestamp"` | _not supported_ |
|
| **Timestamp** (implemented in the [`BasicTimePackage`](#packages)) | `std::time::Instant` | `"timestamp"` | _not supported_ |
|
||||||
@ -1039,13 +1039,13 @@ struct TestStruct {
|
|||||||
field: String
|
field: String
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remember Rhai uses 'ImmutableString' instead of 'String'
|
|
||||||
impl TestStruct {
|
impl TestStruct {
|
||||||
fn get_field(&mut self) -> ImmutableString {
|
// Returning a 'String' is OK - Rhai converts it into 'ImmutableString'
|
||||||
// Make an 'ImmutableString' from a 'String'
|
fn get_field(&mut self) -> String {
|
||||||
self.field.into(0)
|
self.field.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remember Rhai uses 'ImmutableString' or '&str' instead of 'String'
|
||||||
fn set_field(&mut self, new_val: ImmutableString) {
|
fn set_field(&mut self, new_val: ImmutableString) {
|
||||||
// Get a 'String' from an 'ImmutableString'
|
// Get a 'String' from an 'ImmutableString'
|
||||||
self.field = (*new_val).clone();
|
self.field = (*new_val).clone();
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
Rhai Release Notes
|
Rhai Release Notes
|
||||||
==================
|
==================
|
||||||
|
|
||||||
Version 0.16.0
|
Version 0.15.1
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
This is a minor release which enables updating indexers (via registered indexer setters) and supports functions
|
||||||
|
with `&str` parameters (maps transparently to `ImmutableString`).
|
||||||
|
|
||||||
Breaking changes
|
Breaking changes
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
@ -14,13 +17,15 @@ Breaking changes
|
|||||||
New features
|
New features
|
||||||
------------
|
------------
|
||||||
|
|
||||||
* Indexers are now split into getters ans setters (which now support updates). The API is split into `Engine::register_indexer_get` and `Engine::register_indexer_set` with `Engine::register_indexer_get_set` being a shorthand. Similarly, `Module::set_indexer_get_fn` and `Module::set_indexer_set_fn` are added.
|
* Indexers are now split into getters and setters (which now support updates). The API is split into `Engine::register_indexer_get` and `Engine::register_indexer_set` with `Engine::register_indexer_get_set` being a shorthand. Similarly, `Module::set_indexer_get_fn` and `Module::set_indexer_set_fn` are added.
|
||||||
* `Engine:register_fn` and `Engine:register_result_fn` accepts functions that take parameters of type `&str` (immutable string slice), which maps directly to `ImmutableString`. This is to avoid needing wrappers for functions taking string parameters.
|
* `Engine:register_fn` and `Engine:register_result_fn` accepts functions that take parameters of type `&str` (immutable string slice), which maps directly to `ImmutableString`. This is to avoid needing wrappers for functions taking string parameters.
|
||||||
|
|
||||||
|
|
||||||
Version 0.15.0
|
Version 0.15.0
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
This version uses immutable strings (`ImmutableString` type) and built-in operator functions (e.g. `+`, `>`, `+=`) to improve speed, plus some bug fixes.
|
||||||
|
|
||||||
Regression fix
|
Regression fix
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
@ -74,6 +74,4 @@ fn main() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
println!();
|
println!();
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user