Cargo Features
[dependencies]
rhai = { version = "1.20.0", default-features = false, features = ["std", "sync", "decimal", "serde", "unicode-xid-ident", "metadata", "internals", "debugging", "bin-features", "fuzz", "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", "unstable", "testing-environ", "document-features"] }
- default = std
-
Default features:
std
, uses runtime random numbers for hashing. ahash/runtime-rng trumps ahash/compile-time-rngEnables 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
- sync
-
Enable Special Functionalities
Require that all data types implement
Send + Sync
(for multi-threaded usage).Enables compat_sync of no-std-compat
Affects
custom_syntax::FnCustomSyntaxEval
,custom_syntax::FnCustomSyntaxParse
,debugger::OnDebuggingInit
,debugger::OnDebuggerCallback
,native::SendSync
,native::LockGuard
,native::LockGuardMut
,native::FnAny
,native::FnIterator
,native::FnPlugin
,native::OnProgressCallback
,native::OnPrintCallback
,native::OnDebugCallback
,native::OnParseTokenCallback
,native::OnVarCallback
,native::OnDefVarCallback
,variant::Variant
,native::OnInvalidArrayIndexCallback
,native::OnMissingMapPropertyCallback
… - decimal bin-features? = rust_decimal
-
Add support for the
Decimal
data type (acts as the system floating-point type underno_float
).Affects
arithmetic::decimal_functions
… - serde bin-features? fuzz? metadata?
-
Enable serialization/deserialization of Rhai data types via
serde
.Enables serde, serde of smallvec, smartstring, and thin-vec
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_param_type_for_display
,api::definitions
,script_fn::ScriptFuncDef.comments
,script_fn::ScriptFnMetadata.comments
,register::RhaiNativeFunc.param_names
,register::RhaiNativeFunc.return_type
,register::RhaiNativeFunc.return_type_name
,module::FuncMetadata.params_info
,module::FuncMetadata.return_type
,module::FuncMetadata.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
,native::OnInvalidArrayIndexCallback
,native::OnMissingMapPropertyCallback
,native::OnInvalidArrayIndexCallback
,native::OnMissingMapPropertyCallback
… - 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
andrustyline
. - fuzz = arbitrary, serde
-
Enable fuzzing via the
arbitrary
crate.Enables rust-fuzz of rust_decimal
- f32_float
-
System Configuration Features
Use
f32
instead off64
as the system floating-point number type.Affects
rhai::FLOAT
… - only_i32
-
Use
i32
instead ofi64
for the system integer number type (useful for 32-bit architectures). All other integer types (e.g.u8
) are disabled.Affects
rhai::INT
… - only_i64
-
Disable all integer types (e.g.
u8
) other thani64
. - no_float
-
Disable Language Features
Remove support for floating-point numbers.
- no_index
-
Remove support for arrays and indexing.
- no_object
-
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::ScriptFuncDef
,parser::ParseState.dummy
… - no_closure no_function?
-
Remove support for capturing external variables in anonymous functions (i.e. closures).
- no_module
-
Remove support for loading external modules.
- no_custom_syntax
-
Remove support for custom syntax.
- unchecked
-
Performance-Related Features
Disable all safety checks.
- no_position
-
Do not track position when parsing.
- no_optimize
-
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
… - wasm-bindgen
-
JavaScript Interface for WASM
Use
wasm-bindgen
as JavaScript interface.Enables js of getrandom, wasm-bindgen of instant
- stdweb
-
Use
stdweb
as JavaScript interface. - unstable
-
Features used in testing environments only
Compiled with a non-stable compiler (i.e. beta or nightly)
- testing-environ
-
Running under a testing environment.
Features from optional dependencies
In crates that don't use the dep:
syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.
- no-std-compat no_std? sync?
- libm no_std?
- hashbrown no_std?
- core-error no_std?
- serde_json metadata?
- unicode-xid unicode-xid-ident?
- rust_decimal decimal? fuzz?
- getrandom stdweb? wasm-bindgen?
- rustyline bin-features?
-
Enables rustyline ^13.0.0
Required by the rhai-repl binary
- document-features implicit feature
-
Enables document-features
document-features:
Extract documentation for the feature flags from comments in Cargo.toml
- arbitrary fuzz?