Files
wasmtime/src/macros.rs
2019-07-23 15:02:23 -07:00

14 lines
474 B
Rust

macro_rules! hostcalls {
($(pub fn $name:ident($($arg:ident: $ty:ty,)*) -> $ret:ty;)*) => ($(
#[wasi_common_cbindgen::wasi_common_cbindgen]
pub fn $name($($arg: $ty,)*) -> $ret {
let ret = match crate::hostcalls_impl::$name($($arg,)*) {
Ok(()) => crate::host::__WASI_ESUCCESS,
Err(e) => e,
};
crate::hostcalls::return_enc_errno(ret)
}
)*)
}