1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
pub mod abi;
mod stub;
use crate::flags::DataType;
use abi::*;
pub use stub::ToStub;
#[repr(C)]
pub struct Description {
pub module: Module,
pub version: &'static str,
}
impl Description {
pub fn new(module: Module) -> Self {
Self {
module,
version: crate::VERSION,
}
}
}
#[repr(C)]
pub struct Module {
pub name: Str,
pub functions: Vec<Function>,
pub classes: Vec<Class>,
pub constants: Vec<Constant>,
}
#[repr(C)]
pub struct DocBlock(pub Vec<Str>);
#[repr(C)]
pub struct Function {
pub name: Str,
pub docs: DocBlock,
pub ret: Option<Retval>,
pub params: Vec<Parameter>,
}
#[repr(C)]
pub struct Parameter {
pub name: Str,
pub ty: Option<DataType>,
pub nullable: bool,
pub default: Option<Str>,
}
#[repr(C)]
pub struct Class {
pub name: Str,
pub docs: DocBlock,
pub extends: Option<Str>,
pub implements: Vec<Str>,
pub properties: Vec<Property>,
pub methods: Vec<Method>,
pub constants: Vec<Constant>,
}
#[repr(C)]
pub struct Property {
pub name: Str,
pub docs: DocBlock,
pub ty: Option<DataType>,
pub vis: Visibility,
pub static_: bool,
pub nullable: bool,
pub default: Option<Str>,
}
#[repr(C)]
pub struct Method {
pub name: Str,
pub docs: DocBlock,
pub ty: MethodType,
pub params: Vec<Parameter>,
pub retval: Option<Retval>,
pub _static: bool,
pub visibility: Visibility,
}
#[repr(C)]
pub struct Retval {
pub ty: DataType,
pub nullable: bool,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub enum MethodType {
Member,
Static,
Constructor,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub enum Visibility {
Private,
Protected,
Public,
}
#[repr(C)]
pub struct Constant {
pub name: Str,
pub docs: DocBlock,
pub value: Option<Str>,
}