1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use crate::AtomType;
use witx::CoreFuncType;

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct FuncSignature {
    pub args: Vec<AtomType>,
    pub ret: Option<AtomType>,
}

impl From<CoreFuncType> for FuncSignature {
    fn from(m: CoreFuncType) -> FuncSignature {
        FuncSignature {
            args: m.args.iter().map(|a| a.repr()).collect(),
            ret: m.ret.map(|r| r.repr()),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ImportFunc {
    pub module: String,
    pub field: String,
    pub ty: FuncSignature,
}