Macro fvm_sdk::fvm_syscalls
source · macro_rules! fvm_syscalls { (module = $module:literal; $(#[$attrs:meta])* $v:vis fn $name:ident($($args:ident : $args_ty:ty),*$(,)?) -> Result<()>; $($rest:tt)*) => { ... }; (module = $module:literal; $(#[$attrs:meta])* $v:vis fn $name:ident($($args:ident : $args_ty:ty),*$(,)?) -> Result<$ret:ty>; $($rest:tt)*) => { ... }; (module = $module:literal; $(#[$attrs:meta])* $v:vis fn $name:ident($($args:ident : $args_ty:ty),*$(,)?) -> !; $($rest:tt)*) => { ... }; (module = $module:literal;) => { ... }; }
Expand description
Generate a set of FVM syscall shims.
ⓘ
fvm_sdk::sys::fvm_syscalls! {
module = "my_wasm_module";
/// This method will translate to a syscall with the signature:
///
/// fn(arg: u64) -> u32;
///
/// Where the returned u32 is the status code.
pub fn returns_nothing(arg: u64) -> Result<()>;
/// This method will translate to a syscall with the signature:
///
/// fn(out: u32, arg: u32) -> u32;
///
/// Where `out` is a pointer to where the return value will be written and the returned u32
/// is the status code.
pub fn returns_value(arg: u64) -> Result<u64>;
/// This method will translate to a syscall with the signature:
///
/// fn(arg: u32) -> u32;
///
/// But it will panic if this function returns.
pub fn aborts(arg: u32) -> !;
}