oak_wit_component/ast/
mod.rs1#![doc = include_str!("readme.md")]
2#[derive(Clone, Debug)]
4pub struct WitRoot {
5 pub items: Vec<WitItem>,
7}
8
9#[derive(Clone, Debug)]
11pub enum WitItem {
12 Package(WitPackage),
14 World(WitWorld),
16 Interface(WitInterface),
18}
19
20#[derive(Clone, Debug)]
22pub struct WitPackage {
23 pub name: String,
25}
26
27#[derive(Clone, Debug)]
29pub struct WitWorld {
30 pub name: String,
32 pub items: Vec<WitWorldItem>,
34}
35
36#[derive(Clone, Debug)]
38pub enum WitWorldItem {
39 Import(WitImport),
41 Export(WitExport),
43 Include(WitInclude),
45}
46
47#[derive(Clone, Debug)]
49pub struct WitInterface {
50 pub name: String,
52 pub items: Vec<WitInterfaceItem>,
54}
55
56#[derive(Clone, Debug)]
58pub enum WitInterfaceItem {
59 Type(WitType),
60 Func(WitFunc),
61}
62
63#[derive(Clone, Debug)]
65pub struct WitFunc {
66 pub name: String,
68 pub params: Vec<WitParam>,
70 pub result: Option<WitTypeKind>,
72}
73
74#[derive(Clone, Debug)]
76pub struct WitParam {
77 pub name: String,
79 pub ty: WitTypeKind,
81}
82
83#[derive(Clone, Debug)]
85pub struct WitType {
86 pub name: String,
88 pub kind: WitTypeKind,
90}
91
92#[derive(Clone, Debug)]
94pub enum WitTypeKind {
95 Bool,
97 U32,
99 String,
101}
102
103#[derive(Clone, Debug)]
105pub struct WitImport {
106 pub name: String,
108}
109
110#[derive(Clone, Debug)]
112pub struct WitExport {
113 pub name: String,
115}
116
117#[derive(Clone, Debug)]
119pub struct WitInclude {
120 pub name: String,
122}