1 #include "utils/SystemClock.h"
2 #include <array>
3 #include <cstddef>
4 #include <cstdint>
5 #include <new>
6 #include <string>
7 #include <utility>
8 #include <vector>
9
10 namespace rust {
11 inline namespace cxxbridge1 {
12 // #include "rust/cxx.h"
13
14 struct unsafe_bitcopy_t;
15
16 #ifndef CXXBRIDGE1_RUST_STRING
17 #define CXXBRIDGE1_RUST_STRING
18 class String final {
19 public:
20 String() noexcept;
21 String(const String &) noexcept;
22 String(String &&) noexcept;
23 ~String() noexcept;
24
25 String(const std::string &);
26 String(const char *);
27 String(const char *, std::size_t);
28 String(const char16_t *);
29 String(const char16_t *, std::size_t);
30
31 static String lossy(const std::string &) noexcept;
32 static String lossy(const char *) noexcept;
33 static String lossy(const char *, std::size_t) noexcept;
34 static String lossy(const char16_t *) noexcept;
35 static String lossy(const char16_t *, std::size_t) noexcept;
36
37 String &operator=(const String &) &noexcept;
38 String &operator=(String &&) &noexcept;
39
40 explicit operator std::string() const;
41
42 const char *data() const noexcept;
43 std::size_t size() const noexcept;
44 std::size_t length() const noexcept;
45 bool empty() const noexcept;
46
47 const char *c_str() noexcept;
48
49 std::size_t capacity() const noexcept;
50 void reserve(size_t new_cap) noexcept;
51
52 using iterator = char *;
53 iterator begin() noexcept;
54 iterator end() noexcept;
55
56 using const_iterator = const char *;
57 const_iterator begin() const noexcept;
58 const_iterator end() const noexcept;
59 const_iterator cbegin() const noexcept;
60 const_iterator cend() const noexcept;
61
62 bool operator==(const String &) const noexcept;
63 bool operator!=(const String &) const noexcept;
64 bool operator<(const String &) const noexcept;
65 bool operator<=(const String &) const noexcept;
66 bool operator>(const String &) const noexcept;
67 bool operator>=(const String &) const noexcept;
68
69 void swap(String &) noexcept;
70
71 String(unsafe_bitcopy_t, const String &) noexcept;
72
73 private:
74 struct lossy_t;
75 String(lossy_t, const char *, std::size_t) noexcept;
76 String(lossy_t, const char16_t *, std::size_t) noexcept;
swap(String & lhs,String & rhs)77 friend void swap(String &lhs, String &rhs) noexcept { lhs.swap(rhs); }
78
79 std::array<std::uintptr_t, 3> repr;
80 };
81 #endif // CXXBRIDGE1_RUST_STRING
82
83 namespace detail {
84 template <typename T, typename = void *>
85 struct operator_new {
operator ()rust::cxxbridge1::detail::operator_new86 void *operator()(::std::size_t sz) { return ::operator new(sz); }
87 };
88
89 template <typename T>
90 struct operator_new<T, decltype(T::operator new(sizeof(T)))> {
operator ()rust::cxxbridge1::detail::operator_new91 void *operator()(::std::size_t sz) { return T::operator new(sz); }
92 };
93 } // namespace detail
94
95 template <typename T>
96 union MaybeUninit {
97 T value;
operator new(::std::size_t sz)98 void *operator new(::std::size_t sz) { return detail::operator_new<T>{}(sz); }
MaybeUninit()99 MaybeUninit() {}
~MaybeUninit()100 ~MaybeUninit() {}
101 };
102 } // namespace cxxbridge1
103 } // namespace rust
104
105 namespace android {
106 namespace debugstore {
107 extern "C" {
108 void android$debugstore$cxxbridge1$debug_store_to_string(::rust::String *return$) noexcept;
109
110 void android$debugstore$cxxbridge1$debug_store_record(::std::string const &name, ::std::vector<::std::string> const &data) noexcept;
111
112 ::std::uint64_t android$debugstore$cxxbridge1$debug_store_begin(::std::string const &name, ::std::vector<::std::string> const &data) noexcept;
113
114 void android$debugstore$cxxbridge1$debug_store_end(::std::uint64_t id, ::std::vector<::std::string> const &data) noexcept;
115 } // extern "C"
116 } // namespace debugstore
117
118 extern "C" {
android$cxxbridge1$uptimeMillis()119 ::std::int64_t android$cxxbridge1$uptimeMillis() noexcept {
120 ::std::int64_t (*uptimeMillis$)() = ::android::uptimeMillis;
121 return uptimeMillis$();
122 }
123 } // extern "C"
124
125 namespace debugstore {
debug_store_to_string()126 ::rust::String debug_store_to_string() noexcept {
127 ::rust::MaybeUninit<::rust::String> return$;
128 android$debugstore$cxxbridge1$debug_store_to_string(&return$.value);
129 return ::std::move(return$.value);
130 }
131
debug_store_record(::std::string const & name,::std::vector<::std::string> const & data)132 void debug_store_record(::std::string const &name, ::std::vector<::std::string> const &data) noexcept {
133 android$debugstore$cxxbridge1$debug_store_record(name, data);
134 }
135
debug_store_begin(::std::string const & name,::std::vector<::std::string> const & data)136 ::std::uint64_t debug_store_begin(::std::string const &name, ::std::vector<::std::string> const &data) noexcept {
137 return android$debugstore$cxxbridge1$debug_store_begin(name, data);
138 }
139
debug_store_end(::std::uint64_t id,::std::vector<::std::string> const & data)140 void debug_store_end(::std::uint64_t id, ::std::vector<::std::string> const &data) noexcept {
141 android$debugstore$cxxbridge1$debug_store_end(id, data);
142 }
143 } // namespace debugstore
144 } // namespace android
145