Module rhai

Source

Modules§

config
Configuration for Rhai.
packages
Module containing all built-in packages available to Rhai, plus facilities to define custom packages.
plugin
Module defining macros for developing plugins.
serde
(serde) Serialization and deserialization support for serde. Exported under the serde feature only.

Macros§

combine_with_exported_module
Macro to combine a plugin module into an existing module.
def_package
Macro that makes it easy to define a package (which is basically a shared module) and register functions into it.
exported_module
Macro to generate a Rhai Module from a plugin module defined via #[export_module].
register_exported_fn
Macro to register a plugin function (defined via #[export_fn]) into an Engine.
set_exported_fn
Macro to register a plugin function into a Rhai Module.
set_exported_global_fn
Macro to register a plugin function into a Rhai Module and expose it globally.

Structs§

AST
Compiled AST (abstract syntax tree) of a Rhai script.
Dynamic
Dynamic type containing any value.
Engine
Rhai main scripting engine.
EvalContext
Context of a script evaluation process.
Expression
An expression sub-tree in an AST.
FnPtr
A general function pointer, which may carry additional (i.e. curried) argument values to be passed onto a function during a call.
FuncRegistration
Type for fine-tuned module function registration.
ImmutableString
The system immutable string type.
Instant
A measurement of a monotonically nondecreasing clock. Opaque and useful only with Duration.
Locked
A reader-writer lock
Module
A module which may contain variables, sub-modules, external Rust functions, and/or script-defined functions.
NativeCallContext
Context of a native Rust function call.
ParseError
Error when parsing a script.
Position
A location (line number + character position) in the input script.
Scope
Type containing information about the current scope. Useful for keeping state between Engine evaluation runs.
Shared
A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically Reference Counted’.
TypeBuilder
Builder to build the API of a custom type for use with an Engine.
VarDefInfo
Information on a variable declaration.

Enums§

EvalAltResult
Evaluation result.
FnAccess
A type representing the access mode of a function.
FnNamespace
A type representing the namespace of a function.
LexError
Error encountered when tokenizing the script text.
ParseErrorType
Error encountered when parsing a script.

Constants§

FUNC_TO_DEBUG
Standard debug-print function.
FUNC_TO_STRING
Standard pretty-print function.
OP_CONTAINS
Standard containment testing function.
OP_EQUALS
Standard equality comparison operator.

Traits§

CustomType
Trait to build the API of a custom type for use with an Engine (i.e. register the type and its getters, setters, methods, etc.).
FuncArgs
Trait that parses arguments to a function call.
RhaiNativeFunc
Trait to register custom Rust functions.

Functions§

eval
Evaluate a string as a script, returning the result value or an error.
eval_file
Evaluate a script file, returning the result value or an error.
format_map_as_json
Return the JSON representation of an object map.
run
Evaluate a string as a script.
run_file
Evaluate a file.

Type Aliases§

Array
Variable-sized array of Dynamic values.
Blob
Variable-sized array of u8 values (byte array).
INT
The system integer type. It is defined as i32 since the only_i32 feature is used.
Map
A dictionary of Dynamic values with string keys.

Attribute Macros§

export_fn
Attribute, when put on a Rust function, turns it into a plugin function.
export_module
Attribute, when put on a Rust module, turns it into a plugin module.
expose_under_internals
Macro to automatically expose a Rust function, type-def or use statement as pub when under the internals feature.

Derive Macros§

CustomType
Macro to implement the [CustomType][rhai::CustomType] trait.