What is this
This is a macro for RPC programming needs which generates a structure and a thunk for function in a way that allows calling that function with a struct argument that supports serde::Deserialize
How to use
-
Mark function with
#[server_function]
attribute -
This will generate
AddArgs
struct matching your function arguments that looks like thisand a function named
add_thunk
withAddArgs
struct as 1 argument -
Now you can call it
// will return 10, same as original function add_thunk
Features
messagepack
Enables rmp-serde and allows server function to be called using raw messagepack bytes using with_bytes_thunk(bytes: &[u8])
Example
let bytes = to_vec.unwrap;
add_messagepack_thunk // should return 10