NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #3057 most downloaded on crates.io
Procedural macros support package for Rhai, a scripting language and engine for Rust
Last release 4 months ago
24 May 2026
Release timing varies
gaps range from 4 weeks to 1.2 years
Some releases are documented
notes for 8 of 26 stable releases
2 versions withdrawn
withdrawn after publishing
6 years old
28 releases · first in 2020
One column per quarter.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
ImmutableString now derefs to &str instead of &SmartString. Normally this should not be a breaking change.
Starting from this version, the official preferred method of registering an API for a custom type is via the #[derive(CustomType)] macro. The old API is still available for types that reside in external crates (and thus cannot implement CustomType).
Starting from this version, the new FuncRegistration API is preferred for registering native Rust functions into a Module. The old API is still available but deprecated.
Starting from this version, fuzzing via Google OSS-Fuzz is used to flush out hidden bugs and edge cases. This should result in higher code quality, better stability and improved security. And indeed, a large number of bugs have been discovered from this and fixed.
ImmutableString now derefs to &str instead of &SmartString. Normally this should not be a breaking change.ImmutableString are cleaned up. Normally this should not be a breaking change.EvalContext::new, FloatWrapper and ConditionalExpr are now gated under internals.@silvergasp for setting up fuzzing.#[derive(CustomType)] is now available, driven by procedural macros in rhai_codegen (thanks @MavethGH #817).FuncRegistration API is added to assist in registering native Rust functions into modules with various settings. Some of the original Module::set_fn... API is now deprecated.volatile which prevents it from being optimized away even under OptimizationLevel::Full.Engine::max_functions and Engine::set_max_functions to limit the maximum number of functions allowed in a script. This is to guard against DOS attacks -- e.g. a simple closure || (two characters) is a function. When max_function is exceeded during script compilation, a new parse error, ParseErrorType::TooManyFunctions, is returned.Engine::get_interned_string is made public instead of gated under internals.rhai::config::hashing::set_ahash_seed, rhai::config::hashing::get_ahash_seed and the RHAI_AHASH_SEED environment variable are deprecated in favor of rhai::config::hashing::set_hashing_seed, rhai::config::hashing::get_hashing_seed and RHAI_HASHING_SEED.AST::clear_doc is deprecated.Module::update_XXX API is deprecated in favor of using the FuncRegistration API.Module::gen_fn_signatures is deprecated in favor of Module::gen_fn_signatures_with_mapper.**.(a.b).c.Dynamic parameters with more than 16 parameters.sleep no longer panics on NaN.switch on ranges now work properly.to_json() when the serde feature is not enabled.Engine::format_map_as_json now serializes arrays correctly.Engine::gen_fn_signatures(false) now properly skips functions in the standard library.TypeBuilder::with_name now properly sets the display-name of the type for use in generating metadata.to_int method for characters.Token::FloatConstant and Token::DecimalConstant now carry the original text representation for use in, say, a token mapper.Dynamic::is_fnptr is made a public API.Scope::get_value_ref and Scope::get_value_mut are added.TypeBuilder::with_name now takes any &str instead of just &'static str.Engine::gen_fn_signatures now formats the function signatures using pretty-print names of custom types.This version, in particular, fixes a plugin macro hygiene error for the nightly compiler:
This version, in particular, fixes a plugin macro hygiene error for the nightly compiler:
error[E0425]: cannot find value `args` in this scope
1.57 due to smartstring dependency.a.b::c.d or a.b::func() no longer panics but properly returns a syntax error.Scope::is_constant now returns the correct value.FnAccess and FnNamespace now implement Ord and PartialOrd.event_handler_map example is enhanced to prevent shadowing of the state object map.sleep is added to block the current thread by a specified number of seconds.Scope::set_alias is added to export a variable under a particular alias name.starts_with and ends_with are added for strings.register_global_module can now be accessed in the global namespace.Dynamic::into_read_only is added to convert a Dynamic value into constant.Module now holds a collection of custom types with an API.This version adds a debugging interface, which can be used to integrate a debugger.
This version adds a debugging interface, which can be used to integrate a debugger.
Based on popular demand, an option is added to throw exceptions when invalid properties are accessed on object maps (default is to return ()).
Also based on popular demand, the REPL tool now uses a slightly-enhanced version of rustyline for line editing and history.
Scope::clone_visible, constants are now properly cloned as constants.try blocks are now properly cleaned up upon an exception.catch-ed.import statement, the export statement no longer exports multiple variables.+, +=, append or string interpolation) now treats the BLOB as a UTF-8 encoded string.+= or append) now adds the string/character as a UTF-8 encoded byte stream.rhai-dbg (aka The Rhai Debugger), is added to showcase the debugging interface.DebuggingPackage, is added which contains the back_trace function to get the current call stack anywhere in a script.Engine::set_fail_on_invalid_map_property is added to control whether to raise an error (new EvalAltResult::ErrorPropertyNotFound) when invalid properties are accessed on object maps.Engine::set_allow_shadowing is added to allow/disallow variables shadowing, with new errors EvalAltResult::ErrorVariableExists and ParseErrorType::VariableExists.Engine::on_def_var allows registering a closure which can decide whether a variable definition is allow to continue, during compilation or runtime, or should fail with an error (ParseErrorType::ForbiddenVariable or EvalAltResult::ErrorForbiddenVariable).$crate meta variable).ahash/std and num-traits/std) are no longer required.no_module feature now eliminates large sections of code via feature gates.AST is improved.NativeCallContext::call_level() is added to give the current nesting level of function calls.bin-features, pulls in all the required features for bin tools.AST position display is improved:
Expr::start_position is added to give the beginning of the expression (not the operator's position).StmtBlock and Stmt::Block now keep the position of the closing } as well.EvalAltResult::unwrap_inner is added to access the base error inside multiple layers of wrappings (e.g. EvalAltResult::ErrorInFunction).def_package! that further simplifies the old syntax.to_blob is added to convert a string into a BLOB as UTF-8 encoded bytes.to_array is added to convert a BLOB into array of integers.The REPL bin tool, rhai-rpl, has been enhanced.
rustyline feature is now required in order to build rhai-repl.rhai-repl is no longer automatically built when using a simple cargo build with default features.rhai-repl now uses a modified version of rustyline as a line editor with history.\ continuation character the end of each line.rhai-repl is made much more convenient.strict to turn on/off Strict Variables Mode.optimize to turn on/off script optimization.history to print lines history.!!, !num, !text and !?text to recall a history line.keys to print all key bindings.Nothing published for this version
Nothing published for this version
This is primarily a bug-fix version which fixes a large number of bugs.
This is primarily a bug-fix version which fixes a large number of bugs.
x = x + 1 no longer panics.pad no longer loops indefinitely.chop for arrays and BLOB's now works properly.set_bit for bit-flags with negative index now works correctly.params field name in the JSON output of Engine::gen_fn_metadata_to_json is fixed (was incorrectly named type).unsafe violation in for loop.to_hex, to_octal and to_binary for i128 and u128 are added.remove for arrays and BLOB's now treat negative index correctly.parse_int now works properly for negative numbers.Engine::gen_fn_signatures now generates signatures for external packages registered via Engine::register_global_module.\r\n pairs are now recognized correctly for doc-comments.SmartString for Scope variable names and remove unsafe lifetime casting.Engine::gen_fn_metadata_to_json).get and set methods are added to arrays, BLOB's, object maps and strings.Expression::get_variable_name is deprecated in favor of the new Expression::get_string_value.
This version adds support for integer ranges via the .. and ..= operators.
Many standard API's are extended with range parameters where appropriate.
is is (pun intended) now a reserved keyword to prepare for possible future type checking expressions (e.g. x is "string").LogicPackage is removed from CorePackage.BitFieldPackage (used to be in LogicPackage) which makes more sense.INT integer types are now treated exactly as custom types under only_i64 and only_i32.pad on an array now checks for total size over limit after each item added... and ..= operators.EvalAltResult::ErrorCustomSyntax to catch errors in custom syntax, which should not happen unless an AST is compiled on one Engine but evaluated on another unrelated Engine.BLOB's are refined to display in a more compact hex format.def_package! that will replace the old syntax in future versions.NativeCallContext::call_fn to easily call a function.Expression::get_variable_name is deprecated in favor of the new Expression::get_string_value.def_package! is deprecated in favor of the new syntax.NativeCallContext::new is deprecated because it is simpler to call a function pointer via FnPtr::call.
This version adds native support for BLOB's (byte arrays), as well as a number of configuration
settings to fine-tun language features.
from_dynamic now supports deserializing Option.BLOB (essentially a byte array) is added as a supported primitive value type parallel to arrays.Engine which allows disabling if-expressions, switch-expressions, statement expressions, anonymous functions and/or looping (i.e. while, loop, do and for statements):
Engine::set_allow_if_expressionEngine::set_allow_switch_expressionEngine::set_allow_statement_expressionEngine::set_allow_anonymous_fnEngine::set_allow_loopingEngine (enabled via Engine::set_strict_variables) to throw parse errors on undefined variable usage. Two new parse error variants, ParseErrorType::VariableNotFound and ParseErrorType::ModuleNotFound, are added."") in a string literal now maps to "; two back-ticks (``) in a literal string now maps to `.Engine::register_type_with_name_raw to register a custom type based on a fully-qualified type path.into_array and into_typed_array for Dynamic.FnPtr::call and FnPtr::call_within_context to simplify calling a function pointer.baseHash field in the JSON object should map directly to the pre-calculated hash in the function call.Expression now derefs to Expr.NativeCallContext::new is deprecated because it is simpler to call a function pointer via FnPtr::call.AST::merge_filtered and AST::combine_filtered are no longer exported under no_function.AST::new and AST::new_with_source are moved under internals.FnPtr::call_dynamic is deprecated in favor of FnPtr::call_raw.Engine::call_fn_dynamic is deprecated and Engine::call_fn_raw is added which allows keeping new variables in the custom scope.
!) now operates directly on the caller's scope, allowing variables inside the scope to be mutated.Engine::XXX_with_scope API's now properly propagate constants within the provided scope also to functions in the script.0.0).func!() calls now work properly under no_closure.if foo { ... } -x parses correctly.#[cfg(...)] attributes can now be put directly on plugin functions or function defined in a plugin module.$$ to inform the implementation function which syntax variant was actually parsed.AST::iter_literal_variables is added to extract all top-level literal constant/variable definitions from a script without running it.Engine::call_fn_dynamic is deprecated and Engine::call_fn_raw is added which allows keeping new variables in the custom scope.dedup method.sort method with no parameters which sorts homogeneous arrays of built-in comparable types (e.g. INT).optimize module is completely eliminated under no_optimize, which should yield smaller code size.NativeCallContext::position is added to return the position of the function call.Scope::clone_visible is added that copies only the last instance of each variable, omitting all shadowed variables.NativeCallContext::call_fn_dynamic_raw is deprecated and NativeCallContext::call_fn_raw is added.From<EvalAltResult> for Result<T, Box<EvalAltResult> > is deprecated so it will no longer be possible to do EvalAltResult::ErrorXXXXX.into() to convert to a Result; instead, Err(EvalAltResult:ErrorXXXXX.into()) must be used. Code is clearer if errors are explicitly wrapped in Err.Engine::consume_XXX methods are renamed to Engine::run_XXX to make meanings clearer. The consume_XXX API is deprecated.
Engine::call_fn, new variables defined during evaluation of the body script are removed and no longer spill into the function call.NamespaceRef::new is fixed.Engine APIEngine::consume_XXX methods are renamed to Engine::run_XXX to make meanings clearer. The consume_XXX API is deprecated.Engine::register_type_XXX are now available even under no_object.Engine::on_parse_token to allow remapping certain tokens during parsing.Engine::const_empty_string to merge empty strings into a single instance.$symbol$ is supported in custom syntax to match any symbol.$block$, } or ; as the last symbol are now self-terminating (i.e. no need to attach a terminating ;).Dynamic ValuesDynamic::as_string and Dynamic::as_immutable_string are deprecated and replaced by into_string and into_immutable_string respectively.Dynamic.fromXXX constant methods to Dynamic.sin, cos and tan for Decimal values.Decimal Valuesparse_float(), PI() and E() now defer to Decimal under no_float if decimal is turned on.log10() for Decimal.ln for Decimal is now checked and won't panic.SmartString now uses LazyCompact instead of Compact to minimize allocations.pop for strings.ImmutableString::ptr_eq to test if two strings point to the same allocation.serde feature of SmartString is turned on under metadata to make Map serializable.Scope APIScope::set_value now takes anything that implements Into<Cow<str> >.Scope::is_constant to check if a variable is constant.Scope::set_or_push to add a new variable only if one doesn't already exist.AST APIASTNode::position.ReturnType is removed in favor of option flags for Stmt::Return.Stmt::Break and Stmt::Continue are merged into Stmt::BreakLoop via an option flag.StaticVec is changed to keep three items inline instead of four.Almost the same version as 0.20.3 but with deprecated API's removed.
The official version 1.0.
Almost the same version as 0.20.3 but with deprecated API's removed.
no-std no longer requires patching smartstring.return or throw without a semicolon at the end of a block no longer raises an error.RegisterFn and RegisterResultFn traits) are removed.Module::set_id is split into Module::set_id and Module::clear_id pair.begin, end, each, then, unless are no longer reserved keywords.is_odd, is_even for integers, and is_zero for all numbers.From<BTreeSet> and From<HashSet> are added for Dynamic, which create object maps with () values.Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →