Move hostcalls impl into separate module
This commit is contained in:
13
src/macros.rs
Normal file
13
src/macros.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
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)
|
||||
}
|
||||
)*)
|
||||
}
|
||||
Reference in New Issue
Block a user