rhai 1.19.0

Embedded scripting for Rust
Documentation
[workspace]

members = [".", "codegen"]



[package]

name = "rhai"

version = "1.19.0"

rust-version = "1.66.0"

edition = "2018"

resolver = "2"

authors = ["Jonathan Turner", "Lukáš Hozda", "Stephen Chung", "jhwgh1968"]

description = "Embedded scripting for Rust"

homepage = "https://rhai.rs"

repository = "https://github.com/rhaiscript/rhai"

readme = "README.md"

license = "MIT OR Apache-2.0"

include = ["/src/**/*", "/Cargo.toml", "/README.md", "LICENSE*"]

keywords = ["scripting", "scripting-engine", "scripting-language", "embedded"]

categories = ["no-std", "embedded", "wasm", "parser-implementations"]



[dependencies]

smallvec = { version = "1.7.0", default-features = false, features = ["union", "const_new", "const_generics"] }

thin-vec = { version = "0.2.13", default-features = false }

ahash = { version = "0.8.2", default-features = false, features = ["compile-time-rng"] }

num-traits = { version = "0.2.0", default-features = false }

once_cell = { version = "1.7.0", default-features = false, features = ["race"] }

bitflags = { version = "2.0.0", default-features = false }

smartstring = { version = "1.0.0", default-features = false }

rhai_codegen = { version = "2.1.0", path = "codegen" }



no-std-compat = { git = "https://gitlab.com/jD91mZM2/no-std-compat", version = "0.4.1", default-features = false, features = ["alloc", "compat_sync"], optional = true }

libm = { version = "0.2.0", default-features = false, optional = true }

hashbrown = { version = "0.14.0", optional = true }

core-error = { version = "0.0.0", default-features = false, features = ["alloc"], optional = true }

serde = { version = "1.0.96", default-features = false, features = ["derive", "alloc"], optional = true }

serde_json = { version = "1.0.45", default-features = false, features = ["alloc"], optional = true }

unicode-xid = { version = "0.2.0", default-features = false, optional = true }

rust_decimal = { version = "1.16.0", default-features = false, features = ["maths"], optional = true }

getrandom = { version = "0.2.0", optional = true }

rustyline = { version = "13.0.0", optional = true }

document-features = { version = "0.2.0", optional = true }

arbitrary = { version = "1.3.2", optional = true, features = ["derive"] }



[dev-dependencies]

rmp-serde = "1.1.0"

serde_json = { version = "1.0.45", default-features = false, features = ["alloc"] }



[features]



## Default features: `std`, uses runtime random numbers for hashing.

default = ["std", "ahash/runtime-rng"] # ahash/runtime-rng trumps ahash/compile-time-rng

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

std = ["once_cell/std", "ahash/std", "num-traits/std", "smartstring/std"]



#! ### Enable Special Functionalities



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

sync = []

## Add support for the [`Decimal`](https://crates.io/crates/rust_decimal) data type (acts as the system floating-point type under `no_float`).

decimal = ["rust_decimal"]

## Enable serialization/deserialization of Rhai data types via [`serde`](https://crates.io/crates/serde).

serde = ["dep:serde", "smartstring/serde", "smallvec/serde", "thin-vec/serde"]

## Allow [Unicode Standard Annex #31](https://unicode.org/reports/tr31/) for identifiers.

unicode-xid-ident = ["unicode-xid"]

## Enable functions metadata (including doc-comments); implies [`serde`](#feature-serde).

metadata = ["serde", "serde_json", "rhai_codegen/metadata", "smartstring/serde"]

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

internals = []

## Enable the debugging interface (implies [`internals`](#feature-internals)).

debugging = ["internals"]

## Features and dependencies required by `bin` tools: `decimal`, `metadata`, `serde`, `debugging` and [`rustyline`](https://crates.io/crates/rustyline).

bin-features = ["decimal", "metadata", "serde", "debugging", "rustyline"]

## Enable fuzzing via the [`arbitrary`](https://crates.io/crates/arbitrary) crate.

fuzz = ["arbitrary", "rust_decimal/rust-fuzz", "serde"]



#! ### System Configuration Features



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

f32_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.

only_i32 = []

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

only_i64 = []



#! ### Disable Language Features



## Remove support for floating-point numbers.

no_float = []

## Remove support for arrays and indexing.

no_index = []

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

no_object = []

## Remove support for time-stamps.

no_time = []

## Remove support for script-defined functions (implies [`no_closure`](#feature-no_closure)).

no_function = ["no_closure"]

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

no_closure = []

## Remove support for loading external modules.

no_module = []

## Remove support for custom syntax.

no_custom_syntax = []



#! ### Performance-Related Features



## Disable all safety checks.

unchecked = []

## Do not track position when parsing.

no_position = []

## Disable the script optimizer.

no_optimize = []



#! ### Compiling for `no-std`



## Turn on `no-std` compilation (nightly only).

no_std = ["no-std-compat", "num-traits/libm", "core-error", "libm", "hashbrown", "no_time"]



#! ### JavaScript Interface for WASM



## Use [`wasm-bindgen`](https://crates.io/crates/wasm-bindgen) as JavaScript interface.

wasm-bindgen = ["getrandom/js", "instant/wasm-bindgen"]

## Use [`stdweb`](https://crates.io/crates/stdweb) as JavaScript interface.

stdweb = ["getrandom/js", "instant/stdweb"]



#! ### Features used in testing environments only



## Compiled with a non-stable compiler (i.e. beta or nightly)

unstable = []



## Running under a testing environment.

testing-environ = []



[[bin]]

name = "rhai-repl"

required-features = ["rustyline"]



[[bin]]

name = "rhai-run"



[[bin]]

name = "rhai-dbg"

required-features = ["debugging"]



[profile.release]

lto = "fat"

codegen-units = 1

#opt-level = "z"     # optimize for size

#panic = 'abort'     # remove stack backtrace for no-std



[target.'cfg(target_family = "wasm")'.dependencies]

instant = { version = "0.1.10" } # WASM implementation of std::time::Instant



[package.metadata.docs.rs]

features = ["document-features", "metadata", "serde", "internals", "decimal", "debugging"]



[patch.crates-io]

# Notice that a custom modified version of `rustyline` is used which supports bracketed paste on Windows.

# This can be moved to the official version when bracketed paste is added.

rustyline = { git = "https://github.com/schungx/rustyline", branch = "v13" }



# Patch SmartString to resolve an UB issue.

#smartstring = { git = "https://github.com/bodil/smartstring", ref = "refs/pull/34/head" }