c-api: refactor definitions with macroes (#4416)

Signed-off-by: spacewander <spacewanderlzx@gmail.com>
This commit is contained in:
罗泽轩
2022-07-11 22:10:41 +08:00
committed by GitHub
parent 6c70428735
commit 1d319c0ec2
5 changed files with 10 additions and 54 deletions

View File

@@ -40,6 +40,8 @@ pub struct wasi_config_t {
inherit_stderr: bool,
}
wasmtime_c_api_macros::declare_own!(wasi_config_t);
impl wasi_config_t {
pub fn into_wasi_ctx(self) -> Result<WasiCtx> {
let mut builder = WasiCtxBuilder::new();
@@ -100,9 +102,6 @@ pub extern "C" fn wasi_config_new() -> Box<wasi_config_t> {
Box::new(wasi_config_t::default())
}
#[no_mangle]
pub extern "C" fn wasi_config_delete(_config: Box<wasi_config_t>) {}
#[no_mangle]
pub unsafe extern "C" fn wasi_config_set_argv(
config: &mut wasi_config_t,