use crate::{Function, WasmTypeList};
use std::marker::PhantomData;
use crate::store::AsStoreRef;
#[derive(Clone)]
pub struct TypedFunction<Args, Rets> {
pub(crate) func: Function,
_phantom: PhantomData<fn(Args) -> Rets>,
}
unsafe impl<Args, Rets> Send for TypedFunction<Args, Rets> {}
unsafe impl<Args, Rets> Sync for TypedFunction<Args, Rets> {}
impl<Args, Rets> TypedFunction<Args, Rets>
where
Args: WasmTypeList,
Rets: WasmTypeList,
{
#[allow(dead_code)]
pub(crate) fn new(_store: &impl AsStoreRef, func: Function) -> Self {
Self {
func,
_phantom: PhantomData,
}
}
pub(crate) fn into_function(self) -> Function {
self.func
}
}