Skip to main content

Module function

Module function 

Source
Expand description

Callable units, and how to describe and find them.

Every function, whether it came from Rust or from a script, is a Function: a FunctionSignature describing it and a FunctionBody doing the work. The body always has the same shape, fn(&mut Context, &Registry), which is why the caller cannot tell the two kinds apart.

§Argument order

A body pops its arguments in declaration order, first to last, and pushes its results in reverse. A caller therefore has to push arguments in reverse order. Function::call does that for you, Function::invoke does not. Prefer call unless you already manage the stack yourself.

Structs§

Function
A callable unit: a signature plus a body.
FunctionParameter
One input or output of a function, with its name and type.
FunctionQuery
Search filter for functions in a crate::registry::Registry.
FunctionQueryParameter
Search filter for one function parameter.
FunctionSignature
Everything about a function except its body.

Enums§

FunctionBody
The code a function runs.
Parameters
Search filter for a function’s parameter list.

Type Aliases§

FunctionHandle
Shared function, as a registry holds it.
FunctionMetaQuery
Predicate over a function’s metadata, used inside queries.