oak_wit_component/ast/
mod.rs1#![doc = include_str!("readme.md")]
2#[derive(Clone, Debug)]
4pub struct WitRoot {
5 pub items: Vec<WitItem>,
6}
7
8#[derive(Clone, Debug)]
10pub enum WitItem {
11 Package(WitPackage),
12 World(WitWorld),
13 Interface(WitInterface),
14}
15
16#[derive(Clone, Debug)]
18pub struct WitPackage {
19 pub name: String,
20}
21
22#[derive(Clone, Debug)]
24pub struct WitWorld {
25 pub name: String,
26 pub items: Vec<WitWorldItem>,
27}
28
29#[derive(Clone, Debug)]
31pub enum WitWorldItem {
32 Import(WitImport),
33 Export(WitExport),
34 Include(WitInclude),
35}
36
37#[derive(Clone, Debug)]
39pub struct WitInterface {
40 pub name: String,
41 pub items: Vec<WitInterfaceItem>,
42}
43
44#[derive(Clone, Debug)]
46pub enum WitInterfaceItem {
47 Type(WitType),
48 Func(WitFunc),
49}
50
51#[derive(Clone, Debug)]
53pub struct WitFunc {
54 pub name: String,
55 pub params: Vec<WitParam>,
56 pub result: Option<WitTypeKind>,
57}
58
59#[derive(Clone, Debug)]
61pub struct WitParam {
62 pub name: String,
63 pub ty: WitTypeKind,
64}
65
66#[derive(Clone, Debug)]
68pub struct WitType {
69 pub name: String,
70 pub kind: WitTypeKind,
71}
72
73#[derive(Clone, Debug)]
75pub enum WitTypeKind {
76 Bool,
77 U32,
78 String,
79 }
81
82#[derive(Clone, Debug)]
84pub struct WitImport {
85 pub name: String,
86}
87
88#[derive(Clone, Debug)]
90pub struct WitExport {
91 pub name: String,
92}
93
94#[derive(Clone, Debug)]
96pub struct WitInclude {
97 pub name: String,
98}