blob: 32354c66645e5521fde8fd0ef647f7131a13495b [file] [log] [blame]
Michael Forster82c02d32022-05-20 21:47:33 -07001// 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 Anforowicz19e057d2022-10-28 12:03:23 -07005// Automatically @generated Rust bindings for the following C++ target:
Michael Forster82c02d32022-05-20 21:47:33 -07006// //rs_bindings_from_cc/test/golden:bitfields_cc
Lukasz Anforowicz19e057d2022-10-28 12:03:23 -07007
Devin Jeanpierre43356432023-01-13 12:39:02 -08008#![rustfmt::skip]
9#![feature(custom_inner_attributes, negative_impls, type_alias_impl_trait)]
Lukasz Anforowicz16889da2022-10-06 13:37:48 -070010#![allow(stable_features)]
Michael Forster82c02d32022-05-20 21:47:33 -070011#![allow(non_camel_case_types)]
12#![allow(non_snake_case)]
13#![allow(non_upper_case_globals)]
14#![deny(warnings)]
15
Michael Forster82c02d32022-05-20 21:47:33 -070016// 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
Googlerba8c50c2023-01-25 13:07:31 -080020/// Generated from: rs_bindings_from_cc/test/golden/bitfields.h;l=10
Devin Jeanpierrecd5ebf32022-07-08 05:31:55 -070021#[::ctor::recursively_pinned]
Michael Forster82c02d32022-05-20 21:47:33 -070022#[repr(C, align(4))]
23pub struct WithBitfields {
24 // f1 : 2 bits
Devin Jeanpierrecd5ebf32022-07-08 05:31:55 -070025 __bitfields0: [::std::mem::MaybeUninit<u8>; 1],
Michael Forster82c02d32022-05-20 21:47:33 -070026 pub f2: i32,
27 // f3 : 4 bits
28 // f4 : 8 bits
29 // : 45 bits
Devin Jeanpierrecd5ebf32022-07-08 05:31:55 -070030 __bitfields2: [::std::mem::MaybeUninit<u8>; 10],
Michael Forster82c02d32022-05-20 21:47:33 -070031 pub f5: i32,
32 // f6 : 23 bits
Devin Jeanpierrecd5ebf32022-07-08 05:31:55 -070033 __bitfields4: [::std::mem::MaybeUninit<u8>; 3],
34 pub(crate) f7: [::std::mem::MaybeUninit<u8>; 1],
Michael Forster82c02d32022-05-20 21:47:33 -070035 // f8 : 2 bits
Devin Jeanpierrecd5ebf32022-07-08 05:31:55 -070036 __bitfields6: [::std::mem::MaybeUninit<u8>; 1],
Michael Forster82c02d32022-05-20 21:47:33 -070037}
38forward_declare::unsafe_define!(forward_declare::symbol!("WithBitfields"), crate::WithBitfields);
39impl WithBitfields {
40 pub fn f7(&self) -> &u8 {
41 unsafe { &*(&self.f7 as *const _ as *const u8) }
42 }
43}
44
Googlerba8c50c2023-01-25 13:07:31 -080045/// Generated from: rs_bindings_from_cc/test/golden/bitfields.h;l=10
Devin Jeanpierrecd5ebf32022-07-08 05:31:55 -070046impl ::ctor::CtorNew<()> for WithBitfields {
47 type CtorType = impl ::ctor::Ctor<Output = Self>;
Devin Jeanpierre56413252022-06-02 18:48:24 -070048 #[inline(always)]
49 fn ctor_new(args: ()) -> Self::CtorType {
50 let () = args;
Devin Jeanpierre93927e82022-08-01 14:05:54 -070051 unsafe {
Felipe de A. Mello Pereirabfc70b02023-01-13 00:04:41 -080052 ::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 Jeanpierre93927e82022-08-01 14:05:54 -070057 }
Devin Jeanpierre56413252022-06-02 18:48:24 -070058 }
59}
Michael Forster82c02d32022-05-20 21:47:33 -070060
Googlerba8c50c2023-01-25 13:07:31 -080061/// Generated from: rs_bindings_from_cc/test/golden/bitfields.h;l=10
Felipe de A. Mello Pereira6f3cf162023-01-16 00:48:25 -080062impl<'b> ::ctor::CtorNew<&'b Self> for WithBitfields {
Devin Jeanpierre83cb2dc2022-07-15 01:50:28 -070063 type CtorType = impl ::ctor::Ctor<Output = Self> + ::ctor::Captures<'b>;
Devin Jeanpierre56413252022-06-02 18:48:24 -070064 #[inline(always)]
Felipe de A. Mello Pereira6f3cf162023-01-16 00:48:25 -080065 fn ctor_new(args: &'b Self) -> Self::CtorType {
Devin Jeanpierre56413252022-06-02 18:48:24 -070066 let __param_0 = args;
Devin Jeanpierre93927e82022-08-01 14:05:54 -070067 unsafe {
Felipe de A. Mello Pereirabfc70b02023-01-13 00:04:41 -080068 ::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 Jeanpierre93927e82022-08-01 14:05:54 -070074 }
Devin Jeanpierre56413252022-06-02 18:48:24 -070075 }
76}
Felipe de A. Mello Pereira6f3cf162023-01-16 00:48:25 -080077impl<'b> ::ctor::CtorNew<(&'b Self,)> for WithBitfields {
Devin Jeanpierre83cb2dc2022-07-15 01:50:28 -070078 type CtorType = impl ::ctor::Ctor<Output = Self> + ::ctor::Captures<'b>;
Devin Jeanpierre56413252022-06-02 18:48:24 -070079 #[inline(always)]
Felipe de A. Mello Pereira6f3cf162023-01-16 00:48:25 -080080 fn ctor_new(args: (&'b Self,)) -> Self::CtorType {
Devin Jeanpierre56413252022-06-02 18:48:24 -070081 let (arg,) = args;
Felipe de A. Mello Pereira6f3cf162023-01-16 00:48:25 -080082 <Self as ::ctor::CtorNew<&'b Self>>::ctor_new(arg)
Devin Jeanpierre56413252022-06-02 18:48:24 -070083 }
84}
Michael Forster82c02d32022-05-20 21:47:33 -070085
Googlerba8c50c2023-01-25 13:07:31 -080086/// Generated from: rs_bindings_from_cc/test/golden/bitfields.h;l=10
Felipe de A. Mello Pereira6f3cf162023-01-16 00:48:25 -080087impl<'b> ::ctor::CtorNew<::ctor::RvalueReference<'b, Self>> for WithBitfields {
Devin Jeanpierre83cb2dc2022-07-15 01:50:28 -070088 type CtorType = impl ::ctor::Ctor<Output = Self> + ::ctor::Captures<'b>;
Devin Jeanpierre56413252022-06-02 18:48:24 -070089 #[inline(always)]
Felipe de A. Mello Pereira6f3cf162023-01-16 00:48:25 -080090 fn ctor_new(args: ::ctor::RvalueReference<'b, Self>) -> Self::CtorType {
Devin Jeanpierre56413252022-06-02 18:48:24 -070091 let __param_0 = args;
Devin Jeanpierre93927e82022-08-01 14:05:54 -070092 unsafe {
Felipe de A. Mello Pereirabfc70b02023-01-13 00:04:41 -080093 ::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 Jeanpierre93927e82022-08-01 14:05:54 -070099 }
Devin Jeanpierre56413252022-06-02 18:48:24 -0700100 }
101}
Felipe de A. Mello Pereira6f3cf162023-01-16 00:48:25 -0800102impl<'b> ::ctor::CtorNew<(::ctor::RvalueReference<'b, Self>,)> for WithBitfields {
Devin Jeanpierre83cb2dc2022-07-15 01:50:28 -0700103 type CtorType = impl ::ctor::Ctor<Output = Self> + ::ctor::Captures<'b>;
Devin Jeanpierre56413252022-06-02 18:48:24 -0700104 #[inline(always)]
Felipe de A. Mello Pereira6f3cf162023-01-16 00:48:25 -0800105 fn ctor_new(args: (::ctor::RvalueReference<'b, Self>,)) -> Self::CtorType {
Devin Jeanpierre56413252022-06-02 18:48:24 -0700106 let (arg,) = args;
Felipe de A. Mello Pereira6f3cf162023-01-16 00:48:25 -0800107 <Self as ::ctor::CtorNew<::ctor::RvalueReference<'b, Self>>>::ctor_new(arg)
Devin Jeanpierre56413252022-06-02 18:48:24 -0700108 }
109}
Michael Forster82c02d32022-05-20 21:47:33 -0700110
Googlerba8c50c2023-01-25 13:07:31 -0800111/// Generated from: rs_bindings_from_cc/test/golden/bitfields.h;l=10
Felipe de A. Mello Pereira5b9ad752023-01-11 01:03:23 -0800112impl<'b> ::ctor::Assign<&'b Self> for WithBitfields {
Devin Jeanpierre9ced4ef2022-06-08 12:39:10 -0700113 #[inline(always)]
Felipe de A. Mello Pereira5b9ad752023-01-11 01:03:23 -0800114 fn assign<'a>(self: ::std::pin::Pin<&'a mut Self>, __param_0: &'b Self) {
Devin Jeanpierre9ced4ef2022-06-08 12:39:10 -0700115 unsafe {
116 crate::detail::__rust_thunk___ZN13WithBitfieldsaSERKS_(self, __param_0);
117 }
118 }
119}
Michael Forster82c02d32022-05-20 21:47:33 -0700120
Googlerba8c50c2023-01-25 13:07:31 -0800121/// Generated from: rs_bindings_from_cc/test/golden/bitfields.h;l=10
Felipe de A. Mello Pereira6f3cf162023-01-16 00:48:25 -0800122impl<'b> ::ctor::Assign<::ctor::RvalueReference<'b, Self>> for WithBitfields {
Devin Jeanpierre9ced4ef2022-06-08 12:39:10 -0700123 #[inline(always)]
124 fn assign<'a>(
Devin Jeanpierrecd5ebf32022-07-08 05:31:55 -0700125 self: ::std::pin::Pin<&'a mut Self>,
Felipe de A. Mello Pereira6f3cf162023-01-16 00:48:25 -0800126 __param_0: ::ctor::RvalueReference<'b, Self>,
Devin Jeanpierre9ced4ef2022-06-08 12:39:10 -0700127 ) {
128 unsafe {
129 crate::detail::__rust_thunk___ZN13WithBitfieldsaSEOS_(self, __param_0);
130 }
131 }
132}
Michael Forster82c02d32022-05-20 21:47:33 -0700133
134// CRUBIT_RS_BINDINGS_FROM_CC_TEST_GOLDEN_BITFIELDS_H_
135
Devin Jeanpierre56413252022-06-02 18:48:24 -0700136mod detail {
137 #[allow(unused_imports)]
138 use super::*;
139 extern "C" {
140 pub(crate) fn __rust_thunk___ZN13WithBitfieldsC1Ev<'a>(
Devin Jeanpierrecd5ebf32022-07-08 05:31:55 -0700141 __this: &'a mut ::std::mem::MaybeUninit<crate::WithBitfields>,
Devin Jeanpierre56413252022-06-02 18:48:24 -0700142 );
143 pub(crate) fn __rust_thunk___ZN13WithBitfieldsC1ERKS_<'a, 'b>(
Devin Jeanpierrecd5ebf32022-07-08 05:31:55 -0700144 __this: &'a mut ::std::mem::MaybeUninit<crate::WithBitfields>,
Devin Jeanpierre56413252022-06-02 18:48:24 -0700145 __param_0: &'b crate::WithBitfields,
146 );
147 pub(crate) fn __rust_thunk___ZN13WithBitfieldsC1EOS_<'a, 'b>(
Devin Jeanpierrecd5ebf32022-07-08 05:31:55 -0700148 __this: &'a mut ::std::mem::MaybeUninit<crate::WithBitfields>,
149 __param_0: ::ctor::RvalueReference<'b, crate::WithBitfields>,
Devin Jeanpierre56413252022-06-02 18:48:24 -0700150 );
Devin Jeanpierre9ced4ef2022-06-08 12:39:10 -0700151 pub(crate) fn __rust_thunk___ZN13WithBitfieldsaSERKS_<'a, 'b>(
Devin Jeanpierrecd5ebf32022-07-08 05:31:55 -0700152 __this: ::std::pin::Pin<&'a mut crate::WithBitfields>,
Devin Jeanpierre9ced4ef2022-06-08 12:39:10 -0700153 __param_0: &'b crate::WithBitfields,
Devin Jeanpierrecd5ebf32022-07-08 05:31:55 -0700154 ) -> ::std::pin::Pin<&'a mut crate::WithBitfields>;
Devin Jeanpierre9ced4ef2022-06-08 12:39:10 -0700155 pub(crate) fn __rust_thunk___ZN13WithBitfieldsaSEOS_<'a, 'b>(
Devin Jeanpierrecd5ebf32022-07-08 05:31:55 -0700156 __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 Jeanpierre56413252022-06-02 18:48:24 -0700159 }
160}
161
Devin Jeanpierrecd5ebf32022-07-08 05:31:55 -0700162const _: () = assert!(::std::mem::size_of::<Option<&i32>>() == ::std::mem::size_of::<&i32>());
Michael Forster82c02d32022-05-20 21:47:33 -0700163
Devin Jeanpierrecd5ebf32022-07-08 05:31:55 -0700164const _: () = assert!(::std::mem::size_of::<crate::WithBitfields>() == 32);
165const _: () = assert!(::std::mem::align_of::<crate::WithBitfields>() == 4);
Michael Forster82c02d32022-05-20 21:47:33 -0700166const _: () = {
Lukasz Anforowiczb4d17782022-07-07 08:09:13 -0700167 static_assertions::assert_not_impl_any!(crate::WithBitfields: Copy);
Michael Forster82c02d32022-05-20 21:47:33 -0700168};
169const _: () = {
Lukasz Anforowiczb4d17782022-07-07 08:09:13 -0700170 static_assertions::assert_not_impl_any!(crate::WithBitfields: Drop);
Michael Forster82c02d32022-05-20 21:47:33 -0700171};
Lukasz Anforowiczed94b242022-09-07 11:47:58 -0700172const _: () = assert!(memoffset::offset_of!(crate::WithBitfields, f2) == 4);
173const _: () = assert!(memoffset::offset_of!(crate::WithBitfields, f5) == 20);
174const _: () = assert!(memoffset::offset_of!(crate::WithBitfields, f7) == 27);