forked from mozilla/cbindgen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenum.rs
113 lines (100 loc) · 1.11 KB
/
enum.rs
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
enum Opaque {
Foo(i32),
Bar
}
#[repr(u32)]
enum A {
a1 = 0,
a2 = 2,
a3,
a4 = 5,
}
#[repr(u16)]
enum B {
b1 = 0,
b2 = 2,
b3,
b4 = 5,
}
#[repr(u8)]
enum C {
c1 = 0,
c2 = 2,
c3,
c4 = 5,
}
#[repr(usize)]
enum D {
d1 = 0,
d2 = 2,
d3,
d4 = 5,
}
#[repr(isize)]
enum E {
e1 = 0,
e2 = 2,
e3,
e4 = 5,
}
#[repr(u8)]
enum F {
Foo(i16),
Bar { x: u8, y: i16 },
Baz
}
/// cbindgen:prefix-with-name
#[repr(C)]
enum G {
Foo(i16),
Bar { x: u8, y: i16 },
Baz
}
/// cbindgen:prefix-with-name
#[repr(C, u8)]
enum H {
Foo(i16),
Bar { x: u8, y: i16 },
Baz
}
#[repr(C, u8, u16)]
enum I {
Foo(i16),
Bar { x: u8, y: i16 },
Baz
}
#[repr(C, u8, unknown_hint)]
enum J {
Foo(i16),
Bar { x: u8, y: i16 },
Baz
}
#[repr(C)]
enum K {
k1,
k2,
k3,
k4,
}
#[repr(i8)]
enum L {
l1 = -1,
l2 = 0,
l3 = 1,
}
#[no_mangle]
pub extern "C" fn root(
o: *mut Opaque,
a: A,
b: B,
c: C,
d: D,
e: E,
f: F,
g: G,
h: H,
i: I,
j: J,
k: K,
l: L,
) { }