use std::ptr::NonNull; /// This will have a destructor manually implemented via variant_body, and /// similarly a Drop impl in Rust. #[repr(C)] pub struct OwnedSlice { len: usize, ptr: NonNull, } #[repr(u8)] pub enum FillRule { A, B } #[repr(C)] pub struct Polygon { pub fill: FillRule, pub coordinates: OwnedSlice, } #[repr(C, u8)] pub enum Foo { Bar, Polygon1(Polygon), Slice1(OwnedSlice), Slice2(OwnedSlice), Slice3 { fill: FillRule, coords: OwnedSlice, }, Slice4 { fill: FillRule, coords: OwnedSlice, }, } #[repr(u8)] pub enum Baz { Bar2, Polygon21(Polygon), Slice21(OwnedSlice), Slice22(OwnedSlice), Slice23 { fill: FillRule, coords: OwnedSlice, }, Slice24 { fill: FillRule, coords: OwnedSlice, }, } #[repr(u8)] pub enum Taz { Bar3, Taz1(i32), Taz3(OwnedSlice), } /// cbindgen:derive-tagged-enum-destructor=false /// cbindgen:derive-tagged-enum-copy-constructor=false #[repr(u8)] pub enum Tazz { Bar4, Taz2(i32), } /// cbindgen:derive-tagged-enum-copy-assignment=false #[repr(u8)] pub enum Tazzz { Bar5, Taz5(i32), } #[repr(u8)] pub enum Tazzzz { Taz6(i32), Taz7(u32), } /// cbindgen:derive-eq=true /// cbindgen:derive-neq=true /// cbindgen:neq-attributes=NODISCARD /// cbindgen:eq-attributes=NODISCARD /// cbindgen:destructor-attributes=NOINLINE /// cbindgen:copy-constructor-attributes=NOINLINE /// cbindgen:copy-assignment-attributes=NOINLINE #[repr(u8)] pub enum Qux { /// cbindgen:derive-eq=true Qux1(i32), /// cbindgen:derive-eq=true Qux2(u32), } #[no_mangle] pub extern "C" fn root(a: &Foo, b: &Baz, c: &Taz, d: Tazz, e: &Tazzz, f: &Tazzzz, g: &Qux) {}