linera_wasmer/
typed_function.rs1use crate::{Function, WasmTypeList};
11use std::marker::PhantomData;
12
13use crate::store::AsStoreRef;
14
15#[derive(Clone)]
18pub struct TypedFunction<Args, Rets> {
19 pub(crate) func: Function,
20 _phantom: PhantomData<fn(Args) -> Rets>,
21}
22
23unsafe impl<Args, Rets> Send for TypedFunction<Args, Rets> {}
24unsafe impl<Args, Rets> Sync for TypedFunction<Args, Rets> {}
25
26impl<Args, Rets> TypedFunction<Args, Rets>
27where
28 Args: WasmTypeList,
29 Rets: WasmTypeList,
30{
31 #[allow(dead_code)]
32 pub(crate) fn new(_store: &impl AsStoreRef, func: Function) -> Self {
33 Self {
34 func,
35 _phantom: PhantomData,
36 }
37 }
38
39 pub(crate) fn into_function(self) -> Function {
40 self.func
41 }
42}