1#include "base/rust.h"
2#include "engine/shared/uuid_manager.h"
3#include <cstddef>
4#include <cstdint>
5#include <memory>
6#include <new>
7#include <type_traits>
8#include <utility>
9
10#ifdef __GNUC__
11#pragma GCC diagnostic ignored "-Wmissing-declarations"
12#ifdef __clang__
13#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
14#endif // __clang__
15#endif // __GNUC__
16
17namespace rust {
18inline namespace cxxbridge1 {
19// #include "rust/cxx.h"
20
21#ifndef CXXBRIDGE1_IS_COMPLETE
22#define CXXBRIDGE1_IS_COMPLETE
23namespace detail {
24namespace {
25template <typename T, typename = std::size_t>
26struct is_complete : std::false_type {};
27template <typename T>
28struct is_complete<T, decltype(sizeof(T))> : std::true_type {};
29} // namespace
30} // namespace detail
31#endif // CXXBRIDGE1_IS_COMPLETE
32
33#ifndef CXXBRIDGE1_RELOCATABLE
34#define CXXBRIDGE1_RELOCATABLE
35namespace detail {
36template <typename... Ts>
37struct make_void {
38 using type = void;
39};
40
41template <typename... Ts>
42using void_t = typename make_void<Ts...>::type;
43
44template <typename Void, template <typename...> class, typename...>
45struct detect : std::false_type {};
46template <template <typename...> class T, typename... A>
47struct detect<void_t<T<A...>>, T, A...> : std::true_type {};
48
49template <template <typename...> class T, typename... A>
50using is_detected = detect<void, T, A...>;
51
52template <typename T>
53using detect_IsRelocatable = typename T::IsRelocatable;
54
55template <typename T>
56struct get_IsRelocatable
57 : std::is_same<typename T::IsRelocatable, std::true_type> {};
58} // namespace detail
59
60template <typename T>
61struct IsRelocatable
62 : std::conditional<
63 detail::is_detected<detail::detect_IsRelocatable, T>::value,
64 detail::get_IsRelocatable<T>,
65 std::integral_constant<
66 bool, std::is_trivially_move_constructible<T>::value &&
67 std::is_trivially_destructible<T>::value>>::type {};
68#endif // CXXBRIDGE1_RELOCATABLE
69
70namespace {
71template <bool> struct deleter_if {
72 template <typename T> void operator()(T *) {}
73};
74template <> struct deleter_if<true> {
75 template <typename T> void operator()(T *ptr) { ptr->~T(); }
76};
77} // namespace
78} // namespace cxxbridge1
79} // namespace rust
80
81using CUuidManager = ::CUuidManager;
82
83static_assert(
84 ::rust::IsRelocatable<::StrRef>::value,
85 "type StrRef should be trivially move constructible and trivially destructible in C++ to be used as an argument of `CalculateUuid`, `RegisterName` or return value of `GetName` in Rust");
86static_assert(
87 ::rust::IsRelocatable<::CUuid>::value,
88 "type CUuid should be trivially move constructible and trivially destructible in C++ to be used as an argument of `LookupUuid` or return value of `RandomUuid`, `CalculateUuid`, `GetUuid` in Rust");
89
90extern "C" {
91void cxxbridge1$194$RandomUuid(::CUuid *return$) noexcept {
92 ::CUuid (*RandomUuid$)() = ::RandomUuid;
93 new (return$) ::CUuid(RandomUuid$());
94}
95
96void cxxbridge1$194$CalculateUuid(::StrRef *name, ::CUuid *return$) noexcept {
97 ::CUuid (*CalculateUuid$)(::StrRef) = ::CalculateUuid;
98 new (return$) ::CUuid(CalculateUuid$(::std::move(*name)));
99}
100
101void cxxbridge1$194$CUuidManager$RegisterName(::CUuidManager &self, ::std::int32_t id, ::StrRef *name) noexcept {
102 void (::CUuidManager::*RegisterName$)(::std::int32_t, ::StrRef) = &::CUuidManager::RegisterName;
103 (self.*RegisterName$)(id, ::std::move(*name));
104}
105
106void cxxbridge1$194$CUuidManager$GetUuid(::CUuidManager const &self, ::std::int32_t id, ::CUuid *return$) noexcept {
107 ::CUuid (::CUuidManager::*GetUuid$)(::std::int32_t) const = &::CUuidManager::GetUuid;
108 new (return$) ::CUuid((self.*GetUuid$)(id));
109}
110
111void cxxbridge1$194$CUuidManager$GetName(::CUuidManager const &self, ::std::int32_t id, ::StrRef *return$) noexcept {
112 ::StrRef (::CUuidManager::*GetName$)(::std::int32_t) const = &::CUuidManager::GetName;
113 new (return$) ::StrRef((self.*GetName$)(id));
114}
115
116::std::int32_t cxxbridge1$194$CUuidManager$LookupUuid(::CUuidManager const &self, ::CUuid *uuid) noexcept {
117 ::std::int32_t (::CUuidManager::*LookupUuid$)(::CUuid) const = &::CUuidManager::LookupUuid;
118 return (self.*LookupUuid$)(::std::move(*uuid));
119}
120
121::std::int32_t cxxbridge1$194$CUuidManager$NumUuids(::CUuidManager const &self) noexcept {
122 ::std::int32_t (::CUuidManager::*NumUuids$)() const = &::CUuidManager::NumUuids;
123 return (self.*NumUuids$)();
124}
125
126void cxxbridge1$194$CUuidManager$DebugDump(::CUuidManager const &self) noexcept {
127 void (::CUuidManager::*DebugDump$)() const = &::CUuidManager::DebugDump;
128 (self.*DebugDump$)();
129}
130
131::CUuidManager *cxxbridge1$194$CUuidManager$New() noexcept {
132 ::std::unique_ptr<::CUuidManager> (*New$)() = &::CUuidManager::New;
133 return New$().release();
134}
135
136::CUuidManager const *cxxbridge1$194$CUuidManager$Global() noexcept {
137 ::CUuidManager const &(*Global$)() = &::CUuidManager::Global;
138 return &Global$();
139}
140
141static_assert(::rust::detail::is_complete<::std::remove_extent<::CUuidManager>::type>::value, "definition of `::CUuidManager` is required");
142static_assert(sizeof(::std::unique_ptr<::CUuidManager>) == sizeof(void *), "");
143static_assert(alignof(::std::unique_ptr<::CUuidManager>) == alignof(void *), "");
144void cxxbridge1$unique_ptr$CUuidManager$null(::std::unique_ptr<::CUuidManager> *ptr) noexcept {
145 ::new (ptr) ::std::unique_ptr<::CUuidManager>();
146}
147void cxxbridge1$unique_ptr$CUuidManager$raw(::std::unique_ptr<::CUuidManager> *ptr, ::std::unique_ptr<::CUuidManager>::pointer raw) noexcept {
148 ::new (ptr) ::std::unique_ptr<::CUuidManager>(raw);
149}
150::std::unique_ptr<::CUuidManager>::element_type const *cxxbridge1$unique_ptr$CUuidManager$get(::std::unique_ptr<::CUuidManager> const &ptr) noexcept {
151 return ptr.get();
152}
153::std::unique_ptr<::CUuidManager>::pointer cxxbridge1$unique_ptr$CUuidManager$release(::std::unique_ptr<::CUuidManager> &ptr) noexcept {
154 return ptr.release();
155}
156void cxxbridge1$unique_ptr$CUuidManager$drop(::std::unique_ptr<::CUuidManager> *ptr) noexcept {
157 ::rust::deleter_if<::rust::detail::is_complete<::CUuidManager>::value>{}(ptr);
158}
159} // extern "C"
160