use crate::entities::{Function, Global, Memory, Table, Tag};
use crate::store::AsStoreMut;
pub use wasmer_vm::*;
pub type VMExternTable = InternalStoreHandle<VMTable>;
pub type VMExternMemory = InternalStoreHandle<VMMemory>;
pub type VMExternGlobal = InternalStoreHandle<VMGlobal>;
pub type VMExternFunction = InternalStoreHandle<VMFunction>;
pub(crate) type VMExternTag = InternalStoreHandle<VMTag>;
pub type VMFunctionCallback = *const VMFunctionBody;
impl crate::VMExternToExtern for VMExtern {
fn to_extern(self, store: &mut impl AsStoreMut) -> crate::Extern {
match self {
Self::Function(f) => crate::Extern::Function(Function::from_vm_extern(
store,
crate::vm::VMExternFunction::Sys(f),
)),
Self::Memory(m) => crate::Extern::Memory(Memory::from_vm_extern(
store,
crate::vm::VMExternMemory::Sys(m),
)),
Self::Global(g) => crate::Extern::Global(Global::from_vm_extern(
store,
crate::vm::VMExternGlobal::Sys(g),
)),
Self::Table(t) => crate::Extern::Table(Table::from_vm_extern(
store,
crate::vm::VMExternTable::Sys(t),
)),
Self::Tag(t) => {
crate::Extern::Tag(Tag::from_vm_extern(store, crate::vm::VMExternTag::Sys(t)))
}
}
}
}