This module defines invocation_handler attribute procedural macro. It can simplify main module
invocation handler signature. According to Fluence backend convensions this handler can look
like this:
pub unsafe
We can use a neater way instead with #[invocation_handler]:
use *;
To use this macro with a function f certain conditions must be met:
fmustn't have more than one input argument.fmustn't beunsafe,const, generic, have custom abi linkage or variadic param.- The type of
finput (if it present) and output parameters must be one from {String, Vec} set. fmustn't have the nameinvoke.
For troubleshooting and macros debugging cargo expand can be used.
Internally this macros creates a new function invoke that converts a raw argument to
a appropriate format, calls f and then write f result via memory::write_result_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 will be called only in the first invoke function call. It can be
used like this:
use *;
Examples
Please find more examples [here].