blob: 5666b797e9b2869c93e13e3f9af805981327a233 [file]
// Part of the Crubit project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// Automatically @generated Rust bindings for the following C++ target:
// //examples/cpp/virtual:example_lib
#![rustfmt::skip]
#![feature(cfi_encoding, custom_inner_attributes, impl_trait_in_assoc_type, negative_impls)]
#![allow(stable_features)]
#![allow(improper_ctypes)]
#![allow(nonstandard_style)]
#![allow(unused)]
#![allow(deprecated)]
#![allow(unknown_lints, suspicious_runtime_symbol_definitions)]
#![deny(warnings)]
#[::ctor::recursively_pinned(PinnedDrop)]
#[cfi_encoding = "11RustDerived"]
#[repr(C, align(8))]
///CRUBIT_ANNOTATE: cpp_type=RustDerived
///CRUBIT_ANNOTATE: cpp_move_constructible=
pub struct RustDerived {
__non_field_data: [::core::cell::Cell<::core::mem::MaybeUninit<u8>>; 8],
/// Reason for representing this field as a blob of bytes:
/// Types of non-public C++ fields can be elided away
pub(crate) rust_: [::core::cell::Cell<::core::mem::MaybeUninit<u8>>; 16],
}
impl !Send for RustDerived {}
impl !Sync for RustDerived {}
unsafe impl ::cxx::ExternType for RustDerived {
type Id = ::cxx::type_id!("RustDerived");
type Kind = ::cxx::kind::Opaque;
}
forward_declare::unsafe_define!(forward_declare::symbol!("RustDerived"), crate::RustDerived);
impl RustDerived {
#[inline(always)]
pub fn Method1<'__this>(&'__this self) -> ::ffi_11::c_int {
unsafe { self::rust_derived::Method1(self) }
}
#[inline(always)]
pub fn Upcast<'__this>(self: ::core::pin::Pin<&'__this mut Self>) -> *mut ::base::ExampleBase {
unsafe { self::rust_derived::Upcast(self) }
}
}
impl<'__unelided> ::ctor::CtorNew<::ctor::RvalueReference<'__unelided, Self>> for RustDerived {
type CtorType = ::ctor::Ctor![Self];
type Error = ::ctor::Infallible;
#[inline(always)]
fn ctor_new(args: ::ctor::RvalueReference<'__unelided, Self>) -> Self::CtorType {
unsafe {
::ctor::FnCtor::new(move |__crubit_dest: *mut Self| {
let mut __param_0 = args;
crate::detail::__rust_thunk___ZN11RustDerivedC1EOS_(
__crubit_dest as *mut ::core::ffi::c_void,
__param_0,
);
})
}
}
}
impl<'__unelided> ::ctor::CtorNew<(::ctor::RvalueReference<'__unelided, Self>,)> for RustDerived {
type CtorType = ::ctor::Ctor![Self];
type Error = ::ctor::Infallible;
#[inline(always)]
fn ctor_new(args: (::ctor::RvalueReference<'__unelided, Self>,)) -> Self::CtorType {
let (arg,) = args;
<Self as ::ctor::CtorNew<::ctor::RvalueReference<'__unelided, Self>>>::ctor_new(arg)
}
}
impl ::ctor::PinnedDrop for RustDerived {
#[inline(always)]
unsafe fn pinned_drop<'__this>(self: ::core::pin::Pin<&'__this mut Self>) {
unsafe { crate::detail::__rust_thunk___ZN11RustDerivedD1Ev(self) }
}
}
impl ::ctor::Assign<::ctor::RvalueReference<'_, Self>> for RustDerived {
#[inline(always)]
fn assign<'__this>(
self: ::core::pin::Pin<&'__this mut Self>,
__param_0: ::ctor::RvalueReference<'_, Self>,
) {
unsafe {
crate::detail::__rust_thunk___ZN11RustDerivedaSEOS_(self, __param_0);
}
}
}
impl ::ctor::CtorNew<::definition::RustDerived> for RustDerived {
type CtorType = ::ctor::Ctor![Self];
type Error = ::ctor::Infallible;
#[inline(always)]
fn ctor_new(args: ::definition::RustDerived) -> Self::CtorType {
unsafe {
::ctor::FnCtor::new(move |__crubit_dest: *mut Self| {
let mut rust = args;
let mut rust = ::core::mem::MaybeUninit::new(rust);
crate::detail::__rust_thunk___ZN11RustDerivedC1EN10definition11RustDerivedE(
__crubit_dest as *mut ::core::ffi::c_void,
rust.as_mut_ptr(),
);
})
}
}
}
impl ::ctor::CtorNew<(::definition::RustDerived,)> for RustDerived {
type CtorType = ::ctor::Ctor![Self];
type Error = ::ctor::Infallible;
#[inline(always)]
fn ctor_new(args: (::definition::RustDerived,)) -> Self::CtorType {
let (arg,) = args;
<Self as ::ctor::CtorNew<::definition::RustDerived>>::ctor_new(arg)
}
}
unsafe impl ::operator::Delete for crate::RustDerived {
#[inline(always)]
unsafe fn delete(p: *mut Self) {
unsafe {
crate::detail::__crubit_operator_delete__11RustDerived___2f_2fthird_5fparty_2fcrubit_2fexamples_2fcpp_2fvirtual_3aexample_5flib(p);
}
}
}
pub mod rust_derived {
#[inline(always)]
pub(crate) fn Method1<'__this>(__this: &'__this crate::RustDerived) -> ::ffi_11::c_int {
unsafe { crate::detail::__rust_thunk___ZNK11RustDerived7Method1Ev(__this) }
}
#[inline(always)]
pub(crate) fn Upcast<'__this>(
__this: ::core::pin::Pin<&'__this mut crate::RustDerived>,
) -> *mut ::base::ExampleBase {
unsafe { crate::detail::__rust_thunk___ZN11RustDerived6UpcastEv(__this) }
}
}
mod detail {
#[allow(unused_imports)]
use super::*;
unsafe extern "C" {
pub(crate) unsafe fn __rust_thunk___ZN11RustDerivedC1EOS_<'__unelided>(
__this: *mut ::core::ffi::c_void,
__param_0: ::ctor::RvalueReference<'__unelided, crate::RustDerived>,
);
pub(crate) unsafe fn __rust_thunk___ZN11RustDerivedD1Ev<'__this>(
__this: ::core::pin::Pin<&'__this mut crate::RustDerived>,
);
pub(crate) unsafe fn __rust_thunk___ZN11RustDerivedaSEOS_<'__this>(
__this: ::core::pin::Pin<&'__this mut crate::RustDerived>,
__param_0: ::ctor::RvalueReference<'_, crate::RustDerived>,
) -> ::core::pin::Pin<&'__this mut crate::RustDerived>;
pub(crate) unsafe fn __rust_thunk___ZN11RustDerivedC1EN10definition11RustDerivedE(
__this: *mut ::core::ffi::c_void,
rust: *mut ::definition::RustDerived,
);
pub(crate) unsafe fn __rust_thunk___ZNK11RustDerived7Method1Ev<'__this>(
__this: &'__this crate::RustDerived,
) -> ::ffi_11::c_int;
pub(crate) unsafe fn __rust_thunk___ZN11RustDerived6UpcastEv<'__this>(
__this: ::core::pin::Pin<&'__this mut crate::RustDerived>,
) -> *mut ::base::ExampleBase;
pub(crate) unsafe fn __crubit_operator_delete__11RustDerived___2f_2fthird_5fparty_2fcrubit_2fexamples_2fcpp_2fvirtual_3aexample_5flib(
ptr: *mut crate::RustDerived,
);
}
}
const _: () = {
assert!(::core::mem::size_of::<crate::RustDerived>() == 24);
assert!(::core::mem::align_of::<crate::RustDerived>() == 8);
static_assertions::assert_impl_all!(crate::RustDerived: Drop);
static_assertions::assert_not_impl_any!(crate::RustDerived: Copy);
assert!(::core::mem::offset_of!(crate::RustDerived, rust_) == 8);
};