use crate::{
WasmtimeStoreContext, WasmtimeStoreContextMut, handle_result, wasm_tagtype_t, wasmtime_error_t,
};
use std::mem::MaybeUninit;
use wasmtime::Tag;
#[unsafe(no_mangle)]
pub unsafe extern "C" fn wasmtime_tag_new(
mut store: WasmtimeStoreContextMut<'_>,
tt: &wasm_tagtype_t,
ret: &mut MaybeUninit<Tag>,
) -> Option<Box<wasmtime_error_t>> {
let tag_type = tt.to_tag_type(store.engine());
handle_result(Tag::new(&mut store, &tag_type), |tag| {
ret.write(tag);
})
}
#[unsafe(no_mangle)]
pub extern "C" fn wasmtime_tag_type(
store: WasmtimeStoreContext<'_>,
tag: &Tag,
) -> Box<wasm_tagtype_t> {
let ty = tag.ty(store);
Box::new(wasm_tagtype_t::from_tag_type(ty))
}
#[unsafe(no_mangle)]
pub extern "C" fn wasmtime_tag_eq(store: WasmtimeStoreContext<'_>, a: &Tag, b: &Tag) -> bool {
Tag::eq(a, b, store)
}