Michael Forster | 82c02d3 | 2022-05-20 21:47:33 -0700 | [diff] [blame] | 1 | // Part of the Crubit project, under the Apache License v2.0 with LLVM |
| 2 | // Exceptions. See /LICENSE for license information. |
| 3 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 4 | |
Lukasz Anforowicz | 19e057d | 2022-10-28 12:03:23 -0700 | [diff] [blame] | 5 | // Automatically @generated Rust bindings for the following C++ target: |
Michael Forster | 82c02d3 | 2022-05-20 21:47:33 -0700 | [diff] [blame] | 6 | // //rs_bindings_from_cc/test/golden:bitfields_cc |
Lukasz Anforowicz | 19e057d | 2022-10-28 12:03:23 -0700 | [diff] [blame] | 7 | |
Devin Jeanpierre | 4335643 | 2023-01-13 12:39:02 -0800 | [diff] [blame] | 8 | #![rustfmt::skip] |
| 9 | #![feature(custom_inner_attributes, negative_impls, type_alias_impl_trait)] |
Lukasz Anforowicz | 16889da | 2022-10-06 13:37:48 -0700 | [diff] [blame] | 10 | #![allow(stable_features)] |
Michael Forster | 82c02d3 | 2022-05-20 21:47:33 -0700 | [diff] [blame] | 11 | #![allow(non_camel_case_types)] |
| 12 | #![allow(non_snake_case)] |
| 13 | #![allow(non_upper_case_globals)] |
| 14 | #![deny(warnings)] |
| 15 | |
Michael Forster | 82c02d3 | 2022-05-20 21:47:33 -0700 | [diff] [blame] | 16 | // Part of the Crubit project, under the Apache License v2.0 with LLVM |
| 17 | // Exceptions. See /LICENSE for license information. |
| 18 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 19 | |
Googler | ba8c50c | 2023-01-25 13:07:31 -0800 | [diff] [blame^] | 20 | /// Generated from: rs_bindings_from_cc/test/golden/bitfields.h;l=10 |
Devin Jeanpierre | cd5ebf3 | 2022-07-08 05:31:55 -0700 | [diff] [blame] | 21 | #[::ctor::recursively_pinned] |
Michael Forster | 82c02d3 | 2022-05-20 21:47:33 -0700 | [diff] [blame] | 22 | #[repr(C, align(4))] |
| 23 | pub struct WithBitfields { |
| 24 | // f1 : 2 bits |
Devin Jeanpierre | cd5ebf3 | 2022-07-08 05:31:55 -0700 | [diff] [blame] | 25 | __bitfields0: [::std::mem::MaybeUninit<u8>; 1], |
Michael Forster | 82c02d3 | 2022-05-20 21:47:33 -0700 | [diff] [blame] | 26 | pub f2: i32, |
| 27 | // f3 : 4 bits |
| 28 | // f4 : 8 bits |
| 29 | // : 45 bits |
Devin Jeanpierre | cd5ebf3 | 2022-07-08 05:31:55 -0700 | [diff] [blame] | 30 | __bitfields2: [::std::mem::MaybeUninit<u8>; 10], |
Michael Forster | 82c02d3 | 2022-05-20 21:47:33 -0700 | [diff] [blame] | 31 | pub f5: i32, |
| 32 | // f6 : 23 bits |
Devin Jeanpierre | cd5ebf3 | 2022-07-08 05:31:55 -0700 | [diff] [blame] | 33 | __bitfields4: [::std::mem::MaybeUninit<u8>; 3], |
| 34 | pub(crate) f7: [::std::mem::MaybeUninit<u8>; 1], |
Michael Forster | 82c02d3 | 2022-05-20 21:47:33 -0700 | [diff] [blame] | 35 | // f8 : 2 bits |
Devin Jeanpierre | cd5ebf3 | 2022-07-08 05:31:55 -0700 | [diff] [blame] | 36 | __bitfields6: [::std::mem::MaybeUninit<u8>; 1], |
Michael Forster | 82c02d3 | 2022-05-20 21:47:33 -0700 | [diff] [blame] | 37 | } |
| 38 | forward_declare::unsafe_define!(forward_declare::symbol!("WithBitfields"), crate::WithBitfields); |
| 39 | impl WithBitfields { |
| 40 | pub fn f7(&self) -> &u8 { |
| 41 | unsafe { &*(&self.f7 as *const _ as *const u8) } |
| 42 | } |
| 43 | } |
| 44 | |
Googler | ba8c50c | 2023-01-25 13:07:31 -0800 | [diff] [blame^] | 45 | /// Generated from: rs_bindings_from_cc/test/golden/bitfields.h;l=10 |
Devin Jeanpierre | cd5ebf3 | 2022-07-08 05:31:55 -0700 | [diff] [blame] | 46 | impl ::ctor::CtorNew<()> for WithBitfields { |
| 47 | type CtorType = impl ::ctor::Ctor<Output = Self>; |
Devin Jeanpierre | 5641325 | 2022-06-02 18:48:24 -0700 | [diff] [blame] | 48 | #[inline(always)] |
| 49 | fn ctor_new(args: ()) -> Self::CtorType { |
| 50 | let () = args; |
Devin Jeanpierre | 93927e8 | 2022-08-01 14:05:54 -0700 | [diff] [blame] | 51 | unsafe { |
Felipe de A. Mello Pereira | bfc70b0 | 2023-01-13 00:04:41 -0800 | [diff] [blame] | 52 | ::ctor::FnCtor::new(move |dest: ::std::pin::Pin<&mut ::std::mem::MaybeUninit<Self>>| { |
| 53 | crate::detail::__rust_thunk___ZN13WithBitfieldsC1Ev( |
| 54 | ::std::pin::Pin::into_inner_unchecked(dest), |
| 55 | ); |
| 56 | }) |
Devin Jeanpierre | 93927e8 | 2022-08-01 14:05:54 -0700 | [diff] [blame] | 57 | } |
Devin Jeanpierre | 5641325 | 2022-06-02 18:48:24 -0700 | [diff] [blame] | 58 | } |
| 59 | } |
Michael Forster | 82c02d3 | 2022-05-20 21:47:33 -0700 | [diff] [blame] | 60 | |
Googler | ba8c50c | 2023-01-25 13:07:31 -0800 | [diff] [blame^] | 61 | /// Generated from: rs_bindings_from_cc/test/golden/bitfields.h;l=10 |
Felipe de A. Mello Pereira | 6f3cf16 | 2023-01-16 00:48:25 -0800 | [diff] [blame] | 62 | impl<'b> ::ctor::CtorNew<&'b Self> for WithBitfields { |
Devin Jeanpierre | 83cb2dc | 2022-07-15 01:50:28 -0700 | [diff] [blame] | 63 | type CtorType = impl ::ctor::Ctor<Output = Self> + ::ctor::Captures<'b>; |
Devin Jeanpierre | 5641325 | 2022-06-02 18:48:24 -0700 | [diff] [blame] | 64 | #[inline(always)] |
Felipe de A. Mello Pereira | 6f3cf16 | 2023-01-16 00:48:25 -0800 | [diff] [blame] | 65 | fn ctor_new(args: &'b Self) -> Self::CtorType { |
Devin Jeanpierre | 5641325 | 2022-06-02 18:48:24 -0700 | [diff] [blame] | 66 | let __param_0 = args; |
Devin Jeanpierre | 93927e8 | 2022-08-01 14:05:54 -0700 | [diff] [blame] | 67 | unsafe { |
Felipe de A. Mello Pereira | bfc70b0 | 2023-01-13 00:04:41 -0800 | [diff] [blame] | 68 | ::ctor::FnCtor::new(move |dest: ::std::pin::Pin<&mut ::std::mem::MaybeUninit<Self>>| { |
| 69 | crate::detail::__rust_thunk___ZN13WithBitfieldsC1ERKS_( |
| 70 | ::std::pin::Pin::into_inner_unchecked(dest), |
| 71 | __param_0, |
| 72 | ); |
| 73 | }) |
Devin Jeanpierre | 93927e8 | 2022-08-01 14:05:54 -0700 | [diff] [blame] | 74 | } |
Devin Jeanpierre | 5641325 | 2022-06-02 18:48:24 -0700 | [diff] [blame] | 75 | } |
| 76 | } |
Felipe de A. Mello Pereira | 6f3cf16 | 2023-01-16 00:48:25 -0800 | [diff] [blame] | 77 | impl<'b> ::ctor::CtorNew<(&'b Self,)> for WithBitfields { |
Devin Jeanpierre | 83cb2dc | 2022-07-15 01:50:28 -0700 | [diff] [blame] | 78 | type CtorType = impl ::ctor::Ctor<Output = Self> + ::ctor::Captures<'b>; |
Devin Jeanpierre | 5641325 | 2022-06-02 18:48:24 -0700 | [diff] [blame] | 79 | #[inline(always)] |
Felipe de A. Mello Pereira | 6f3cf16 | 2023-01-16 00:48:25 -0800 | [diff] [blame] | 80 | fn ctor_new(args: (&'b Self,)) -> Self::CtorType { |
Devin Jeanpierre | 5641325 | 2022-06-02 18:48:24 -0700 | [diff] [blame] | 81 | let (arg,) = args; |
Felipe de A. Mello Pereira | 6f3cf16 | 2023-01-16 00:48:25 -0800 | [diff] [blame] | 82 | <Self as ::ctor::CtorNew<&'b Self>>::ctor_new(arg) |
Devin Jeanpierre | 5641325 | 2022-06-02 18:48:24 -0700 | [diff] [blame] | 83 | } |
| 84 | } |
Michael Forster | 82c02d3 | 2022-05-20 21:47:33 -0700 | [diff] [blame] | 85 | |
Googler | ba8c50c | 2023-01-25 13:07:31 -0800 | [diff] [blame^] | 86 | /// Generated from: rs_bindings_from_cc/test/golden/bitfields.h;l=10 |
Felipe de A. Mello Pereira | 6f3cf16 | 2023-01-16 00:48:25 -0800 | [diff] [blame] | 87 | impl<'b> ::ctor::CtorNew<::ctor::RvalueReference<'b, Self>> for WithBitfields { |
Devin Jeanpierre | 83cb2dc | 2022-07-15 01:50:28 -0700 | [diff] [blame] | 88 | type CtorType = impl ::ctor::Ctor<Output = Self> + ::ctor::Captures<'b>; |
Devin Jeanpierre | 5641325 | 2022-06-02 18:48:24 -0700 | [diff] [blame] | 89 | #[inline(always)] |
Felipe de A. Mello Pereira | 6f3cf16 | 2023-01-16 00:48:25 -0800 | [diff] [blame] | 90 | fn ctor_new(args: ::ctor::RvalueReference<'b, Self>) -> Self::CtorType { |
Devin Jeanpierre | 5641325 | 2022-06-02 18:48:24 -0700 | [diff] [blame] | 91 | let __param_0 = args; |
Devin Jeanpierre | 93927e8 | 2022-08-01 14:05:54 -0700 | [diff] [blame] | 92 | unsafe { |
Felipe de A. Mello Pereira | bfc70b0 | 2023-01-13 00:04:41 -0800 | [diff] [blame] | 93 | ::ctor::FnCtor::new(move |dest: ::std::pin::Pin<&mut ::std::mem::MaybeUninit<Self>>| { |
| 94 | crate::detail::__rust_thunk___ZN13WithBitfieldsC1EOS_( |
| 95 | ::std::pin::Pin::into_inner_unchecked(dest), |
| 96 | __param_0, |
| 97 | ); |
| 98 | }) |
Devin Jeanpierre | 93927e8 | 2022-08-01 14:05:54 -0700 | [diff] [blame] | 99 | } |
Devin Jeanpierre | 5641325 | 2022-06-02 18:48:24 -0700 | [diff] [blame] | 100 | } |
| 101 | } |
Felipe de A. Mello Pereira | 6f3cf16 | 2023-01-16 00:48:25 -0800 | [diff] [blame] | 102 | impl<'b> ::ctor::CtorNew<(::ctor::RvalueReference<'b, Self>,)> for WithBitfields { |
Devin Jeanpierre | 83cb2dc | 2022-07-15 01:50:28 -0700 | [diff] [blame] | 103 | type CtorType = impl ::ctor::Ctor<Output = Self> + ::ctor::Captures<'b>; |
Devin Jeanpierre | 5641325 | 2022-06-02 18:48:24 -0700 | [diff] [blame] | 104 | #[inline(always)] |
Felipe de A. Mello Pereira | 6f3cf16 | 2023-01-16 00:48:25 -0800 | [diff] [blame] | 105 | fn ctor_new(args: (::ctor::RvalueReference<'b, Self>,)) -> Self::CtorType { |
Devin Jeanpierre | 5641325 | 2022-06-02 18:48:24 -0700 | [diff] [blame] | 106 | let (arg,) = args; |
Felipe de A. Mello Pereira | 6f3cf16 | 2023-01-16 00:48:25 -0800 | [diff] [blame] | 107 | <Self as ::ctor::CtorNew<::ctor::RvalueReference<'b, Self>>>::ctor_new(arg) |
Devin Jeanpierre | 5641325 | 2022-06-02 18:48:24 -0700 | [diff] [blame] | 108 | } |
| 109 | } |
Michael Forster | 82c02d3 | 2022-05-20 21:47:33 -0700 | [diff] [blame] | 110 | |
Googler | ba8c50c | 2023-01-25 13:07:31 -0800 | [diff] [blame^] | 111 | /// Generated from: rs_bindings_from_cc/test/golden/bitfields.h;l=10 |
Felipe de A. Mello Pereira | 5b9ad75 | 2023-01-11 01:03:23 -0800 | [diff] [blame] | 112 | impl<'b> ::ctor::Assign<&'b Self> for WithBitfields { |
Devin Jeanpierre | 9ced4ef | 2022-06-08 12:39:10 -0700 | [diff] [blame] | 113 | #[inline(always)] |
Felipe de A. Mello Pereira | 5b9ad75 | 2023-01-11 01:03:23 -0800 | [diff] [blame] | 114 | fn assign<'a>(self: ::std::pin::Pin<&'a mut Self>, __param_0: &'b Self) { |
Devin Jeanpierre | 9ced4ef | 2022-06-08 12:39:10 -0700 | [diff] [blame] | 115 | unsafe { |
| 116 | crate::detail::__rust_thunk___ZN13WithBitfieldsaSERKS_(self, __param_0); |
| 117 | } |
| 118 | } |
| 119 | } |
Michael Forster | 82c02d3 | 2022-05-20 21:47:33 -0700 | [diff] [blame] | 120 | |
Googler | ba8c50c | 2023-01-25 13:07:31 -0800 | [diff] [blame^] | 121 | /// Generated from: rs_bindings_from_cc/test/golden/bitfields.h;l=10 |
Felipe de A. Mello Pereira | 6f3cf16 | 2023-01-16 00:48:25 -0800 | [diff] [blame] | 122 | impl<'b> ::ctor::Assign<::ctor::RvalueReference<'b, Self>> for WithBitfields { |
Devin Jeanpierre | 9ced4ef | 2022-06-08 12:39:10 -0700 | [diff] [blame] | 123 | #[inline(always)] |
| 124 | fn assign<'a>( |
Devin Jeanpierre | cd5ebf3 | 2022-07-08 05:31:55 -0700 | [diff] [blame] | 125 | self: ::std::pin::Pin<&'a mut Self>, |
Felipe de A. Mello Pereira | 6f3cf16 | 2023-01-16 00:48:25 -0800 | [diff] [blame] | 126 | __param_0: ::ctor::RvalueReference<'b, Self>, |
Devin Jeanpierre | 9ced4ef | 2022-06-08 12:39:10 -0700 | [diff] [blame] | 127 | ) { |
| 128 | unsafe { |
| 129 | crate::detail::__rust_thunk___ZN13WithBitfieldsaSEOS_(self, __param_0); |
| 130 | } |
| 131 | } |
| 132 | } |
Michael Forster | 82c02d3 | 2022-05-20 21:47:33 -0700 | [diff] [blame] | 133 | |
| 134 | // CRUBIT_RS_BINDINGS_FROM_CC_TEST_GOLDEN_BITFIELDS_H_ |
| 135 | |
Devin Jeanpierre | 5641325 | 2022-06-02 18:48:24 -0700 | [diff] [blame] | 136 | mod detail { |
| 137 | #[allow(unused_imports)] |
| 138 | use super::*; |
| 139 | extern "C" { |
| 140 | pub(crate) fn __rust_thunk___ZN13WithBitfieldsC1Ev<'a>( |
Devin Jeanpierre | cd5ebf3 | 2022-07-08 05:31:55 -0700 | [diff] [blame] | 141 | __this: &'a mut ::std::mem::MaybeUninit<crate::WithBitfields>, |
Devin Jeanpierre | 5641325 | 2022-06-02 18:48:24 -0700 | [diff] [blame] | 142 | ); |
| 143 | pub(crate) fn __rust_thunk___ZN13WithBitfieldsC1ERKS_<'a, 'b>( |
Devin Jeanpierre | cd5ebf3 | 2022-07-08 05:31:55 -0700 | [diff] [blame] | 144 | __this: &'a mut ::std::mem::MaybeUninit<crate::WithBitfields>, |
Devin Jeanpierre | 5641325 | 2022-06-02 18:48:24 -0700 | [diff] [blame] | 145 | __param_0: &'b crate::WithBitfields, |
| 146 | ); |
| 147 | pub(crate) fn __rust_thunk___ZN13WithBitfieldsC1EOS_<'a, 'b>( |
Devin Jeanpierre | cd5ebf3 | 2022-07-08 05:31:55 -0700 | [diff] [blame] | 148 | __this: &'a mut ::std::mem::MaybeUninit<crate::WithBitfields>, |
| 149 | __param_0: ::ctor::RvalueReference<'b, crate::WithBitfields>, |
Devin Jeanpierre | 5641325 | 2022-06-02 18:48:24 -0700 | [diff] [blame] | 150 | ); |
Devin Jeanpierre | 9ced4ef | 2022-06-08 12:39:10 -0700 | [diff] [blame] | 151 | pub(crate) fn __rust_thunk___ZN13WithBitfieldsaSERKS_<'a, 'b>( |
Devin Jeanpierre | cd5ebf3 | 2022-07-08 05:31:55 -0700 | [diff] [blame] | 152 | __this: ::std::pin::Pin<&'a mut crate::WithBitfields>, |
Devin Jeanpierre | 9ced4ef | 2022-06-08 12:39:10 -0700 | [diff] [blame] | 153 | __param_0: &'b crate::WithBitfields, |
Devin Jeanpierre | cd5ebf3 | 2022-07-08 05:31:55 -0700 | [diff] [blame] | 154 | ) -> ::std::pin::Pin<&'a mut crate::WithBitfields>; |
Devin Jeanpierre | 9ced4ef | 2022-06-08 12:39:10 -0700 | [diff] [blame] | 155 | pub(crate) fn __rust_thunk___ZN13WithBitfieldsaSEOS_<'a, 'b>( |
Devin Jeanpierre | cd5ebf3 | 2022-07-08 05:31:55 -0700 | [diff] [blame] | 156 | __this: ::std::pin::Pin<&'a mut crate::WithBitfields>, |
| 157 | __param_0: ::ctor::RvalueReference<'b, crate::WithBitfields>, |
| 158 | ) -> ::std::pin::Pin<&'a mut crate::WithBitfields>; |
Devin Jeanpierre | 5641325 | 2022-06-02 18:48:24 -0700 | [diff] [blame] | 159 | } |
| 160 | } |
| 161 | |
Devin Jeanpierre | cd5ebf3 | 2022-07-08 05:31:55 -0700 | [diff] [blame] | 162 | const _: () = assert!(::std::mem::size_of::<Option<&i32>>() == ::std::mem::size_of::<&i32>()); |
Michael Forster | 82c02d3 | 2022-05-20 21:47:33 -0700 | [diff] [blame] | 163 | |
Devin Jeanpierre | cd5ebf3 | 2022-07-08 05:31:55 -0700 | [diff] [blame] | 164 | const _: () = assert!(::std::mem::size_of::<crate::WithBitfields>() == 32); |
| 165 | const _: () = assert!(::std::mem::align_of::<crate::WithBitfields>() == 4); |
Michael Forster | 82c02d3 | 2022-05-20 21:47:33 -0700 | [diff] [blame] | 166 | const _: () = { |
Lukasz Anforowicz | b4d1778 | 2022-07-07 08:09:13 -0700 | [diff] [blame] | 167 | static_assertions::assert_not_impl_any!(crate::WithBitfields: Copy); |
Michael Forster | 82c02d3 | 2022-05-20 21:47:33 -0700 | [diff] [blame] | 168 | }; |
| 169 | const _: () = { |
Lukasz Anforowicz | b4d1778 | 2022-07-07 08:09:13 -0700 | [diff] [blame] | 170 | static_assertions::assert_not_impl_any!(crate::WithBitfields: Drop); |
Michael Forster | 82c02d3 | 2022-05-20 21:47:33 -0700 | [diff] [blame] | 171 | }; |
Lukasz Anforowicz | ed94b24 | 2022-09-07 11:47:58 -0700 | [diff] [blame] | 172 | const _: () = assert!(memoffset::offset_of!(crate::WithBitfields, f2) == 4); |
| 173 | const _: () = assert!(memoffset::offset_of!(crate::WithBitfields, f5) == 20); |
| 174 | const _: () = assert!(memoffset::offset_of!(crate::WithBitfields, f7) == 27); |