#[intuicio_function]Expand description
Wraps a free function so scripts can call it.
Generates a module named after the function, holding the
fn(&mut Context, &Registry) shim, define_signature and
define_function. The original function is emitted unchanged beside it.
ⓘ
#[intuicio_function(module_name = "lib")]
fn add(a: i32, b: i32) -> i32 {
a + b
}
registry.add_function(add::define_function(®istry));§Attributes
| Attribute | Effect |
|---|---|
name = "..." | registered name, defaults to the Rust name |
module_name = "..." | module the function is registered under |
type_path = "..." | associates the function with that type |
use_registry | the argument named registry receives &Registry instead of a stack value |
use_context | the argument named context receives &mut Context instead of a stack value |
transformer = "..." | routes arguments and results through a ValueTransformer |
dependency = "..." | argument a returned reference borrows from |
meta = "..." | Meta source attached to the function |
args_meta(a = "...") | Meta source attached to argument a |
debug | prints the generated code during compilation |
§Panics
Expanding panics on a self argument, or on an argument whose pattern is
not a plain identifier. The generated define_signature panics at run
time when a type from the signature is missing from the registry.