1 #![allow(
2 dead_code,
3 non_snake_case,
4 non_camel_case_types,
5 non_upper_case_globals
6 )]
7
8 #[derive(PartialEq, Copy, Clone, Hash, Debug, Default)]
9 #[repr(C)]
10 pub struct __BindgenComplex<T> {
11 pub re: T,
12 pub im: T,
13 }
14 #[repr(C)]
15 #[derive(Debug, Default, Copy, Clone, PartialEq)]
16 pub struct TestDouble {
17 pub mMember: __BindgenComplex<f64>,
18 }
19 #[test]
bindgen_test_layout_TestDouble()20 fn bindgen_test_layout_TestDouble() {
21 const UNINIT: ::std::mem::MaybeUninit<TestDouble> =
22 ::std::mem::MaybeUninit::uninit();
23 let ptr = UNINIT.as_ptr();
24 assert_eq!(
25 ::std::mem::size_of::<TestDouble>(),
26 16usize,
27 concat!("Size of: ", stringify!(TestDouble))
28 );
29 assert_eq!(
30 ::std::mem::align_of::<TestDouble>(),
31 8usize,
32 concat!("Alignment of ", stringify!(TestDouble))
33 );
34 assert_eq!(
35 unsafe { ::std::ptr::addr_of!((*ptr).mMember) as usize - ptr as usize },
36 0usize,
37 concat!(
38 "Offset of field: ",
39 stringify!(TestDouble),
40 "::",
41 stringify!(mMember)
42 )
43 );
44 }
45 #[repr(C)]
46 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
47 pub struct TestDoublePtr {
48 pub mMember: *mut __BindgenComplex<f64>,
49 }
50 #[test]
bindgen_test_layout_TestDoublePtr()51 fn bindgen_test_layout_TestDoublePtr() {
52 const UNINIT: ::std::mem::MaybeUninit<TestDoublePtr> =
53 ::std::mem::MaybeUninit::uninit();
54 let ptr = UNINIT.as_ptr();
55 assert_eq!(
56 ::std::mem::size_of::<TestDoublePtr>(),
57 8usize,
58 concat!("Size of: ", stringify!(TestDoublePtr))
59 );
60 assert_eq!(
61 ::std::mem::align_of::<TestDoublePtr>(),
62 8usize,
63 concat!("Alignment of ", stringify!(TestDoublePtr))
64 );
65 assert_eq!(
66 unsafe { ::std::ptr::addr_of!((*ptr).mMember) as usize - ptr as usize },
67 0usize,
68 concat!(
69 "Offset of field: ",
70 stringify!(TestDoublePtr),
71 "::",
72 stringify!(mMember)
73 )
74 );
75 }
76 impl Default for TestDoublePtr {
default() -> Self77 fn default() -> Self {
78 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
79 unsafe {
80 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
81 s.assume_init()
82 }
83 }
84 }
85 #[repr(C)]
86 #[derive(Debug, Default, Copy, Clone, PartialEq)]
87 pub struct TestFloat {
88 pub mMember: __BindgenComplex<f32>,
89 }
90 #[test]
bindgen_test_layout_TestFloat()91 fn bindgen_test_layout_TestFloat() {
92 const UNINIT: ::std::mem::MaybeUninit<TestFloat> =
93 ::std::mem::MaybeUninit::uninit();
94 let ptr = UNINIT.as_ptr();
95 assert_eq!(
96 ::std::mem::size_of::<TestFloat>(),
97 8usize,
98 concat!("Size of: ", stringify!(TestFloat))
99 );
100 assert_eq!(
101 ::std::mem::align_of::<TestFloat>(),
102 4usize,
103 concat!("Alignment of ", stringify!(TestFloat))
104 );
105 assert_eq!(
106 unsafe { ::std::ptr::addr_of!((*ptr).mMember) as usize - ptr as usize },
107 0usize,
108 concat!(
109 "Offset of field: ",
110 stringify!(TestFloat),
111 "::",
112 stringify!(mMember)
113 )
114 );
115 }
116 #[repr(C)]
117 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
118 pub struct TestFloatPtr {
119 pub mMember: *mut __BindgenComplex<f32>,
120 }
121 #[test]
bindgen_test_layout_TestFloatPtr()122 fn bindgen_test_layout_TestFloatPtr() {
123 const UNINIT: ::std::mem::MaybeUninit<TestFloatPtr> =
124 ::std::mem::MaybeUninit::uninit();
125 let ptr = UNINIT.as_ptr();
126 assert_eq!(
127 ::std::mem::size_of::<TestFloatPtr>(),
128 8usize,
129 concat!("Size of: ", stringify!(TestFloatPtr))
130 );
131 assert_eq!(
132 ::std::mem::align_of::<TestFloatPtr>(),
133 8usize,
134 concat!("Alignment of ", stringify!(TestFloatPtr))
135 );
136 assert_eq!(
137 unsafe { ::std::ptr::addr_of!((*ptr).mMember) as usize - ptr as usize },
138 0usize,
139 concat!(
140 "Offset of field: ",
141 stringify!(TestFloatPtr),
142 "::",
143 stringify!(mMember)
144 )
145 );
146 }
147 impl Default for TestFloatPtr {
default() -> Self148 fn default() -> Self {
149 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
150 unsafe {
151 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
152 s.assume_init()
153 }
154 }
155 }
156