Set namespace in Module::set_fn_XXX_mut calls.

This commit is contained in:
Stephen Chung
2020-11-17 15:11:58 +08:00
parent 863c6b45a5
commit 21c641d21f
4 changed files with 100 additions and 61 deletions

View File

@@ -8,13 +8,19 @@ This version adds the `switch` statement.
It also allows exposing selected module functions (usually methods) to the global namespace.
Breaking changes
----------------
* `Module::set_fn`, `Module::set_raw_fn` and `Module::set_fn_XXX_mut` all take an additional parameter of `FnNamespace`.
New features
------------
* `switch` statement.
* `Engine::register_module` to register a module as a sub-module in the global namespace.
* `Module::get_fn_namespace` and `Module::set_fn_namespace` can expose a module function to the global namespace. This is convenient when registering an API for a custom type.
* `set_exported_global_fn!` macro to register a plugin function and expose it to the global namespace.
* `Module::set_fn_XXX_mut` can expose a module function to the global namespace. This is convenient when registering an API for a custom type.
* `Module::set_getter_fn`, `Module::set_setter_fn`, `Module::set_indexer_get_fn`, `Module::set_indexer_set_fn` all expose the function to the global namespace by default. This is convenient when registering an API for a custom type.
* `#[rhai_fn(global)]` and `#[rhai_fn(internal)]` attributes to determine whether a function defined in a plugin module should be exposed to the global namespace. This is convenient when defining an API for a custom type.
Enhancements