Cargo Features

rhai = { version = "1.16.3", default-features = false, features = ["std", "sync", "decimal", "serde", "unicode-xid-ident", "metadata", "internals", "debugging", "bin-features", "f32_float", "only_i32", "only_i64", "no_float", "no_index", "no_object", "no_time", "no_function", "no_closure", "no_module", "no_custom_syntax", "unchecked", "no_position", "no_optimize", "no_std", "wasm-bindgen", "stdweb", "testing-environ", "getrandom", "document-features"] }
default = std

Default features: std, uses runtime random numbers for hashing. ahash/runtime-rng trumps ahash/compile-time-rng

Enables runtime-rng of ahash

std default

Standard features: uses compile-time random number for hashing.

Enables std of ahash, num-traits, once_cell, and smartstring


Enable Special Functionalities

Require that all data types implement Send + Sync (for multi-threaded usage).

Affects custom_syntax::FnCustomSyntaxEval, custom_syntax::FnCustomSyntaxParse, debugger::OnDebuggingInit, debugger::OnDebuggerCallback, native::SendSync, native::LockGuard, native::LockGuardMut, native::FnAny, native::IteratorFn, native::FnPlugin, native::OnProgressCallback, native::OnPrintCallback, native::OnDebugCallback, native::OnParseTokenCallback, native::OnVarCallback, native::OnDefVarCallback, variant::Variant

decimal bin-features? = rust_decimal

Add support for the Decimal data type (acts as the system floating-point type under no_float).

Affects arithmetic::decimal_functions

serde bin-features? metadata?

Enable serialization/deserialization of Rhai data types via serde.

Enables serde, serde of smallvec and smartstring

Affects rhai::serde

unicode-xid-ident = unicode-xid

Allow Unicode Standard Annex #31 for identifiers.

metadata bin-features? = serde, serde_json

Enable functions metadata (including doc-comments); implies serde.

Enables metadata of rhai_codegen, serde of smartstring

Affects formatting::format_type, api::definitions, script_fn::ScriptFnDef.comments, script_fn::ScriptFnMetadata.comments, register::RegisterNativeFunction.param_names, register::RegisterNativeFunction.return_type, register::RegisterNativeFunction.return_type_name, module::FuncInfoMetadata.params_info, module::FuncInfoMetadata.return_type, module::FuncInfoMetadata.comments, tokenizer::TokenizerControlBlock.global_comments, tokenizer::is_doc_comment, custom_types::CustomTypeInfo.comments

internals debugging?

Expose internal data structures (e.g. AST nodes).

Affects native::NativeCallContextStore, rhai::Identifier, rhai::StaticVec

debugging bin-features? = internals

Enable the debugging interface (implies internals).

Affects rhai::debugger

Required by the rhai-dbg binary

bin-features = debugging, decimal, metadata, rustyline, serde

Features and dependencies required by bin tools: decimal, metadata, serde, debugging and rustyline.


System Configuration Features

Use f32 instead of f64 as the system floating-point number type.

Affects rhai::FLOAT


Use i32 instead of i64 for the system integer number type (useful for 32-bit architectures). All other integer types (e.g. u8) are disabled.

Affects rhai::INT


Disable all integer types (e.g. u8) other than i64.


### Disable Language Features

Remove support for floating-point numbers.


Remove support for arrays and indexing.


Remove support for custom types, properties, method-style calls and object maps.

no_time no_std?

Remove support for time-stamps.

no_function = no_closure

Remove support for script-defined functions (implies no_closure).

Affects ast::ScriptFnDef

no_closure no_function?

Remove support for capturing external variables in anonymous functions (i.e. closures).


Remove support for loading external modules.


Remove support for custom syntax.


### Performance-Related Features

Disable all safety checks.


Do not track position when parsing.


Disable the script optimizer.

no_std = core-error, hashbrown, libm, no-std-compat, no_time

Compiling for no-std

Turn on no-std compilation (nightly only).

Enables libm of num-traits

Affects stmt::StmtBlockContainer, hashing::StraightHashMap


JavaScript Interface for WASM

Use wasm-bindgen as JavaScript interface.

Enables js of getrandom, wasm-bindgen of instant


Use stdweb as JavaScript interface.

Enables js of getrandom, stdweb of instant


### Features used in testing environments only

Running under a testing environment.

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features.

no-std-compat no_std?

With alloc

libm no_std?
hashbrown no_std?

With default features

core-error no_std?

With alloc

serde_json metadata?

With alloc

unicode-xid unicode-xid-ident?
rust_decimal decimal?

With maths

getrandom implicit feature
rustyline bin-features?

Enables default features of rustyline ^12.0.0

Required by the rhai-repl binary

document-features implicit feature