blob: 84964fdc40b9443b2aaf9282f8e07faa3c4da907 [file] [log] [blame]
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -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 VanBemmel7a4d4c02022-07-27 13:21:47 -07006// //rs_bindings_from_cc/test/golden:friend_functions_cc
Devin Jeanpierre6ed0f602023-03-01 17:22:54 -08007// Features: experimental, supported
Lukasz Anforowicz19e057d2022-10-28 12:03:23 -07008
Devin Jeanpierre43356432023-01-13 12:39:02 -08009#![rustfmt::skip]
Devin Jeanpierre162d21f2023-11-21 15:14:00 -080010#![feature(custom_inner_attributes, register_tool)]
Devin Jeanpierre43356432023-01-13 12:39:02 -080011#![allow(stable_features)]
Googler61afe912023-03-03 13:59:15 -080012#![no_std]
Devin Jeanpierre162d21f2023-11-21 15:14:00 -080013#![register_tool(__crubit)]
Lukasz Anforowicz4bb78a72023-03-06 14:10:37 -080014#![allow(improper_ctypes)]
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -070015#![allow(non_camel_case_types)]
16#![allow(non_snake_case)]
17#![allow(non_upper_case_globals)]
18#![deny(warnings)]
19
20// Part of the Crubit project, under the Apache License v2.0 with LLVM
21// Exceptions. See /LICENSE for license information.
22// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
23
24#[derive(Clone, Copy)]
25#[repr(C)]
Devin Jeanpierre162d21f2023-11-21 15:14:00 -080026#[__crubit::annotate(cc_type = "SomeClass")]
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -070027pub struct SomeClass {
Googlerbed0a2a2023-03-01 11:53:43 -080028 __non_field_data: [::core::mem::MaybeUninit<u8>; 1],
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -070029}
30forward_declare::unsafe_define!(forward_declare::symbol!("SomeClass"), crate::SomeClass);
31
32impl Default for SomeClass {
33 #[inline(always)]
34 fn default() -> Self {
Googlerbed0a2a2023-03-01 11:53:43 -080035 let mut tmp = ::core::mem::MaybeUninit::<Self>::zeroed();
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -070036 unsafe {
37 crate::detail::__rust_thunk___ZN9SomeClassC1Ev(&mut tmp);
38 tmp.assume_init()
39 }
40 }
41}
42
Felipe de A. Mello Pereira6f3cf162023-01-16 00:48:25 -080043impl<'b> From<::ctor::RvalueReference<'b, Self>> for SomeClass {
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -070044 #[inline(always)]
Felipe de A. Mello Pereira6f3cf162023-01-16 00:48:25 -080045 fn from(__param_0: ::ctor::RvalueReference<'b, Self>) -> Self {
Googlerbed0a2a2023-03-01 11:53:43 -080046 let mut tmp = ::core::mem::MaybeUninit::<Self>::zeroed();
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -070047 unsafe {
48 crate::detail::__rust_thunk___ZN9SomeClassC1EOS_(&mut tmp, __param_0);
49 tmp.assume_init()
50 }
51 }
52}
53
Googler7341f5e2023-01-31 14:37:12 -080054impl<'b> ::ctor::UnpinAssign<&'b Self> for SomeClass {
55 #[inline(always)]
56 fn unpin_assign<'a>(&'a mut self, __param_0: &'b Self) {
57 unsafe {
58 crate::detail::__rust_thunk___ZN9SomeClassaSERKS_(self, __param_0);
59 }
60 }
61}
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -070062
Googler7341f5e2023-01-31 14:37:12 -080063impl<'b> ::ctor::UnpinAssign<::ctor::RvalueReference<'b, Self>> for SomeClass {
64 #[inline(always)]
65 fn unpin_assign<'a>(&'a mut self, __param_0: ::ctor::RvalueReference<'b, Self>) {
66 unsafe {
67 crate::detail::__rust_thunk___ZN9SomeClassaSEOS_(self, __param_0);
68 }
69 }
70}
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -070071
72/// Friend functions that are visible via ADL.
73#[inline(always)]
Lukasz Anforowicz81b96872023-03-17 16:16:32 -070074pub fn visible_val(mut __param_0: crate::SomeClass) {
75 unsafe { crate::detail::__rust_thunk___Z11visible_val9SomeClass(&mut __param_0) }
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -070076}
77
78#[inline(always)]
79pub fn visible_ref<'a>(__param_0: &'a mut crate::SomeClass) {
80 unsafe { crate::detail::__rust_thunk___Z11visible_refR9SomeClass(__param_0) }
81}
82
83#[inline(always)]
84pub fn visible_cref<'a>(__param_0: &'a crate::SomeClass) {
85 unsafe { crate::detail::__rust_thunk___Z12visible_crefRK9SomeClass(__param_0) }
86}
87
88#[inline(always)]
89pub fn visible_rref<'a>(__param_0: ::ctor::RvalueReference<'a, crate::SomeClass>) {
90 unsafe { crate::detail::__rust_thunk___Z12visible_rrefO9SomeClass(__param_0) }
91}
92
Lukasz Anforowicz6216ea82022-08-31 09:31:59 -070093/// A function can be declared multiple times - e.g. once in a friend
94/// declaration below + in a definition below. This example mimics
95/// Uint128Low64 declarations from absl/numeric/int128.h. This is a
96/// regression test for b/244311755.
97#[inline(always)]
Lukasz Anforowicz460e4272023-05-18 16:11:46 -070098pub fn multiple_declarations<'a>(__param_0: &'a crate::SomeClass) -> ::core::ffi::c_int {
Lukasz Anforowicz6216ea82022-08-31 09:31:59 -070099 unsafe { crate::detail::__rust_thunk___Z21multiple_declarationsRK9SomeClass(__param_0) }
100}
101
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -0700102// CRUBIT_RS_BINDINGS_FROM_CC_TEST_GOLDEN_FRIEND_FUNCTIONS_H_
103
104mod detail {
105 #[allow(unused_imports)]
106 use super::*;
107 extern "C" {
108 pub(crate) fn __rust_thunk___ZN9SomeClassC1Ev<'a>(
Googlerbed0a2a2023-03-01 11:53:43 -0800109 __this: &'a mut ::core::mem::MaybeUninit<crate::SomeClass>,
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -0700110 );
111 pub(crate) fn __rust_thunk___ZN9SomeClassC1EOS_<'a, 'b>(
Googlerbed0a2a2023-03-01 11:53:43 -0800112 __this: &'a mut ::core::mem::MaybeUninit<crate::SomeClass>,
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -0700113 __param_0: ::ctor::RvalueReference<'b, crate::SomeClass>,
114 );
Googler7341f5e2023-01-31 14:37:12 -0800115 pub(crate) fn __rust_thunk___ZN9SomeClassaSERKS_<'a, 'b>(
116 __this: &'a mut crate::SomeClass,
117 __param_0: &'b crate::SomeClass,
118 ) -> &'a mut crate::SomeClass;
119 pub(crate) fn __rust_thunk___ZN9SomeClassaSEOS_<'a, 'b>(
120 __this: &'a mut crate::SomeClass,
121 __param_0: ::ctor::RvalueReference<'b, crate::SomeClass>,
122 ) -> &'a mut crate::SomeClass;
Lukasz Anforowicz81b96872023-03-17 16:16:32 -0700123 pub(crate) fn __rust_thunk___Z11visible_val9SomeClass(__param_0: &mut crate::SomeClass);
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -0700124 #[link_name = "_Z11visible_refR9SomeClass"]
125 pub(crate) fn __rust_thunk___Z11visible_refR9SomeClass<'a>(
126 __param_0: &'a mut crate::SomeClass,
127 );
128 #[link_name = "_Z12visible_crefRK9SomeClass"]
129 pub(crate) fn __rust_thunk___Z12visible_crefRK9SomeClass<'a>(
130 __param_0: &'a crate::SomeClass,
131 );
132 #[link_name = "_Z12visible_rrefO9SomeClass"]
133 pub(crate) fn __rust_thunk___Z12visible_rrefO9SomeClass<'a>(
134 __param_0: ::ctor::RvalueReference<'a, crate::SomeClass>,
135 );
Lukasz Anforowicz6216ea82022-08-31 09:31:59 -0700136 pub(crate) fn __rust_thunk___Z21multiple_declarationsRK9SomeClass<'a>(
137 __param_0: &'a crate::SomeClass,
Lukasz Anforowicz460e4272023-05-18 16:11:46 -0700138 ) -> ::core::ffi::c_int;
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -0700139 }
140}
141
Googlerbed0a2a2023-03-01 11:53:43 -0800142const _: () = assert!(::core::mem::size_of::<Option<&i32>>() == ::core::mem::size_of::<&i32>());
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -0700143
Googlerbed0a2a2023-03-01 11:53:43 -0800144const _: () = assert!(::core::mem::size_of::<crate::SomeClass>() == 1);
145const _: () = assert!(::core::mem::align_of::<crate::SomeClass>() == 1);
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -0700146const _: () = {
Googler9e3ef6d2023-05-05 08:09:23 -0700147 static_assertions::assert_impl_all!(crate::SomeClass:Clone);
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -0700148};
149const _: () = {
Googler9e3ef6d2023-05-05 08:09:23 -0700150 static_assertions::assert_impl_all!(crate::SomeClass:Copy);
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -0700151};
152const _: () = {
Googler9e3ef6d2023-05-05 08:09:23 -0700153 static_assertions::assert_not_impl_any!(crate::SomeClass:Drop);
Michael VanBemmel7a4d4c02022-07-27 13:21:47 -0700154};