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 Tazz { Bar4, Taz2(i32), } #[no_mangle] pub extern "C" fn root(a: &Foo, b: &Baz, c: &Taz, d: Tazz) {}