[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-5692":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":34,"readmeContent":35,"aiSummary":36,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":37,"discoverSource":38},5692,"rhai","rhaiscript\u002Frhai","rhaiscript","Rhai - An embedded scripting language for Rust.","https:\u002F\u002Fcrates.io\u002Fcrates\u002Frhai",null,"Rust",5430,238,26,28,0,2,18,91,16,85.24,"Apache License 2.0",false,"main",true,[27,28,29,5,30,31,32,33],"embedded","embedded-scripting-language","no-std","scripting-engine","scripting-language","wasm","webassembly","2026-06-12 04:00:26","Rhai - Embedded Scripting for Rust\n==================================\n\n![GitHub last commit](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flast-commit\u002Frhaiscript\u002Frhai?logo=github)\n[![Build Status](https:\u002F\u002Fgithub.com\u002Frhaiscript\u002Frhai\u002Fworkflows\u002FBuild\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Frhaiscript\u002Frhai\u002Factions)\n[![Stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Frhaiscript\u002Frhai?style=flat&logo=github)](https:\u002F\u002Fgithub.com\u002Frhaiscript\u002Frhai)\n[![License](https:\u002F\u002Fimg.shields.io\u002Fcrates\u002Fl\u002Frhai)](https:\u002F\u002Fgithub.com\u002Flicense\u002Frhaiscript\u002Frhai)\n[![crates.io](https:\u002F\u002Fimg.shields.io\u002Fcrates\u002Fv\u002Frhai?logo=rust)](https:\u002F\u002Fcrates.io\u002Fcrates\u002Frhai\u002F)\n[![crates.io](https:\u002F\u002Fimg.shields.io\u002Fcrates\u002Fd\u002Frhai?logo=rust)](https:\u002F\u002Fcrates.io\u002Fcrates\u002Frhai\u002F)\n[![API Docs](https:\u002F\u002Fdocs.rs\u002Frhai\u002Fbadge.svg?logo=docs-rs)](https:\u002F\u002Fdocs.rs\u002Frhai\u002F)\n[![VS Code plugin installs](https:\u002F\u002Fimg.shields.io\u002Fvisual-studio-marketplace\u002Fi\u002Frhaiscript.vscode-rhai?logo=visual-studio-code&label=vs%20code)](https:\u002F\u002Fmarketplace.visualstudio.com\u002Fitems?itemName=rhaiscript.vscode-rhai)\n[![JetBrains plugin downloads](https:\u002F\u002Fimg.shields.io\u002Fjetbrains\u002Fplugin\u002Fd\u002F30068-rhai-language-support?logo=jetbrains&label=jetbrains)](https:\u002F\u002Fplugins.jetbrains.com\u002Fplugin\u002F30068-rhai-language-support)\n[![Sublime Text package downloads](https:\u002F\u002Fimg.shields.io\u002Fpackagecontrol\u002Fdt\u002FRhai.svg?logo=sublime-text&label=sublime%20text)](https:\u002F\u002Fpackagecontrol.io\u002Fpackages\u002FRhai)\n[![Discord Chat](https:\u002F\u002Fimg.shields.io\u002Fdiscord\u002F767611025456889857.svg?logo=discord&label=discord)](https:\u002F\u002Fdiscord.gg\u002FHquqbYFcZ9)\n[![Reddit Channel](https:\u002F\u002Fimg.shields.io\u002Freddit\u002Fsubreddit-subscribers\u002FRhai?logo=reddit&label=reddit)](https:\u002F\u002Fwww.reddit.com\u002Fr\u002FRhai)\n\n[![Rhai logo](https:\u002F\u002Frhai.rs\u002Fbook\u002Fimages\u002Flogo\u002Frhai-banner-transparent-colour.svg)](https:\u002F\u002Frhai.rs)\n\nRhai is an embedded scripting language and evaluation engine for Rust that gives a safe and easy way\nto add scripting to any application.\n\n\nTargets and builds\n------------------\n\n* All CPU and O\u002FS targets supported by Rust, including:\n  * WebAssembly (WASM)\n  * `no-std`\n* Minimum Rust version 1.66.0\n\n\nVersions\n--------\n\nAs of this version, [`stdweb`](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fstdweb) is no longer supported for WASM builds\nbecause of changes to [`getrandom`](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fgetrandom) starting from version 0.3.\n\n\nStandard features\n-----------------\n\n* Simple language similar to JavaScript+Rust with [dynamic](https:\u002F\u002Frhai.rs\u002Fbook\u002Flanguage\u002Fdynamic.html) typing.\n* Fairly efficient evaluation - 1 million iterations in 0.14 sec on a single-core 2.6 GHz Linux VM running [this script](https:\u002F\u002Fgithub.com\u002Frhaiscript\u002Frhai\u002Fblob\u002Fmain\u002Fscripts\u002Fspeed_test.rhai).\n* Tight integration with native Rust [functions](https:\u002F\u002Frhai.rs\u002Fbook\u002Frust\u002Ffunctions.html) and [types](https:\u002F\u002Frhai.rs\u002Fbook\u002Frust\u002Fcustom-types.html), including [getters\u002Fsetters](https:\u002F\u002Frhai.rs\u002Fbook\u002Frust\u002Fgetters-setters.html), [methods](https:\u002F\u002Frhai.rs\u002Fbook\u002Frust\u002Fmethods.html) and [indexers](https:\u002F\u002Frhai.rs\u002Fbook\u002Frust\u002Findexers.html).\n* Freely pass Rust values into a script as [variables](https:\u002F\u002Frhai.rs\u002Fbook\u002Flanguage\u002Fvariables.html)\u002F[constants](https:\u002F\u002Frhai.rs\u002Fbook\u002Flanguage\u002Fconstants.html) via an external [`Scope`](https:\u002F\u002Frhai.rs\u002Fbook\u002Fengine\u002Fscope.html) - all clonable Rust types are supported; no need to implement any special trait. Or tap directly into the [variable resolution process](https:\u002F\u002Frhai.rs\u002Fbook\u002Fengine\u002Fvar.html).\n* Built-in support for most common [data types](https:\u002F\u002Frhai.rs\u002Fbook\u002Flanguage\u002Fvalues-and-types.html) including booleans, [integers](https:\u002F\u002Frhai.rs\u002Fbook\u002Flanguage\u002Fnumbers.html), [floating-point numbers](https:\u002F\u002Frhai.rs\u002Fbook\u002Flanguage\u002Fnumbers.html) (including [`Decimal`](https:\u002F\u002Fcrates.io\u002Fcrates\u002Frust_decimal)), [strings](https:\u002F\u002Frhai.rs\u002Fbook\u002Flanguage\u002Fstrings-chars.html), [Unicode characters](https:\u002F\u002Frhai.rs\u002Fbook\u002Flanguage\u002Fstrings-chars.html), [arrays](https:\u002F\u002Frhai.rs\u002Fbook\u002Flanguage\u002Farrays.html) (including packed [byte arrays](https:\u002F\u002Frhai.rs\u002Fbook\u002Flanguage\u002Fblobs.html)) and [object maps](https:\u002F\u002Frhai.rs\u002Fbook\u002Flanguage\u002Fobject-maps.html).\n* Easily [call a script-defined function](https:\u002F\u002Frhai.rs\u002Fbook\u002Fengine\u002Fcall-fn.html) from Rust.\n* Relatively little `unsafe` code (yes there are some for performance reasons).\n* Few dependencies - currently only [`smallvec`](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fsmallvec), [`thin-vec`](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fthin-vec), [`num-traits`](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fnum-traits), [`once_cell`](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fonce_cell), [`ahash`](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fahash), [`bitflags`](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fbitflags) and [`smartstring`](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fsmartstring).\n* Re-entrant scripting engine can be made `Send + Sync` (via the `sync` feature).\n* Compile once to [AST](https:\u002F\u002Frhai.rs\u002Fbook\u002Fengine\u002Fcompile.html) form for repeated evaluations.\n* Scripts are [optimized](https:\u002F\u002Frhai.rs\u002Fbook\u002Fengine\u002Foptimize) (useful for template-based machine-generated scripts).\n* Easy custom API development via [plugins](https:\u002F\u002Frhai.rs\u002Fbook\u002Fplugins) system powered by procedural macros.\n* [Function overloading](https:\u002F\u002Frhai.rs\u002Fbook\u002Flanguage\u002Foverload.html) and [operator overloading](https:\u002F\u002Frhai.rs\u002Fbook\u002Frust\u002Foperators.html).\n* Dynamic dispatch via [function pointers](https:\u002F\u002Frhai.rs\u002Fbook\u002Flanguage\u002Ffn-ptr.html) with additional support for [currying](https:\u002F\u002Frhai.rs\u002Fbook\u002Flanguage\u002Ffn-curry.html).\n* [Closures](https:\u002F\u002Frhai.rs\u002Fbook\u002Flanguage\u002Ffn-closure.html) (anonymous functions) that can capture shared values.\n* Some syntactic support for [object-oriented programming (OOP)](https:\u002F\u002Frhai.rs\u002Fbook\u002Fpatterns\u002Foop.html).\n* Organize code base with dynamically-loadable [modules](https:\u002F\u002Frhai.rs\u002Fbook\u002Flanguage\u002Fmodules), optionally [overriding the resolution process](https:\u002F\u002Frhai.rs\u002Fbook\u002Frust\u002Fmodules\u002Fresolvers.html).\n* Serialization\u002Fdeserialization support via [serde](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fserde) (requires the `serde` feature).\n* Support for [minimal builds](https:\u002F\u002Frhai.rs\u002Fbook\u002Fstart\u002Fbuilds\u002Fminimal.html) by excluding unneeded language [features](https:\u002F\u002Frhai.rs\u002Fbook\u002Fstart\u002Ffeatures.html).\n* A [debugging](https:\u002F\u002Frhai.rs\u002Fbook\u002Fengine\u002Fdebugging) interface.\n\n\nProtected against attacks\n-------------------------\n\n* [_Don't Panic_](https:\u002F\u002Frhai.rs\u002Fbook\u002Fsafety\u002Findex.html#dont-panic-guarantee--any-panic-is-a-bug) guarantee - Any panic is a bug. Rhai subscribes to the motto that a library should never panic the host system, and is coded with this in mind.\n* [Sand-boxed](https:\u002F\u002Frhai.rs\u002Fbook\u002Fsafety\u002Fsandbox.html) - the scripting engine, if declared immutable, cannot mutate the containing environment unless [explicitly permitted](https:\u002F\u002Frhai.rs\u002Fbook\u002Fpatterns\u002Fcontrol.html).\n* Rugged - protected against malicious attacks (such as [stack-overflow](https:\u002F\u002Frhai.rs\u002Fbook\u002Fsafety\u002Fmax-call-stack.html), [over-sized data](https:\u002F\u002Frhai.rs\u002Fbook\u002Fsafety\u002Fmax-string-size.html), and [runaway scripts](https:\u002F\u002Frhai.rs\u002Fbook\u002Fsafety\u002Fmax-operations.html) etc.) that may come from untrusted third-party user-land scripts.\n* Track script evaluation [progress](https:\u002F\u002Frhai.rs\u002Fbook\u002Fsafety\u002Fprogress.html) and manually terminate a script run.\n* Passes Miri.\n\n\nFor those who actually want their own language\n----------------------------------------------\n\n* Use as a [DSL](https:\u002F\u002Frhai.rs\u002Fbook\u002Fengine\u002Fdsl.html).\n* Disable certain [language features](https:\u002F\u002Frhai.rs\u002Fbook\u002Fengine\u002Foptions.html#language-features) such as [looping](https:\u002F\u002Frhai.rs\u002Fbook\u002Fengine\u002Fdisable-looping.html).\n* Further restrict the language by surgically [disabling keywords and operators](https:\u002F\u002Frhai.rs\u002Fbook\u002Fengine\u002Fdisable-keywords.html).\n* Define [custom operators](https:\u002F\u002Frhai.rs\u002Fbook\u002Fengine\u002Fcustom-op.html).\n* Extend the language with [custom syntax](https:\u002F\u002Frhai.rs\u002Fbook\u002Fengine\u002Fcustom-syntax.html).\n\n\nExample\n-------\n\nThe [`scripts`](https:\u002F\u002Fgithub.com\u002Frhaiscript\u002Frhai\u002Ftree\u002Fmaster\u002Fscripts) subdirectory contains sample Rhai scripts.\n\nBelow is the standard _Fibonacci_ example for scripting languages:\n\n```ts\n\u002F\u002F This Rhai script calculates the n-th Fibonacci number using a\n\u002F\u002F really dumb algorithm to test the speed of the scripting engine.\n\nconst TARGET = 28;\nconst REPEAT = 5;\nconst ANSWER = 317_811;\n\nfn fib(n) {\n    if n \u003C 2 {\n        n\n    } else {\n        fib(n-1) + fib(n-2)\n    }\n}\n\nprint(`Running Fibonacci(${TARGET}) x ${REPEAT} times...`);\nprint(\"Ready... Go!\");\n\nlet result;\nlet now = timestamp();\n\nfor n in 0..REPEAT {\n    result = fib(TARGET);\n}\n\nprint(`Finished. Run time = ${now.elapsed} seconds.`);\n\nprint(`Fibonacci number #${TARGET} = ${result}`);\n\nif result != ANSWER {\n    print(`The answer is WRONG! Should be ${ANSWER}!`);\n}\n```\n\nProject Site\n------------\n\n[`rhai.rs`](https:\u002F\u002Frhai.rs)\n\n\nDocumentation\n-------------\n\nSee [_The Rhai Book_](https:\u002F\u002Frhai.rs\u002Fbook) for details on the Rhai scripting engine and language.\n\n\nPlayground\n----------\n\nAn [_Online Playground_](https:\u002F\u002Frhai.rs\u002Fplayground) is available with syntax-highlighting editor,\npowered by WebAssembly.\n\nScripts can be evaluated directly from the editor.\n\n\nLicense\n-------\n\nLicensed under either of the following, at your choice:\n\n* [Apache License, Version 2.0](https:\u002F\u002Fgithub.com\u002Frhaiscript\u002Frhai\u002Fblob\u002Fmaster\u002FLICENSE-APACHE.txt), or\n* [MIT license](https:\u002F\u002Fgithub.com\u002Frhaiscript\u002Frhai\u002Fblob\u002Fmaster\u002FLICENSE-MIT.txt)\n\nUnless explicitly stated otherwise, any contribution intentionally submitted\nfor inclusion in this crate, as defined in the Apache-2.0 license, shall\nbe dual-licensed as above, without any additional terms or conditions.\n","Rhai 是一个专为 Rust 设计的嵌入式脚本语言，旨在为应用程序提供安全且简便的脚本支持。其核心功能包括类似 JavaScript 和 Rust 的简洁语法、动态类型系统以及高效的脚本执行能力，能够在单核 2.6 GHz Linux 虚拟机上以每秒约七百万次迭代的速度运行。Rhai 支持与原生 Rust 函数和自定义类型的无缝集成，并允许将 Rust 值作为变量传递给脚本使用。此外，Rhai 还兼容 WebAssembly (WASM) 并提供了 `no-std` 构建选项，使其适用于从服务器端到客户端的各种开发场景，特别是在需要轻量级脚本引擎或跨平台解决方案时尤为适用。","2026-06-11 03:04:45","top_language"]