This module defines an invocation_handler attribute procedural macro. It can be used to
simplify the signature of the main module invocation handler:
use *;
To use this macro with a function f certain conditions must be met:
fshouldn't have more than one input argument.fshouldn't beunsafe,const, generic, have custom ABI linkage or variadic param.- The type of
finput (if it presents) and output parameters should be one from {String, Vec} set. fshouldn't have the nameinvoke.
For troubleshooting and macros debugging cargo expand can be used.
Internally this macro creates a new function invoke that converts a raw argument to the
appropriate format, calls f and then writes f result via memory::write_response_to_mem to
module memory. So to use this crate apart from fluence fluence_sdk_main has to be imported.
The macro also has an init_fn attribute that can be used for specifying initialization
function name. This function is called only once at the first call of the invoke function. It
can be used like this:
use *;
Examples
Please find more examples here.