The default integer type is i64. If other integer types are not needed, it is possible to exclude
them and make a smaller build with the only_i64 feature.
If only 32-bit integers are needed, enabling the only_i32 feature will remove support for all
integer types other than i32, including i64.
This is useful on some 32-bit targets where using 64-bit integers incur a performance penalty.
Warning: Default integer is i64
Rhai’s default integer type is i64, which is DIFFERENT from Rust’s i32.
It is very easy to unsuspectingly set an i32 into Rhai, which still works but will incur a significant
runtime performance hit since the Engine will treat i32 as an opaque custom type (unless using the
i64 is the default even on 32-bit systems. To use i32 on 32-bit systems requires the only_i32 feature.
Tip: Floating-point numbers
If no floating-point is needed or supported, use the no_float feature to remove it.
Some applications require fixed-precision decimal numbers, which can be enabled via the decimal feature.
Strings in Rhai are immutable, meaning that they can be shared but not modified.
Internally, the ImmutableString type is a wrapper over Rc<String> or Arc<String> (depending on sync).
Any modification done to a Rhai string causes the string to be cloned and the modifications made to the copy.
Tip: Convert to string
The to_string function converts a standard type into a string for display purposes.
The to_debug function converts a standard type into a string in debug format.