Rhai v1.10.0 Release Notes

  • This version introduces Fast Operators mode, which is turned on by default but can be disabled via a new options API: Engine::set_fast_operators.

    Fast Operators mode assumes that none of Rhai's built-in operators for standard data types are overloaded by user-registered functions. In the vast majority of cases this should be so (really, who overloads the + operator for integers anyway?).

    This assumption allows the Engine to avoid checking for overloads for every single operator call. This usually results in substantial speed improvements, especially for expressions.

    Minimum Rust Version

    The minimum Rust version is now 1.61.0 in order to use some const generics.

    ๐Ÿ› Bug fixes

    • API for registering property getters/setters and indexers to an Engine now works with functions that take a first parameter of NativeCallContext.
    • Missing API function Module::set_getter_setter_fn is added.
    • To avoid subtle errors, simple optimization is used for rhai-run; previous it was full optimization.

    ๐Ÿ—„ Deprecated API

    • All versions of the Engine::register_XXX_result API that register a function returning Result<T, Box<EvalAltResult>> are now deprecated. The regular, non-result versions handle all functions correctly.

    ๐Ÿ†• New features

    Fast operators

    • 0๏ธโƒฃ A new option Engine::fast_operators is introduced (default to true) to enable/disable Fast Operators mode.

    Fallible type iterators

    • For very special needs, the ability to register fallible type iterators is added.

    Expressions

    • if-expressions are allowed in Engine::eval_expression and Engine::compile_expression provided that both statement blocks each contain at most a single expression.
    • switch-expressions are allowed in Engine::eval_expression and Engine::compile_expression provided that match actions are expressions only.

    โœจ Enhancements

    • is_empty method is added to arrays, BLOB's, object maps, strings and ranges.
    • StaticModuleResolver now stores the path in the module's id field.
    • Engine::module_resolver is added to grant access to the Engine's module resolver.
    • Constants and variables now have types in generated definition files.