1 #pragma once 2 #include "utils/SystemClock.h" 3 #include <array> 4 #include <cstdint> 5 #include <string> 6 #include <vector> 7 8 namespace rust { 9 inline namespace cxxbridge1 { 10 // #include "rust/cxx.h" 11 12 struct unsafe_bitcopy_t; 13 14 #ifndef CXXBRIDGE1_RUST_STRING 15 #define CXXBRIDGE1_RUST_STRING 16 class String final { 17 public: 18 String() noexcept; 19 String(const String &) noexcept; 20 String(String &&) noexcept; 21 ~String() noexcept; 22 23 String(const std::string &); 24 String(const char *); 25 String(const char *, std::size_t); 26 String(const char16_t *); 27 String(const char16_t *, std::size_t); 28 29 static String lossy(const std::string &) noexcept; 30 static String lossy(const char *) noexcept; 31 static String lossy(const char *, std::size_t) noexcept; 32 static String lossy(const char16_t *) noexcept; 33 static String lossy(const char16_t *, std::size_t) noexcept; 34 35 String &operator=(const String &) &noexcept; 36 String &operator=(String &&) &noexcept; 37 38 explicit operator std::string() const; 39 40 const char *data() const noexcept; 41 std::size_t size() const noexcept; 42 std::size_t length() const noexcept; 43 bool empty() const noexcept; 44 45 const char *c_str() noexcept; 46 47 std::size_t capacity() const noexcept; 48 void reserve(size_t new_cap) noexcept; 49 50 using iterator = char *; 51 iterator begin() noexcept; 52 iterator end() noexcept; 53 54 using const_iterator = const char *; 55 const_iterator begin() const noexcept; 56 const_iterator end() const noexcept; 57 const_iterator cbegin() const noexcept; 58 const_iterator cend() const noexcept; 59 60 bool operator==(const String &) const noexcept; 61 bool operator!=(const String &) const noexcept; 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 67 void swap(String &) noexcept; 68 69 String(unsafe_bitcopy_t, const String &) noexcept; 70 71 private: 72 struct lossy_t; 73 String(lossy_t, const char *, std::size_t) noexcept; 74 String(lossy_t, const char16_t *, std::size_t) noexcept; swap(String & lhs,String & rhs)75 friend void swap(String &lhs, String &rhs) noexcept { lhs.swap(rhs); } 76 77 std::array<std::uintptr_t, 3> repr; 78 }; 79 #endif // CXXBRIDGE1_RUST_STRING 80 } // namespace cxxbridge1 81 } // namespace rust 82 83 namespace android { 84 namespace debugstore { 85 ::rust::String debug_store_to_string() noexcept; 86 87 void debug_store_record(::std::string const &name, ::std::vector<::std::string> const &data) noexcept; 88 89 ::std::uint64_t debug_store_begin(::std::string const &name, ::std::vector<::std::string> const &data) noexcept; 90 91 void debug_store_end(::std::uint64_t id, ::std::vector<::std::string> const &data) noexcept; 92 } // namespace debugstore 93 } // namespace android 94