1#[derive(Clone, Debug)]
3pub struct WitRoot {
4 pub items: Vec<WitItem>,
5}
6
7#[derive(Clone, Debug)]
9pub enum WitItem {
10 Package(WitPackage),
11 World(WitWorld),
12 Interface(WitInterface),
13}
14
15#[derive(Clone, Debug)]
17pub struct WitPackage {
18 pub name: String,
19}
20
21#[derive(Clone, Debug)]
23pub struct WitWorld {
24 pub name: String,
25 pub items: Vec<WitWorldItem>,
26}
27
28#[derive(Clone, Debug)]
30pub enum WitWorldItem {
31 Import(WitImport),
32 Export(WitExport),
33 Include(WitInclude),
34}
35
36#[derive(Clone, Debug)]
38pub struct WitInterface {
39 pub name: String,
40 pub items: Vec<WitInterfaceItem>,
41}
42
43#[derive(Clone, Debug)]
45pub enum WitInterfaceItem {
46 Type(WitType),
47 Func(WitFunc),
48}
49
50#[derive(Clone, Debug)]
52pub struct WitFunc {
53 pub name: String,
54 pub params: Vec<WitParam>,
55 pub result: Option<WitTypeKind>,
56}
57
58#[derive(Clone, Debug)]
60pub struct WitParam {
61 pub name: String,
62 pub ty: WitTypeKind,
63}
64
65#[derive(Clone, Debug)]
67pub struct WitType {
68 pub name: String,
69 pub kind: WitTypeKind,
70}
71
72#[derive(Clone, Debug)]
74pub enum WitTypeKind {
75 Bool,
76 U32,
77 String,
78 }
80
81#[derive(Clone, Debug)]
83pub struct WitImport {
84 pub name: String,
85}
86
87#[derive(Clone, Debug)]
89pub struct WitExport {
90 pub name: String,
91}
92
93#[derive(Clone, Debug)]
95pub struct WitInclude {
96 pub name: String,
97}