#[repr(transparent)] struct TransparentStruct { field: u8 } impl TransparentStruct { pub const ASSOC_STRUCT_FOO: i64 = 1; pub const ASSOC_STRUCT_BAR: TransparentStruct = TransparentStruct { field: 2 }; // TODO: Only C++ supports template constants so far. pub const ASSOC_STRUCT_BAZ: Wrapper = Wrapper { field: TransparentStruct { field: 3 } }; } #[repr(transparent)] struct TransparentTupleStruct(u8); #[repr(transparent)] struct Wrapper { field: T } pub const STRUCT_FOO: TransparentStruct = TransparentStruct { field: 4 }; pub const STRUCT_BAR: TransparentTupleStruct = TransparentTupleStruct(5); // TODO: Only C++ supports template constants so far. pub const STRUCT_BAZ: Wrapper = Wrapper { field: TransparentStruct { field: 6 } }; #[repr(transparent)] struct TransparentStructWithErasedField { field: Wrapper, } // TODO: Only C++ supports template constants so far. pub const COMPLEX: TransparentStructWithErasedField = TransparentStructWithErasedField { field: Wrapper { field: TransparentStruct { field: 7 } } };