use crate::macros::backend::match_rt;
use super::*;
impl VMExternToExtern for VMExtern {
fn to_extern(self, store: &mut impl crate::AsStoreMut) -> crate::Extern {
match_rt!(on self => s {
s.to_extern(store)
})
}
}
impl VMFunctionEnvironment {
#[allow(clippy::should_implement_trait)]
pub fn as_ref(&self) -> &(dyn std::any::Any + Send + 'static) {
match_rt!(on self => s {
s.as_ref()
})
}
#[allow(clippy::should_implement_trait)]
pub fn as_mut(&mut self) -> &mut (dyn std::any::Any + Send + 'static) {
match_rt!(on self => s {
s.as_mut()
})
}
pub fn contents(self) -> Box<(dyn std::any::Any + Send + 'static)> {
match_rt!(on self => s {
s.contents
})
}
}
impl VMFuncRef {
pub fn into_raw(self) -> RawValue {
match_rt!(on self => s {
s.into_raw()
})
}
}
impl VMExternRef {
pub fn into_raw(self) -> RawValue {
match_rt!(on self => s {
s.into_raw()
})
}
}
impl VMExceptionRef {
pub fn into_raw(self) -> RawValue {
match self {
#[cfg(feature = "sys")]
Self::Sys(s) => s.into_raw(),
_ => unimplemented!("VMExceptionRef::into_raw is only implemented for the sys backend"),
}
}
}