Debian Codegraph @

.cargo/vendor/cbindgen/tests/expectations/destructor_and_copy_ctor.pyx

raw
1 #define NOINLINE __attribute__((noinline))
2 #define NODISCARD [[nodiscard]]
3
4
5 from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
6 from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
7 cdef extern from *:
8 ctypedef bint bool
9 ctypedef struct va_list
10
11 cdef extern from *:
12
13 cdef enum:
14 A,
15 B,
16 ctypedef uint8_t FillRule;
17
18 # This will have a destructor manually implemented via variant_body, and
19 # similarly a Drop impl in Rust.
20 ctypedef struct OwnedSlice_u32:
21 uintptr_t len;
22 uint32_t *ptr;
23
24 ctypedef struct Polygon_u32:
25 FillRule fill;
26 OwnedSlice_u32 coordinates;
27
28 # This will have a destructor manually implemented via variant_body, and
29 # similarly a Drop impl in Rust.
30 ctypedef struct OwnedSlice_i32:
31 uintptr_t len;
32 int32_t *ptr;
33
34 cdef enum:
35 Bar_u32,
36 Polygon1_u32,
37 Slice1_u32,
38 Slice2_u32,
39 Slice3_u32,
40 Slice4_u32,
41 ctypedef uint8_t Foo_u32_Tag;
42
43 ctypedef struct Slice3_Body_u32:
44 FillRule fill;
45 OwnedSlice_u32 coords;
46
47 ctypedef struct Slice4_Body_u32:
48 FillRule fill;
49 OwnedSlice_i32 coords;
50
51 ctypedef struct Foo_u32:
52 Foo_u32_Tag tag;
53 Polygon_u32 polygon1;
54 OwnedSlice_u32 slice1;
55 OwnedSlice_i32 slice2;
56 Slice3_Body_u32 slice3;
57 Slice4_Body_u32 slice4;
58
59 ctypedef struct Polygon_i32:
60 FillRule fill;
61 OwnedSlice_i32 coordinates;
62
63 cdef enum:
64 Bar2_i32,
65 Polygon21_i32,
66 Slice21_i32,
67 Slice22_i32,
68 Slice23_i32,
69 Slice24_i32,
70 ctypedef uint8_t Baz_i32_Tag;
71
72 ctypedef struct Slice23_Body_i32:
73 Baz_i32_Tag tag;
74 FillRule fill;
75 OwnedSlice_i32 coords;
76
77 ctypedef struct Slice24_Body_i32:
78 Baz_i32_Tag tag;
79 FillRule fill;
80 OwnedSlice_i32 coords;
81
82 ctypedef union Baz_i32:
83 Baz_i32_Tag tag;
84 Polygon_i32 polygon21;
85 OwnedSlice_i32 slice21;
86 OwnedSlice_i32 slice22;
87 Slice23_Body_i32 slice23;
88 Slice24_Body_i32 slice24;
89
90 cdef enum:
91 Bar3,
92 Taz1,
93 Taz3,
94 ctypedef uint8_t Taz_Tag;
95
96 ctypedef union Taz:
97 Taz_Tag tag;
98 int32_t taz1;
99 OwnedSlice_i32 taz3;
100
101 cdef enum:
102 Bar4,
103 Taz2,
104 ctypedef uint8_t Tazz_Tag;
105
106 ctypedef union Tazz:
107 Tazz_Tag tag;
108 int32_t taz2;
109
110 cdef enum:
111 Bar5,
112 Taz5,
113 ctypedef uint8_t Tazzz_Tag;
114
115 ctypedef union Tazzz:
116 Tazzz_Tag tag;
117 int32_t taz5;
118
119 cdef enum:
120 Taz6,
121 Taz7,
122 ctypedef uint8_t Tazzzz_Tag;
123
124 ctypedef union Tazzzz:
125 Tazzzz_Tag tag;
126 int32_t taz6;
127 uint32_t taz7;
128
129 cdef enum:
130 Qux1,
131 Qux2,
132 ctypedef uint8_t Qux_Tag;
133
134 ctypedef union Qux:
135 Qux_Tag tag;
136 int32_t qux1;
137 uint32_t qux2;
138
139 void root(const Foo_u32 *a,
140 const Baz_i32 *b,
141 const Taz *c,
142 Tazz d,
143 const Tazzz *e,
144 const Tazzzz *f,
145 const Qux *g);