-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathexample_generated.h
More file actions
131 lines (112 loc) · 4.95 KB
/
example_generated.h
File metadata and controls
131 lines (112 loc) · 4.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// 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 C++ bindings for the following Rust crate:
// example_crate_golden
// Features: supported
// clang-format off
#ifndef THIRD_PARTY_CRUBIT_EXAMPLES_RUST_ENUM_WITH_PAYLOAD_EXAMPLE_CRATE_GOLDEN
#define THIRD_PARTY_CRUBIT_EXAMPLES_RUST_ENUM_WITH_PAYLOAD_EXAMPLE_CRATE_GOLDEN
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
#pragma clang diagnostic ignored "-Wunused-private-field"
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#include "support/annotations_internal.h"
#include "support/internal/slot.h"
#include <array>
#include <cstddef>
#include <cstdint>
#include <type_traits>
#include <utility>
namespace example_crate {
// Generated from:
// examples/rust/enum_with_payload/example.rs;l=6
struct CRUBIT_INTERNAL_RUST_TYPE(":: example_crate_golden :: Color") alignas(1)
[[clang::trivial_abi]] Color final {
public:
// `example_crate_golden::Color` doesn't implement the `Default` trait
Color() = delete;
// A completely transparent color (no payload)
//
// Generated from:
// examples/rust/enum_with_payload/example.rs;l=8
static constexpr Color MakeTransparent();
// A grayscale value from 0 to 255
//
// Generated from:
// examples/rust/enum_with_payload/example.rs;l=10
static ::example_crate::Color MakeGrayscale(std::uint8_t __param_0);
// Red, Green, and Blue values from 0 to 255
//
// Generated from:
// examples/rust/enum_with_payload/example.rs;l=12
static ::example_crate::Color MakeRgb(std::uint8_t __param_0,
std::uint8_t __param_1,
std::uint8_t __param_2);
// No custom `Drop` impl and no custom "drop glue" required
~Color() = default;
Color(Color&&) = default;
::example_crate::Color& operator=(Color&&) = default;
// Rust types that are `Copy` get trivial, `default` C++ copy constructor and
// assignment operator.
Color(const Color&) = default;
::example_crate::Color& operator=(const Color&) = default;
Color(::crubit::UnsafeRelocateTag, Color&& value) {
memcpy(this, &value, sizeof(value));
}
private:
// Field type has been replaced with a blob of bytes: No support for bindings
// of individual non-repr(C) `enum`s
std::array<unsigned char, 4> __opaque_blob_of_bytes;
private:
struct PrivateBytesTag {};
constexpr Color(PrivateBytesTag, std::array<unsigned char, 4> bytes)
: __opaque_blob_of_bytes(bytes) {}
private:
static void __crubit_field_offset_assertions();
};
static_assert(
sizeof(Color) == 4,
"Verify that ADT layout didn't change since this header got generated");
static_assert(
alignof(Color) == 1,
"Verify that ADT layout didn't change since this header got generated");
// `static` constructor
inline constexpr Color Color::MakeTransparent() {
return Color(PrivateBytesTag{}, {0, 0, 0, 0});
}
namespace __crubit_internal {
extern "C" void __crubit_thunk_Grayscale(std::uint8_t,
::example_crate::Color* __ret_ptr);
}
inline ::example_crate::Color Color::MakeGrayscale(std::uint8_t __param_0) {
crubit::Slot<::example_crate::Color> __return_value_ret_val_holder;
auto* __return_value_storage = __return_value_ret_val_holder.Get();
__crubit_internal::__crubit_thunk_Grayscale(__param_0,
__return_value_storage);
return std::move(__return_value_ret_val_holder).AssumeInitAndTakeValue();
}
namespace __crubit_internal {
extern "C" void __crubit_thunk_Rgb(std::uint8_t, std::uint8_t, std::uint8_t,
::example_crate::Color* __ret_ptr);
}
inline ::example_crate::Color Color::MakeRgb(std::uint8_t __param_0,
std::uint8_t __param_1,
std::uint8_t __param_2) {
crubit::Slot<::example_crate::Color> __return_value_ret_val_holder;
auto* __return_value_storage = __return_value_ret_val_holder.Get();
__crubit_internal::__crubit_thunk_Rgb(__param_0, __param_1, __param_2,
__return_value_storage);
return std::move(__return_value_ret_val_holder).AssumeInitAndTakeValue();
}
static_assert(std::is_trivially_destructible_v<Color>);
static_assert(std::is_trivially_move_constructible_v<::example_crate::Color>);
static_assert(std::is_trivially_move_assignable_v<::example_crate::Color>);
static_assert(std::is_trivially_copy_constructible_v<::example_crate::Color>);
static_assert(std::is_trivially_copy_assignable_v<::example_crate::Color>);
inline void Color::__crubit_field_offset_assertions() {
static_assert(0 == offsetof(Color, __opaque_blob_of_bytes));
}
} // namespace example_crate
#pragma clang diagnostic pop
#endif // THIRD_PARTY_CRUBIT_EXAMPLES_RUST_ENUM_WITH_PAYLOAD_EXAMPLE_CRATE_GOLDEN