.cargo/vendor/cbindgen/tests/rust/forward_declaration.rs
raw| 1 | #[repr(C)] |
| 2 | struct TypeInfo { |
| 3 | data: TypeData, |
| 4 | } |
| 5 | |
| 6 | #[repr(C)] |
| 7 | enum TypeData { |
| 8 | Primitive, |
| 9 | Struct(StructInfo), |
| 10 | } |
| 11 | |
| 12 | #[repr(C)] |
| 13 | struct StructInfo { |
| 14 | fields: *const *const TypeInfo, // requires forward declaration |
| 15 | num_fields: usize, |
| 16 | } |
| 17 | |
| 18 | #[no_mangle] |
| 19 | pub extern "C" fn root( |
| 20 | x: TypeInfo, |
| 21 | ) {} |