macro_rules! define_function { ( $vis:vis $func:ident : $($ty:tt)+ ) => { ... }; }
Expand description
Define a function reference type.
define_function!(pub MyFunc : (u8, &str) -> (Nat) query)
expands to pub struct MyFunc(Func)
, which implements CandidType
with the provided type. We also provide a constructor function MyFunc::new(principal, method)
.