Page MenuHomePhabricator

D5084.id16562.diff
No OneTemporary

D5084.id16562.diff

diff --git a/native/cpp/CommonCpp/grpc/grpc_client/cxx.h b/native/cpp/CommonCpp/grpc/grpc_client/cxx.h
new file mode 100644
--- /dev/null
+++ b/native/cpp/CommonCpp/grpc/grpc_client/cxx.h
@@ -0,0 +1,1047 @@
+// @generated
+#pragma once
+#include <algorithm>
+#include <array>
+#include <cassert>
+#include <cstddef>
+#include <cstdint>
+#include <exception>
+#include <initializer_list>
+#include <iosfwd>
+#include <iterator>
+#include <new>
+#include <stdexcept>
+#include <string>
+#include <type_traits>
+#include <utility>
+#include <vector>
+#if defined(_WIN32)
+#include <basetsd.h>
+#else
+#include <sys/types.h>
+#endif
+
+namespace rust {
+inline namespace cxxbridge1 {
+
+struct unsafe_bitcopy_t;
+
+namespace {
+template <typename T> class impl;
+}
+
+#ifndef CXXBRIDGE1_RUST_STRING
+#define CXXBRIDGE1_RUST_STRING
+// https://cxx.rs/binding/string.html
+class String final {
+public:
+ String() noexcept;
+ String(const String &) noexcept;
+ String(String &&) noexcept;
+ ~String() noexcept;
+
+ String(const std::string &);
+ String(const char *);
+ String(const char *, std::size_t);
+ String(const char16_t *);
+ String(const char16_t *, std::size_t);
+
+ // Replace invalid Unicode data with the replacement character (U+FFFD).
+ static String lossy(const std::string &) noexcept;
+ static String lossy(const char *) noexcept;
+ static String lossy(const char *, std::size_t) noexcept;
+ static String lossy(const char16_t *) noexcept;
+ static String lossy(const char16_t *, std::size_t) noexcept;
+
+ String &operator=(const String &) &noexcept;
+ String &operator=(String &&) &noexcept;
+
+ explicit operator std::string() const;
+
+ // Note: no null terminator.
+ const char *data() const noexcept;
+ std::size_t size() const noexcept;
+ std::size_t length() const noexcept;
+ bool empty() const noexcept;
+
+ const char *c_str() noexcept;
+
+ std::size_t capacity() const noexcept;
+ void reserve(size_t new_cap) noexcept;
+
+ using iterator = char *;
+ iterator begin() noexcept;
+ iterator end() noexcept;
+
+ using const_iterator = const char *;
+ const_iterator begin() const noexcept;
+ const_iterator end() const noexcept;
+ const_iterator cbegin() const noexcept;
+ const_iterator cend() const noexcept;
+
+ bool operator==(const String &) const noexcept;
+ bool operator!=(const String &) const noexcept;
+ bool operator<(const String &) const noexcept;
+ bool operator<=(const String &) const noexcept;
+ bool operator>(const String &) const noexcept;
+ bool operator>=(const String &) const noexcept;
+
+ void swap(String &) noexcept;
+
+ // Internal API only intended for the cxxbridge code generator.
+ String(unsafe_bitcopy_t, const String &) noexcept;
+
+private:
+ struct lossy_t;
+ String(lossy_t, const char *, std::size_t) noexcept;
+ String(lossy_t, const char16_t *, std::size_t) noexcept;
+ friend void swap(String &lhs, String &rhs) noexcept {
+ lhs.swap(rhs);
+ }
+
+ // Size and alignment statically verified by rust_string.rs.
+ std::array<std::uintptr_t, 3> repr;
+};
+#endif // CXXBRIDGE1_RUST_STRING
+
+#ifndef CXXBRIDGE1_RUST_STR
+#define CXXBRIDGE1_RUST_STR
+// https://cxx.rs/binding/str.html
+class Str final {
+public:
+ Str() noexcept;
+ Str(const String &) noexcept;
+ Str(const std::string &);
+ Str(const char *);
+ Str(const char *, std::size_t);
+
+ Str &operator=(const Str &) &noexcept = default;
+
+ explicit operator std::string() const;
+
+ // Note: no null terminator.
+ const char *data() const noexcept;
+ std::size_t size() const noexcept;
+ std::size_t length() const noexcept;
+ bool empty() const noexcept;
+
+ // Important in order for System V ABI to pass in registers.
+ Str(const Str &) noexcept = default;
+ ~Str() noexcept = default;
+
+ using iterator = const char *;
+ using const_iterator = const char *;
+ const_iterator begin() const noexcept;
+ const_iterator end() const noexcept;
+ const_iterator cbegin() const noexcept;
+ const_iterator cend() const noexcept;
+
+ bool operator==(const Str &) const noexcept;
+ bool operator!=(const Str &) const noexcept;
+ bool operator<(const Str &) const noexcept;
+ bool operator<=(const Str &) const noexcept;
+ bool operator>(const Str &) const noexcept;
+ bool operator>=(const Str &) const noexcept;
+
+ void swap(Str &) noexcept;
+
+private:
+ class uninit;
+ Str(uninit) noexcept;
+ friend impl<Str>;
+
+ std::array<std::uintptr_t, 2> repr;
+};
+#endif // CXXBRIDGE1_RUST_STR
+
+#ifndef CXXBRIDGE1_RUST_SLICE
+namespace detail {
+template <bool> struct copy_assignable_if {};
+
+template <> struct copy_assignable_if<false> {
+ copy_assignable_if() noexcept = default;
+ copy_assignable_if(const copy_assignable_if &) noexcept = default;
+ copy_assignable_if &operator=(const copy_assignable_if &) &noexcept = delete;
+ copy_assignable_if &operator=(copy_assignable_if &&) &noexcept = default;
+};
+} // namespace detail
+
+// https://cxx.rs/binding/slice.html
+template <typename T>
+class Slice final
+ : private detail::copy_assignable_if<std::is_const<T>::value> {
+public:
+ using value_type = T;
+
+ Slice() noexcept;
+ Slice(T *, std::size_t count) noexcept;
+
+ Slice &operator=(const Slice<T> &) &noexcept = default;
+ Slice &operator=(Slice<T> &&) &noexcept = default;
+
+ T *data() const noexcept;
+ std::size_t size() const noexcept;
+ std::size_t length() const noexcept;
+ bool empty() const noexcept;
+
+ T &operator[](std::size_t n) const noexcept;
+ T &at(std::size_t n) const;
+ T &front() const noexcept;
+ T &back() const noexcept;
+
+ // Important in order for System V ABI to pass in registers.
+ Slice(const Slice<T> &) noexcept = default;
+ ~Slice() noexcept = default;
+
+ class iterator;
+ iterator begin() const noexcept;
+ iterator end() const noexcept;
+
+ void swap(Slice &) noexcept;
+
+private:
+ class uninit;
+ Slice(uninit) noexcept;
+ friend impl<Slice>;
+ friend void sliceInit(void *, const void *, std::size_t) noexcept;
+ friend void *slicePtr(const void *) noexcept;
+ friend std::size_t sliceLen(const void *) noexcept;
+
+ std::array<std::uintptr_t, 2> repr;
+};
+
+template <typename T> class Slice<T>::iterator final {
+public:
+ using iterator_category = std::random_access_iterator_tag;
+ using value_type = T;
+ using difference_type = std::ptrdiff_t;
+ using pointer = typename std::add_pointer<T>::type;
+ using reference = typename std::add_lvalue_reference<T>::type;
+
+ reference operator*() const noexcept;
+ pointer operator->() const noexcept;
+ reference operator[](difference_type) const noexcept;
+
+ iterator &operator++() noexcept;
+ iterator operator++(int) noexcept;
+ iterator &operator--() noexcept;
+ iterator operator--(int) noexcept;
+
+ iterator &operator+=(difference_type) noexcept;
+ iterator &operator-=(difference_type) noexcept;
+ iterator operator+(difference_type) const noexcept;
+ iterator operator-(difference_type) const noexcept;
+ difference_type operator-(const iterator &) const noexcept;
+
+ bool operator==(const iterator &) const noexcept;
+ bool operator!=(const iterator &) const noexcept;
+ bool operator<(const iterator &) const noexcept;
+ bool operator<=(const iterator &) const noexcept;
+ bool operator>(const iterator &) const noexcept;
+ bool operator>=(const iterator &) const noexcept;
+
+private:
+ friend class Slice;
+ void *pos;
+ std::size_t stride;
+};
+#endif // CXXBRIDGE1_RUST_SLICE
+
+#ifndef CXXBRIDGE1_RUST_BOX
+// https://cxx.rs/binding/box.html
+template <typename T> class Box final {
+public:
+ using element_type = T;
+ using const_pointer =
+ typename std::add_pointer<typename std::add_const<T>::type>::type;
+ using pointer = typename std::add_pointer<T>::type;
+
+ Box() = delete;
+ Box(Box &&) noexcept;
+ ~Box() noexcept;
+
+ explicit Box(const T &);
+ explicit Box(T &&);
+
+ Box &operator=(Box &&) &noexcept;
+
+ const T *operator->() const noexcept;
+ const T &operator*() const noexcept;
+ T *operator->() noexcept;
+ T &operator*() noexcept;
+
+ template <typename... Fields> static Box in_place(Fields &&...);
+
+ void swap(Box &) noexcept;
+
+ // Important: requires that `raw` came from an into_raw call. Do not pass a
+ // pointer from `new` or any other source.
+ static Box from_raw(T *) noexcept;
+
+ T *into_raw() noexcept;
+
+ /* Deprecated */ using value_type = element_type;
+
+private:
+ class uninit;
+ class allocation;
+ Box(uninit) noexcept;
+ void drop() noexcept;
+
+ friend void swap(Box &lhs, Box &rhs) noexcept {
+ lhs.swap(rhs);
+ }
+
+ T *ptr;
+};
+#endif // CXXBRIDGE1_RUST_BOX
+
+#ifndef CXXBRIDGE1_RUST_VEC
+// https://cxx.rs/binding/vec.html
+template <typename T> class Vec final {
+public:
+ using value_type = T;
+
+ Vec() noexcept;
+ Vec(std::initializer_list<T>);
+ Vec(const Vec &);
+ Vec(Vec &&) noexcept;
+ ~Vec() noexcept;
+
+ Vec &operator=(Vec &&) &noexcept;
+ Vec &operator=(const Vec &) &;
+
+ std::size_t size() const noexcept;
+ bool empty() const noexcept;
+ const T *data() const noexcept;
+ T *data() noexcept;
+ std::size_t capacity() const noexcept;
+
+ const T &operator[](std::size_t n) const noexcept;
+ const T &at(std::size_t n) const;
+ const T &front() const noexcept;
+ const T &back() const noexcept;
+
+ T &operator[](std::size_t n) noexcept;
+ T &at(std::size_t n);
+ T &front() noexcept;
+ T &back() noexcept;
+
+ void reserve(std::size_t new_cap);
+ void push_back(const T &value);
+ void push_back(T &&value);
+ template <typename... Args> void emplace_back(Args &&...args);
+ void truncate(std::size_t len);
+ void clear();
+
+ using iterator = typename Slice<T>::iterator;
+ iterator begin() noexcept;
+ iterator end() noexcept;
+
+ using const_iterator = typename Slice<const T>::iterator;
+ const_iterator begin() const noexcept;
+ const_iterator end() const noexcept;
+ const_iterator cbegin() const noexcept;
+ const_iterator cend() const noexcept;
+
+ void swap(Vec &) noexcept;
+
+ // Internal API only intended for the cxxbridge code generator.
+ Vec(unsafe_bitcopy_t, const Vec &) noexcept;
+
+private:
+ void reserve_total(std::size_t new_cap) noexcept;
+ void set_len(std::size_t len) noexcept;
+ void drop() noexcept;
+
+ friend void swap(Vec &lhs, Vec &rhs) noexcept {
+ lhs.swap(rhs);
+ }
+
+ // Size and alignment statically verified by rust_vec.rs.
+ std::array<std::uintptr_t, 3> repr;
+};
+#endif // CXXBRIDGE1_RUST_VEC
+
+#ifndef CXXBRIDGE1_RUST_FN
+// https://cxx.rs/binding/fn.html
+template <typename Signature> class Fn;
+
+template <typename Ret, typename... Args> class Fn<Ret(Args...)> final {
+public:
+ Ret operator()(Args... args) const noexcept;
+ Fn operator*() const noexcept;
+
+private:
+ Ret (*trampoline)(Args..., void *fn) noexcept;
+ void *fn;
+};
+#endif // CXXBRIDGE1_RUST_FN
+
+#ifndef CXXBRIDGE1_RUST_ERROR
+#define CXXBRIDGE1_RUST_ERROR
+// https://cxx.rs/binding/result.html
+class Error final : public std::exception {
+public:
+ Error(const Error &);
+ Error(Error &&) noexcept;
+ ~Error() noexcept override;
+
+ Error &operator=(const Error &) &;
+ Error &operator=(Error &&) &noexcept;
+
+ const char *what() const noexcept override;
+
+private:
+ Error() noexcept = default;
+ friend impl<Error>;
+ const char *msg;
+ std::size_t len;
+};
+#endif // CXXBRIDGE1_RUST_ERROR
+
+#ifndef CXXBRIDGE1_RUST_ISIZE
+#define CXXBRIDGE1_RUST_ISIZE
+#if defined(_WIN32)
+using isize = SSIZE_T;
+#else
+using isize = ssize_t;
+#endif
+#endif // CXXBRIDGE1_RUST_ISIZE
+
+std::ostream &operator<<(std::ostream &, const String &);
+std::ostream &operator<<(std::ostream &, const Str &);
+
+#ifndef CXXBRIDGE1_RUST_OPAQUE
+#define CXXBRIDGE1_RUST_OPAQUE
+// Base class of generated opaque Rust types.
+class Opaque {
+public:
+ Opaque() = delete;
+ Opaque(const Opaque &) = delete;
+ ~Opaque() = delete;
+};
+#endif // CXXBRIDGE1_RUST_OPAQUE
+
+template <typename T> std::size_t size_of();
+template <typename T> std::size_t align_of();
+
+// IsRelocatable<T> is used in assertions that a C++ type passed by value
+// between Rust and C++ is soundly relocatable by Rust.
+//
+// There may be legitimate reasons to opt out of the check for support of types
+// that the programmer knows are soundly Rust-movable despite not being
+// recognized as such by the C++ type system due to a move constructor or
+// destructor. To opt out of the relocatability check, do either of the
+// following things in any header used by `include!` in the bridge.
+//
+// --- if you define the type:
+// struct MyType {
+// ...
+// + using IsRelocatable = std::true_type;
+// };
+//
+// --- otherwise:
+// + template <>
+// + struct rust::IsRelocatable<MyType> : std::true_type {};
+template <typename T> struct IsRelocatable;
+
+using u8 = std::uint8_t;
+using u16 = std::uint16_t;
+using u32 = std::uint32_t;
+using u64 = std::uint64_t;
+using usize = std::size_t; // see static asserts in cxx.cc
+using i8 = std::int8_t;
+using i16 = std::int16_t;
+using i32 = std::int32_t;
+using i64 = std::int64_t;
+using f32 = float;
+using f64 = double;
+
+// Snake case aliases for use in code that uses this style for type names.
+using string = String;
+using str = Str;
+template <typename T> using slice = Slice<T>;
+template <typename T> using box = Box<T>;
+template <typename T> using vec = Vec<T>;
+using error = Error;
+template <typename Signature> using fn = Fn<Signature>;
+template <typename T> using is_relocatable = IsRelocatable<T>;
+
+////////////////////////////////////////////////////////////////////////////////
+/// end public API, begin implementation details
+
+#ifndef CXXBRIDGE1_PANIC
+#define CXXBRIDGE1_PANIC
+template <typename Exception> void panic [[noreturn]] (const char *msg);
+#endif // CXXBRIDGE1_PANIC
+
+#ifndef CXXBRIDGE1_RUST_FN
+#define CXXBRIDGE1_RUST_FN
+template <typename Ret, typename... Args>
+Ret Fn<Ret(Args...)>::operator()(Args... args) const noexcept {
+ return (*this->trampoline)(std::forward<Args>(args)..., this->fn);
+}
+
+template <typename Ret, typename... Args>
+Fn<Ret(Args...)> Fn<Ret(Args...)>::operator*() const noexcept {
+ return *this;
+}
+#endif // CXXBRIDGE1_RUST_FN
+
+#ifndef CXXBRIDGE1_RUST_BITCOPY_T
+#define CXXBRIDGE1_RUST_BITCOPY_T
+struct unsafe_bitcopy_t final {
+ explicit unsafe_bitcopy_t() = default;
+};
+#endif // CXXBRIDGE1_RUST_BITCOPY_T
+
+#ifndef CXXBRIDGE1_RUST_BITCOPY
+#define CXXBRIDGE1_RUST_BITCOPY
+constexpr unsafe_bitcopy_t unsafe_bitcopy{};
+#endif // CXXBRIDGE1_RUST_BITCOPY
+
+#ifndef CXXBRIDGE1_RUST_SLICE
+#define CXXBRIDGE1_RUST_SLICE
+template <typename T> Slice<T>::Slice() noexcept {
+ sliceInit(this, reinterpret_cast<void *>(align_of<T>()), 0);
+}
+
+template <typename T> Slice<T>::Slice(T *s, std::size_t count) noexcept {
+ assert(s != nullptr || count == 0);
+ sliceInit(
+ this,
+ s == nullptr && count == 0
+ ? reinterpret_cast<void *>(align_of<T>())
+ : const_cast<typename std::remove_const<T>::type *>(s),
+ count);
+}
+
+template <typename T> T *Slice<T>::data() const noexcept {
+ return reinterpret_cast<T *>(slicePtr(this));
+}
+
+template <typename T> std::size_t Slice<T>::size() const noexcept {
+ return sliceLen(this);
+}
+
+template <typename T> std::size_t Slice<T>::length() const noexcept {
+ return this->size();
+}
+
+template <typename T> bool Slice<T>::empty() const noexcept {
+ return this->size() == 0;
+}
+
+template <typename T> T &Slice<T>::operator[](std::size_t n) const noexcept {
+ assert(n < this->size());
+ auto ptr = static_cast<char *>(slicePtr(this)) + size_of<T>() * n;
+ return *reinterpret_cast<T *>(ptr);
+}
+
+template <typename T> T &Slice<T>::at(std::size_t n) const {
+ if (n >= this->size()) {
+ panic<std::out_of_range>("rust::Slice index out of range");
+ }
+ return (*this)[n];
+}
+
+template <typename T> T &Slice<T>::front() const noexcept {
+ assert(!this->empty());
+ return (*this)[0];
+}
+
+template <typename T> T &Slice<T>::back() const noexcept {
+ assert(!this->empty());
+ return (*this)[this->size() - 1];
+}
+
+template <typename T>
+typename Slice<T>::iterator::reference
+Slice<T>::iterator::operator*() const noexcept {
+ return *static_cast<T *>(this->pos);
+}
+
+template <typename T>
+typename Slice<T>::iterator::pointer
+Slice<T>::iterator::operator->() const noexcept {
+ return static_cast<T *>(this->pos);
+}
+
+template <typename T>
+typename Slice<T>::iterator::reference Slice<T>::iterator::operator[](
+ typename Slice<T>::iterator::difference_type n) const noexcept {
+ auto ptr = static_cast<char *>(this->pos) + this->stride * n;
+ return *reinterpret_cast<T *>(ptr);
+}
+
+template <typename T>
+typename Slice<T>::iterator &Slice<T>::iterator::operator++() noexcept {
+ this->pos = static_cast<char *>(this->pos) + this->stride;
+ return *this;
+}
+
+template <typename T>
+typename Slice<T>::iterator Slice<T>::iterator::operator++(int) noexcept {
+ auto ret = iterator(*this);
+ this->pos = static_cast<char *>(this->pos) + this->stride;
+ return ret;
+}
+
+template <typename T>
+typename Slice<T>::iterator &Slice<T>::iterator::operator--() noexcept {
+ this->pos = static_cast<char *>(this->pos) - this->stride;
+ return *this;
+}
+
+template <typename T>
+typename Slice<T>::iterator Slice<T>::iterator::operator--(int) noexcept {
+ auto ret = iterator(*this);
+ this->pos = static_cast<char *>(this->pos) - this->stride;
+ return ret;
+}
+
+template <typename T>
+typename Slice<T>::iterator &Slice<T>::iterator::operator+=(
+ typename Slice<T>::iterator::difference_type n) noexcept {
+ this->pos = static_cast<char *>(this->pos) + this->stride * n;
+ return *this;
+}
+
+template <typename T>
+typename Slice<T>::iterator &Slice<T>::iterator::operator-=(
+ typename Slice<T>::iterator::difference_type n) noexcept {
+ this->pos = static_cast<char *>(this->pos) - this->stride * n;
+ return *this;
+}
+
+template <typename T>
+typename Slice<T>::iterator Slice<T>::iterator::operator+(
+ typename Slice<T>::iterator::difference_type n) const noexcept {
+ auto ret = iterator(*this);
+ ret.pos = static_cast<char *>(this->pos) + this->stride * n;
+ return ret;
+}
+
+template <typename T>
+typename Slice<T>::iterator Slice<T>::iterator::operator-(
+ typename Slice<T>::iterator::difference_type n) const noexcept {
+ auto ret = iterator(*this);
+ ret.pos = static_cast<char *>(this->pos) - this->stride * n;
+ return ret;
+}
+
+template <typename T>
+typename Slice<T>::iterator::difference_type
+Slice<T>::iterator::operator-(const iterator &other) const noexcept {
+ auto diff = std::distance(
+ static_cast<char *>(other.pos), static_cast<char *>(this->pos));
+ return diff / this->stride;
+}
+
+template <typename T>
+bool Slice<T>::iterator::operator==(const iterator &other) const noexcept {
+ return this->pos == other.pos;
+}
+
+template <typename T>
+bool Slice<T>::iterator::operator!=(const iterator &other) const noexcept {
+ return this->pos != other.pos;
+}
+
+template <typename T>
+bool Slice<T>::iterator::operator<(const iterator &other) const noexcept {
+ return this->pos < other.pos;
+}
+
+template <typename T>
+bool Slice<T>::iterator::operator<=(const iterator &other) const noexcept {
+ return this->pos <= other.pos;
+}
+
+template <typename T>
+bool Slice<T>::iterator::operator>(const iterator &other) const noexcept {
+ return this->pos > other.pos;
+}
+
+template <typename T>
+bool Slice<T>::iterator::operator>=(const iterator &other) const noexcept {
+ return this->pos >= other.pos;
+}
+
+template <typename T>
+typename Slice<T>::iterator Slice<T>::begin() const noexcept {
+ iterator it;
+ it.pos = slicePtr(this);
+ it.stride = size_of<T>();
+ return it;
+}
+
+template <typename T>
+typename Slice<T>::iterator Slice<T>::end() const noexcept {
+ iterator it = this->begin();
+ it.pos = static_cast<char *>(it.pos) + it.stride * this->size();
+ return it;
+}
+
+template <typename T> void Slice<T>::swap(Slice &rhs) noexcept {
+ std::swap(*this, rhs);
+}
+#endif // CXXBRIDGE1_RUST_SLICE
+
+#ifndef CXXBRIDGE1_RUST_BOX
+#define CXXBRIDGE1_RUST_BOX
+template <typename T> class Box<T>::uninit {};
+
+template <typename T> class Box<T>::allocation {
+ static T *alloc() noexcept;
+ static void dealloc(T *) noexcept;
+
+public:
+ allocation() noexcept : ptr(alloc()) {
+ }
+ ~allocation() noexcept {
+ if (this->ptr) {
+ dealloc(this->ptr);
+ }
+ }
+ T *ptr;
+};
+
+template <typename T> Box<T>::Box(Box &&other) noexcept : ptr(other.ptr) {
+ other.ptr = nullptr;
+}
+
+template <typename T> Box<T>::Box(const T &val) {
+ allocation alloc;
+ ::new (alloc.ptr) T(val);
+ this->ptr = alloc.ptr;
+ alloc.ptr = nullptr;
+}
+
+template <typename T> Box<T>::Box(T &&val) {
+ allocation alloc;
+ ::new (alloc.ptr) T(std::move(val));
+ this->ptr = alloc.ptr;
+ alloc.ptr = nullptr;
+}
+
+template <typename T> Box<T>::~Box() noexcept {
+ if (this->ptr) {
+ this->drop();
+ }
+}
+
+template <typename T> Box<T> &Box<T>::operator=(Box &&other) &noexcept {
+ if (this->ptr) {
+ this->drop();
+ }
+ this->ptr = other.ptr;
+ other.ptr = nullptr;
+ return *this;
+}
+
+template <typename T> const T *Box<T>::operator->() const noexcept {
+ return this->ptr;
+}
+
+template <typename T> const T &Box<T>::operator*() const noexcept {
+ return *this->ptr;
+}
+
+template <typename T> T *Box<T>::operator->() noexcept {
+ return this->ptr;
+}
+
+template <typename T> T &Box<T>::operator*() noexcept {
+ return *this->ptr;
+}
+
+template <typename T>
+template <typename... Fields>
+Box<T> Box<T>::in_place(Fields &&...fields) {
+ allocation alloc;
+ auto ptr = alloc.ptr;
+ ::new (ptr) T{std::forward<Fields>(fields)...};
+ alloc.ptr = nullptr;
+ return from_raw(ptr);
+}
+
+template <typename T> void Box<T>::swap(Box &rhs) noexcept {
+ using std::swap;
+ swap(this->ptr, rhs.ptr);
+}
+
+template <typename T> Box<T> Box<T>::from_raw(T *raw) noexcept {
+ Box box = uninit{};
+ box.ptr = raw;
+ return box;
+}
+
+template <typename T> T *Box<T>::into_raw() noexcept {
+ T *raw = this->ptr;
+ this->ptr = nullptr;
+ return raw;
+}
+
+template <typename T> Box<T>::Box(uninit) noexcept {
+}
+#endif // CXXBRIDGE1_RUST_BOX
+
+#ifndef CXXBRIDGE1_RUST_VEC
+#define CXXBRIDGE1_RUST_VEC
+template <typename T> Vec<T>::Vec(std::initializer_list<T> init) : Vec{} {
+ this->reserve_total(init.size());
+ std::move(init.begin(), init.end(), std::back_inserter(*this));
+}
+
+template <typename T> Vec<T>::Vec(const Vec &other) : Vec() {
+ this->reserve_total(other.size());
+ std::copy(other.begin(), other.end(), std::back_inserter(*this));
+}
+
+template <typename T> Vec<T>::Vec(Vec &&other) noexcept : repr(other.repr) {
+ new (&other) Vec();
+}
+
+template <typename T> Vec<T>::~Vec() noexcept {
+ this->drop();
+}
+
+template <typename T> Vec<T> &Vec<T>::operator=(Vec &&other) &noexcept {
+ this->drop();
+ this->repr = other.repr;
+ new (&other) Vec();
+ return *this;
+}
+
+template <typename T> Vec<T> &Vec<T>::operator=(const Vec &other) & {
+ if (this != &other) {
+ this->drop();
+ new (this) Vec(other);
+ }
+ return *this;
+}
+
+template <typename T> bool Vec<T>::empty() const noexcept {
+ return this->size() == 0;
+}
+
+template <typename T> T *Vec<T>::data() noexcept {
+ return const_cast<T *>(const_cast<const Vec<T> *>(this)->data());
+}
+
+template <typename T>
+const T &Vec<T>::operator[](std::size_t n) const noexcept {
+ assert(n < this->size());
+ auto data = reinterpret_cast<const char *>(this->data());
+ return *reinterpret_cast<const T *>(data + n * size_of<T>());
+}
+
+template <typename T> const T &Vec<T>::at(std::size_t n) const {
+ if (n >= this->size()) {
+ panic<std::out_of_range>("rust::Vec index out of range");
+ }
+ return (*this)[n];
+}
+
+template <typename T> const T &Vec<T>::front() const noexcept {
+ assert(!this->empty());
+ return (*this)[0];
+}
+
+template <typename T> const T &Vec<T>::back() const noexcept {
+ assert(!this->empty());
+ return (*this)[this->size() - 1];
+}
+
+template <typename T> T &Vec<T>::operator[](std::size_t n) noexcept {
+ assert(n < this->size());
+ auto data = reinterpret_cast<char *>(this->data());
+ return *reinterpret_cast<T *>(data + n * size_of<T>());
+}
+
+template <typename T> T &Vec<T>::at(std::size_t n) {
+ if (n >= this->size()) {
+ panic<std::out_of_range>("rust::Vec index out of range");
+ }
+ return (*this)[n];
+}
+
+template <typename T> T &Vec<T>::front() noexcept {
+ assert(!this->empty());
+ return (*this)[0];
+}
+
+template <typename T> T &Vec<T>::back() noexcept {
+ assert(!this->empty());
+ return (*this)[this->size() - 1];
+}
+
+template <typename T> void Vec<T>::reserve(std::size_t new_cap) {
+ this->reserve_total(new_cap);
+}
+
+template <typename T> void Vec<T>::push_back(const T &value) {
+ this->emplace_back(value);
+}
+
+template <typename T> void Vec<T>::push_back(T &&value) {
+ this->emplace_back(std::move(value));
+}
+
+template <typename T>
+template <typename... Args>
+void Vec<T>::emplace_back(Args &&...args) {
+ auto size = this->size();
+ this->reserve_total(size + 1);
+ ::new (reinterpret_cast<T *>(
+ reinterpret_cast<char *>(this->data()) + size * size_of<T>()))
+ T(std::forward<Args>(args)...);
+ this->set_len(size + 1);
+}
+
+template <typename T> void Vec<T>::clear() {
+ this->truncate(0);
+}
+
+template <typename T> typename Vec<T>::iterator Vec<T>::begin() noexcept {
+ return Slice<T>(this->data(), this->size()).begin();
+}
+
+template <typename T> typename Vec<T>::iterator Vec<T>::end() noexcept {
+ return Slice<T>(this->data(), this->size()).end();
+}
+
+template <typename T>
+typename Vec<T>::const_iterator Vec<T>::begin() const noexcept {
+ return this->cbegin();
+}
+
+template <typename T>
+typename Vec<T>::const_iterator Vec<T>::end() const noexcept {
+ return this->cend();
+}
+
+template <typename T>
+typename Vec<T>::const_iterator Vec<T>::cbegin() const noexcept {
+ return Slice<const T>(this->data(), this->size()).begin();
+}
+
+template <typename T>
+typename Vec<T>::const_iterator Vec<T>::cend() const noexcept {
+ return Slice<const T>(this->data(), this->size()).end();
+}
+
+template <typename T> void Vec<T>::swap(Vec &rhs) noexcept {
+ using std::swap;
+ swap(this->repr, rhs.repr);
+}
+
+// Internal API only intended for the cxxbridge code generator.
+template <typename T>
+Vec<T>::Vec(unsafe_bitcopy_t, const Vec &bits) noexcept : repr(bits.repr) {
+}
+#endif // CXXBRIDGE1_RUST_VEC
+
+#ifndef CXXBRIDGE1_IS_COMPLETE
+#define CXXBRIDGE1_IS_COMPLETE
+namespace detail {
+namespace {
+template <typename T, typename = std::size_t>
+struct is_complete : std::false_type {};
+template <typename T>
+struct is_complete<T, decltype(sizeof(T))> : std::true_type {};
+} // namespace
+} // namespace detail
+#endif // CXXBRIDGE1_IS_COMPLETE
+
+#ifndef CXXBRIDGE1_LAYOUT
+#define CXXBRIDGE1_LAYOUT
+class layout {
+ template <typename T> friend std::size_t size_of();
+ template <typename T> friend std::size_t align_of();
+ template <typename T>
+ static typename std::
+ enable_if<std::is_base_of<Opaque, T>::value, std::size_t>::type
+ do_size_of() {
+ return T::layout::size();
+ }
+ template <typename T>
+ static typename std::
+ enable_if<!std::is_base_of<Opaque, T>::value, std::size_t>::type
+ do_size_of() {
+ return sizeof(T);
+ }
+ template <typename T>
+ static
+ typename std::enable_if<detail::is_complete<T>::value, std::size_t>::type
+ size_of() {
+ return do_size_of<T>();
+ }
+ template <typename T>
+ static typename std::
+ enable_if<std::is_base_of<Opaque, T>::value, std::size_t>::type
+ do_align_of() {
+ return T::layout::align();
+ }
+ template <typename T>
+ static typename std::
+ enable_if<!std::is_base_of<Opaque, T>::value, std::size_t>::type
+ do_align_of() {
+ return alignof(T);
+ }
+ template <typename T>
+ static
+ typename std::enable_if<detail::is_complete<T>::value, std::size_t>::type
+ align_of() {
+ return do_align_of<T>();
+ }
+};
+
+template <typename T> std::size_t size_of() {
+ return layout::size_of<T>();
+}
+
+template <typename T> std::size_t align_of() {
+ return layout::align_of<T>();
+}
+#endif // CXXBRIDGE1_LAYOUT
+
+#ifndef CXXBRIDGE1_RELOCATABLE
+#define CXXBRIDGE1_RELOCATABLE
+namespace detail {
+template <typename... Ts> struct make_void {
+ using type = void;
+};
+
+template <typename... Ts> using void_t = typename make_void<Ts...>::type;
+
+template <typename Void, template <typename...> class, typename...>
+struct detect : std::false_type {};
+template <template <typename...> class T, typename... A>
+struct detect<void_t<T<A...>>, T, A...> : std::true_type {};
+
+template <template <typename...> class T, typename... A>
+using is_detected = detect<void, T, A...>;
+
+template <typename T> using detect_IsRelocatable = typename T::IsRelocatable;
+
+template <typename T>
+struct get_IsRelocatable
+ : std::is_same<typename T::IsRelocatable, std::true_type> {};
+} // namespace detail
+
+template <typename T>
+struct IsRelocatable
+ : std::conditional<
+ detail::is_detected<detail::detect_IsRelocatable, T>::value,
+ detail::get_IsRelocatable<T>,
+ std::integral_constant<
+ bool,
+ std::is_trivially_move_constructible<T>::value &&
+ std::is_trivially_destructible<T>::value>>::type {};
+#endif // CXXBRIDGE1_RELOCATABLE
+
+} // namespace cxxbridge1
+} // namespace rust
diff --git a/native/cpp/CommonCpp/grpc/grpc_client/lib.rs.h b/native/cpp/CommonCpp/grpc/grpc_client/lib.rs.h
new file mode 100644
--- /dev/null
+++ b/native/cpp/CommonCpp/grpc/grpc_client/lib.rs.h
@@ -0,0 +1,876 @@
+// @generated
+#pragma once
+#include <algorithm>
+#include <array>
+#include <cassert>
+#include <cstddef>
+#include <cstdint>
+#include <initializer_list>
+#include <iterator>
+#include <new>
+#include <stdexcept>
+#include <string>
+#include <type_traits>
+#include <utility>
+
+namespace rust {
+inline namespace cxxbridge1 {
+// #include "rust/cxx.h"
+
+#ifndef CXXBRIDGE1_PANIC
+#define CXXBRIDGE1_PANIC
+template <typename Exception> void panic [[noreturn]] (const char *msg);
+#endif // CXXBRIDGE1_PANIC
+
+struct unsafe_bitcopy_t;
+
+namespace {
+template <typename T> class impl;
+} // namespace
+
+template <typename T>::std::size_t size_of();
+template <typename T>::std::size_t align_of();
+
+#ifndef CXXBRIDGE1_RUST_STRING
+#define CXXBRIDGE1_RUST_STRING
+class String final {
+public:
+ String() noexcept;
+ String(const String &) noexcept;
+ String(String &&) noexcept;
+ ~String() noexcept;
+
+ String(const std::string &);
+ String(const char *);
+ String(const char *, std::size_t);
+ String(const char16_t *);
+ String(const char16_t *, std::size_t);
+
+ static String lossy(const std::string &) noexcept;
+ static String lossy(const char *) noexcept;
+ static String lossy(const char *, std::size_t) noexcept;
+ static String lossy(const char16_t *) noexcept;
+ static String lossy(const char16_t *, std::size_t) noexcept;
+
+ String &operator=(const String &) &noexcept;
+ String &operator=(String &&) &noexcept;
+
+ explicit operator std::string() const;
+
+ const char *data() const noexcept;
+ std::size_t size() const noexcept;
+ std::size_t length() const noexcept;
+ bool empty() const noexcept;
+
+ const char *c_str() noexcept;
+
+ std::size_t capacity() const noexcept;
+ void reserve(size_t new_cap) noexcept;
+
+ using iterator = char *;
+ iterator begin() noexcept;
+ iterator end() noexcept;
+
+ using const_iterator = const char *;
+ const_iterator begin() const noexcept;
+ const_iterator end() const noexcept;
+ const_iterator cbegin() const noexcept;
+ const_iterator cend() const noexcept;
+
+ bool operator==(const String &) const noexcept;
+ bool operator!=(const String &) const noexcept;
+ bool operator<(const String &) const noexcept;
+ bool operator<=(const String &) const noexcept;
+ bool operator>(const String &) const noexcept;
+ bool operator>=(const String &) const noexcept;
+
+ void swap(String &) noexcept;
+
+ String(unsafe_bitcopy_t, const String &) noexcept;
+
+private:
+ struct lossy_t;
+ String(lossy_t, const char *, std::size_t) noexcept;
+ String(lossy_t, const char16_t *, std::size_t) noexcept;
+ friend void swap(String &lhs, String &rhs) noexcept {
+ lhs.swap(rhs);
+ }
+
+ std::array<std::uintptr_t, 3> repr;
+};
+#endif // CXXBRIDGE1_RUST_STRING
+
+#ifndef CXXBRIDGE1_RUST_SLICE
+#define CXXBRIDGE1_RUST_SLICE
+namespace detail {
+template <bool> struct copy_assignable_if {};
+
+template <> struct copy_assignable_if<false> {
+ copy_assignable_if() noexcept = default;
+ copy_assignable_if(const copy_assignable_if &) noexcept = default;
+ copy_assignable_if &operator=(const copy_assignable_if &) &noexcept = delete;
+ copy_assignable_if &operator=(copy_assignable_if &&) &noexcept = default;
+};
+} // namespace detail
+
+template <typename T>
+class Slice final
+ : private detail::copy_assignable_if<std::is_const<T>::value> {
+public:
+ using value_type = T;
+
+ Slice() noexcept;
+ Slice(T *, std::size_t count) noexcept;
+
+ Slice &operator=(const Slice<T> &) &noexcept = default;
+ Slice &operator=(Slice<T> &&) &noexcept = default;
+
+ T *data() const noexcept;
+ std::size_t size() const noexcept;
+ std::size_t length() const noexcept;
+ bool empty() const noexcept;
+
+ T &operator[](std::size_t n) const noexcept;
+ T &at(std::size_t n) const;
+ T &front() const noexcept;
+ T &back() const noexcept;
+
+ Slice(const Slice<T> &) noexcept = default;
+ ~Slice() noexcept = default;
+
+ class iterator;
+ iterator begin() const noexcept;
+ iterator end() const noexcept;
+
+ void swap(Slice &) noexcept;
+
+private:
+ class uninit;
+ Slice(uninit) noexcept;
+ friend impl<Slice>;
+ friend void sliceInit(void *, const void *, std::size_t) noexcept;
+ friend void *slicePtr(const void *) noexcept;
+ friend std::size_t sliceLen(const void *) noexcept;
+
+ std::array<std::uintptr_t, 2> repr;
+};
+
+template <typename T> class Slice<T>::iterator final {
+public:
+ using iterator_category = std::random_access_iterator_tag;
+ using value_type = T;
+ using difference_type = std::ptrdiff_t;
+ using pointer = typename std::add_pointer<T>::type;
+ using reference = typename std::add_lvalue_reference<T>::type;
+
+ reference operator*() const noexcept;
+ pointer operator->() const noexcept;
+ reference operator[](difference_type) const noexcept;
+
+ iterator &operator++() noexcept;
+ iterator operator++(int) noexcept;
+ iterator &operator--() noexcept;
+ iterator operator--(int) noexcept;
+
+ iterator &operator+=(difference_type) noexcept;
+ iterator &operator-=(difference_type) noexcept;
+ iterator operator+(difference_type) const noexcept;
+ iterator operator-(difference_type) const noexcept;
+ difference_type operator-(const iterator &) const noexcept;
+
+ bool operator==(const iterator &) const noexcept;
+ bool operator!=(const iterator &) const noexcept;
+ bool operator<(const iterator &) const noexcept;
+ bool operator<=(const iterator &) const noexcept;
+ bool operator>(const iterator &) const noexcept;
+ bool operator>=(const iterator &) const noexcept;
+
+private:
+ friend class Slice;
+ void *pos;
+ std::size_t stride;
+};
+
+template <typename T> Slice<T>::Slice() noexcept {
+ sliceInit(this, reinterpret_cast<void *>(align_of<T>()), 0);
+}
+
+template <typename T> Slice<T>::Slice(T *s, std::size_t count) noexcept {
+ assert(s != nullptr || count == 0);
+ sliceInit(
+ this,
+ s == nullptr && count == 0
+ ? reinterpret_cast<void *>(align_of<T>())
+ : const_cast<typename std::remove_const<T>::type *>(s),
+ count);
+}
+
+template <typename T> T *Slice<T>::data() const noexcept {
+ return reinterpret_cast<T *>(slicePtr(this));
+}
+
+template <typename T> std::size_t Slice<T>::size() const noexcept {
+ return sliceLen(this);
+}
+
+template <typename T> std::size_t Slice<T>::length() const noexcept {
+ return this->size();
+}
+
+template <typename T> bool Slice<T>::empty() const noexcept {
+ return this->size() == 0;
+}
+
+template <typename T> T &Slice<T>::operator[](std::size_t n) const noexcept {
+ assert(n < this->size());
+ auto ptr = static_cast<char *>(slicePtr(this)) + size_of<T>() * n;
+ return *reinterpret_cast<T *>(ptr);
+}
+
+template <typename T> T &Slice<T>::at(std::size_t n) const {
+ if (n >= this->size()) {
+ panic<std::out_of_range>("rust::Slice index out of range");
+ }
+ return (*this)[n];
+}
+
+template <typename T> T &Slice<T>::front() const noexcept {
+ assert(!this->empty());
+ return (*this)[0];
+}
+
+template <typename T> T &Slice<T>::back() const noexcept {
+ assert(!this->empty());
+ return (*this)[this->size() - 1];
+}
+
+template <typename T>
+typename Slice<T>::iterator::reference
+Slice<T>::iterator::operator*() const noexcept {
+ return *static_cast<T *>(this->pos);
+}
+
+template <typename T>
+typename Slice<T>::iterator::pointer
+Slice<T>::iterator::operator->() const noexcept {
+ return static_cast<T *>(this->pos);
+}
+
+template <typename T>
+typename Slice<T>::iterator::reference Slice<T>::iterator::operator[](
+ typename Slice<T>::iterator::difference_type n) const noexcept {
+ auto ptr = static_cast<char *>(this->pos) + this->stride * n;
+ return *reinterpret_cast<T *>(ptr);
+}
+
+template <typename T>
+typename Slice<T>::iterator &Slice<T>::iterator::operator++() noexcept {
+ this->pos = static_cast<char *>(this->pos) + this->stride;
+ return *this;
+}
+
+template <typename T>
+typename Slice<T>::iterator Slice<T>::iterator::operator++(int) noexcept {
+ auto ret = iterator(*this);
+ this->pos = static_cast<char *>(this->pos) + this->stride;
+ return ret;
+}
+
+template <typename T>
+typename Slice<T>::iterator &Slice<T>::iterator::operator--() noexcept {
+ this->pos = static_cast<char *>(this->pos) - this->stride;
+ return *this;
+}
+
+template <typename T>
+typename Slice<T>::iterator Slice<T>::iterator::operator--(int) noexcept {
+ auto ret = iterator(*this);
+ this->pos = static_cast<char *>(this->pos) - this->stride;
+ return ret;
+}
+
+template <typename T>
+typename Slice<T>::iterator &Slice<T>::iterator::operator+=(
+ typename Slice<T>::iterator::difference_type n) noexcept {
+ this->pos = static_cast<char *>(this->pos) + this->stride * n;
+ return *this;
+}
+
+template <typename T>
+typename Slice<T>::iterator &Slice<T>::iterator::operator-=(
+ typename Slice<T>::iterator::difference_type n) noexcept {
+ this->pos = static_cast<char *>(this->pos) - this->stride * n;
+ return *this;
+}
+
+template <typename T>
+typename Slice<T>::iterator Slice<T>::iterator::operator+(
+ typename Slice<T>::iterator::difference_type n) const noexcept {
+ auto ret = iterator(*this);
+ ret.pos = static_cast<char *>(this->pos) + this->stride * n;
+ return ret;
+}
+
+template <typename T>
+typename Slice<T>::iterator Slice<T>::iterator::operator-(
+ typename Slice<T>::iterator::difference_type n) const noexcept {
+ auto ret = iterator(*this);
+ ret.pos = static_cast<char *>(this->pos) - this->stride * n;
+ return ret;
+}
+
+template <typename T>
+typename Slice<T>::iterator::difference_type
+Slice<T>::iterator::operator-(const iterator &other) const noexcept {
+ auto diff = std::distance(
+ static_cast<char *>(other.pos), static_cast<char *>(this->pos));
+ return diff / this->stride;
+}
+
+template <typename T>
+bool Slice<T>::iterator::operator==(const iterator &other) const noexcept {
+ return this->pos == other.pos;
+}
+
+template <typename T>
+bool Slice<T>::iterator::operator!=(const iterator &other) const noexcept {
+ return this->pos != other.pos;
+}
+
+template <typename T>
+bool Slice<T>::iterator::operator<(const iterator &other) const noexcept {
+ return this->pos < other.pos;
+}
+
+template <typename T>
+bool Slice<T>::iterator::operator<=(const iterator &other) const noexcept {
+ return this->pos <= other.pos;
+}
+
+template <typename T>
+bool Slice<T>::iterator::operator>(const iterator &other) const noexcept {
+ return this->pos > other.pos;
+}
+
+template <typename T>
+bool Slice<T>::iterator::operator>=(const iterator &other) const noexcept {
+ return this->pos >= other.pos;
+}
+
+template <typename T>
+typename Slice<T>::iterator Slice<T>::begin() const noexcept {
+ iterator it;
+ it.pos = slicePtr(this);
+ it.stride = size_of<T>();
+ return it;
+}
+
+template <typename T>
+typename Slice<T>::iterator Slice<T>::end() const noexcept {
+ iterator it = this->begin();
+ it.pos = static_cast<char *>(it.pos) + it.stride * this->size();
+ return it;
+}
+
+template <typename T> void Slice<T>::swap(Slice &rhs) noexcept {
+ std::swap(*this, rhs);
+}
+#endif // CXXBRIDGE1_RUST_SLICE
+
+#ifndef CXXBRIDGE1_RUST_BOX
+#define CXXBRIDGE1_RUST_BOX
+template <typename T> class Box final {
+public:
+ using element_type = T;
+ using const_pointer =
+ typename std::add_pointer<typename std::add_const<T>::type>::type;
+ using pointer = typename std::add_pointer<T>::type;
+
+ Box() = delete;
+ Box(Box &&) noexcept;
+ ~Box() noexcept;
+
+ explicit Box(const T &);
+ explicit Box(T &&);
+
+ Box &operator=(Box &&) &noexcept;
+
+ const T *operator->() const noexcept;
+ const T &operator*() const noexcept;
+ T *operator->() noexcept;
+ T &operator*() noexcept;
+
+ template <typename... Fields> static Box in_place(Fields &&...);
+
+ void swap(Box &) noexcept;
+
+ static Box from_raw(T *) noexcept;
+
+ T *into_raw() noexcept;
+
+ /* Deprecated */ using value_type = element_type;
+
+private:
+ class uninit;
+ class allocation;
+ Box(uninit) noexcept;
+ void drop() noexcept;
+
+ friend void swap(Box &lhs, Box &rhs) noexcept {
+ lhs.swap(rhs);
+ }
+
+ T *ptr;
+};
+
+template <typename T> class Box<T>::uninit {};
+
+template <typename T> class Box<T>::allocation {
+ static T *alloc() noexcept;
+ static void dealloc(T *) noexcept;
+
+public:
+ allocation() noexcept : ptr(alloc()) {
+ }
+ ~allocation() noexcept {
+ if (this->ptr) {
+ dealloc(this->ptr);
+ }
+ }
+ T *ptr;
+};
+
+template <typename T> Box<T>::Box(Box &&other) noexcept : ptr(other.ptr) {
+ other.ptr = nullptr;
+}
+
+template <typename T> Box<T>::Box(const T &val) {
+ allocation alloc;
+ ::new (alloc.ptr) T(val);
+ this->ptr = alloc.ptr;
+ alloc.ptr = nullptr;
+}
+
+template <typename T> Box<T>::Box(T &&val) {
+ allocation alloc;
+ ::new (alloc.ptr) T(std::move(val));
+ this->ptr = alloc.ptr;
+ alloc.ptr = nullptr;
+}
+
+template <typename T> Box<T>::~Box() noexcept {
+ if (this->ptr) {
+ this->drop();
+ }
+}
+
+template <typename T> Box<T> &Box<T>::operator=(Box &&other) &noexcept {
+ if (this->ptr) {
+ this->drop();
+ }
+ this->ptr = other.ptr;
+ other.ptr = nullptr;
+ return *this;
+}
+
+template <typename T> const T *Box<T>::operator->() const noexcept {
+ return this->ptr;
+}
+
+template <typename T> const T &Box<T>::operator*() const noexcept {
+ return *this->ptr;
+}
+
+template <typename T> T *Box<T>::operator->() noexcept {
+ return this->ptr;
+}
+
+template <typename T> T &Box<T>::operator*() noexcept {
+ return *this->ptr;
+}
+
+template <typename T>
+template <typename... Fields>
+Box<T> Box<T>::in_place(Fields &&...fields) {
+ allocation alloc;
+ auto ptr = alloc.ptr;
+ ::new (ptr) T{std::forward<Fields>(fields)...};
+ alloc.ptr = nullptr;
+ return from_raw(ptr);
+}
+
+template <typename T> void Box<T>::swap(Box &rhs) noexcept {
+ using std::swap;
+ swap(this->ptr, rhs.ptr);
+}
+
+template <typename T> Box<T> Box<T>::from_raw(T *raw) noexcept {
+ Box box = uninit{};
+ box.ptr = raw;
+ return box;
+}
+
+template <typename T> T *Box<T>::into_raw() noexcept {
+ T *raw = this->ptr;
+ this->ptr = nullptr;
+ return raw;
+}
+
+template <typename T> Box<T>::Box(uninit) noexcept {
+}
+#endif // CXXBRIDGE1_RUST_BOX
+
+#ifndef CXXBRIDGE1_RUST_BITCOPY_T
+#define CXXBRIDGE1_RUST_BITCOPY_T
+struct unsafe_bitcopy_t final {
+ explicit unsafe_bitcopy_t() = default;
+};
+#endif // CXXBRIDGE1_RUST_BITCOPY_T
+
+#ifndef CXXBRIDGE1_RUST_VEC
+#define CXXBRIDGE1_RUST_VEC
+template <typename T> class Vec final {
+public:
+ using value_type = T;
+
+ Vec() noexcept;
+ Vec(std::initializer_list<T>);
+ Vec(const Vec &);
+ Vec(Vec &&) noexcept;
+ ~Vec() noexcept;
+
+ Vec &operator=(Vec &&) &noexcept;
+ Vec &operator=(const Vec &) &;
+
+ std::size_t size() const noexcept;
+ bool empty() const noexcept;
+ const T *data() const noexcept;
+ T *data() noexcept;
+ std::size_t capacity() const noexcept;
+
+ const T &operator[](std::size_t n) const noexcept;
+ const T &at(std::size_t n) const;
+ const T &front() const noexcept;
+ const T &back() const noexcept;
+
+ T &operator[](std::size_t n) noexcept;
+ T &at(std::size_t n);
+ T &front() noexcept;
+ T &back() noexcept;
+
+ void reserve(std::size_t new_cap);
+ void push_back(const T &value);
+ void push_back(T &&value);
+ template <typename... Args> void emplace_back(Args &&...args);
+ void truncate(std::size_t len);
+ void clear();
+
+ using iterator = typename Slice<T>::iterator;
+ iterator begin() noexcept;
+ iterator end() noexcept;
+
+ using const_iterator = typename Slice<const T>::iterator;
+ const_iterator begin() const noexcept;
+ const_iterator end() const noexcept;
+ const_iterator cbegin() const noexcept;
+ const_iterator cend() const noexcept;
+
+ void swap(Vec &) noexcept;
+
+ Vec(unsafe_bitcopy_t, const Vec &) noexcept;
+
+private:
+ void reserve_total(std::size_t new_cap) noexcept;
+ void set_len(std::size_t len) noexcept;
+ void drop() noexcept;
+
+ friend void swap(Vec &lhs, Vec &rhs) noexcept {
+ lhs.swap(rhs);
+ }
+
+ std::array<std::uintptr_t, 3> repr;
+};
+
+template <typename T> Vec<T>::Vec(std::initializer_list<T> init) : Vec{} {
+ this->reserve_total(init.size());
+ std::move(init.begin(), init.end(), std::back_inserter(*this));
+}
+
+template <typename T> Vec<T>::Vec(const Vec &other) : Vec() {
+ this->reserve_total(other.size());
+ std::copy(other.begin(), other.end(), std::back_inserter(*this));
+}
+
+template <typename T> Vec<T>::Vec(Vec &&other) noexcept : repr(other.repr) {
+ new (&other) Vec();
+}
+
+template <typename T> Vec<T>::~Vec() noexcept {
+ this->drop();
+}
+
+template <typename T> Vec<T> &Vec<T>::operator=(Vec &&other) &noexcept {
+ this->drop();
+ this->repr = other.repr;
+ new (&other) Vec();
+ return *this;
+}
+
+template <typename T> Vec<T> &Vec<T>::operator=(const Vec &other) & {
+ if (this != &other) {
+ this->drop();
+ new (this) Vec(other);
+ }
+ return *this;
+}
+
+template <typename T> bool Vec<T>::empty() const noexcept {
+ return this->size() == 0;
+}
+
+template <typename T> T *Vec<T>::data() noexcept {
+ return const_cast<T *>(const_cast<const Vec<T> *>(this)->data());
+}
+
+template <typename T>
+const T &Vec<T>::operator[](std::size_t n) const noexcept {
+ assert(n < this->size());
+ auto data = reinterpret_cast<const char *>(this->data());
+ return *reinterpret_cast<const T *>(data + n * size_of<T>());
+}
+
+template <typename T> const T &Vec<T>::at(std::size_t n) const {
+ if (n >= this->size()) {
+ panic<std::out_of_range>("rust::Vec index out of range");
+ }
+ return (*this)[n];
+}
+
+template <typename T> const T &Vec<T>::front() const noexcept {
+ assert(!this->empty());
+ return (*this)[0];
+}
+
+template <typename T> const T &Vec<T>::back() const noexcept {
+ assert(!this->empty());
+ return (*this)[this->size() - 1];
+}
+
+template <typename T> T &Vec<T>::operator[](std::size_t n) noexcept {
+ assert(n < this->size());
+ auto data = reinterpret_cast<char *>(this->data());
+ return *reinterpret_cast<T *>(data + n * size_of<T>());
+}
+
+template <typename T> T &Vec<T>::at(std::size_t n) {
+ if (n >= this->size()) {
+ panic<std::out_of_range>("rust::Vec index out of range");
+ }
+ return (*this)[n];
+}
+
+template <typename T> T &Vec<T>::front() noexcept {
+ assert(!this->empty());
+ return (*this)[0];
+}
+
+template <typename T> T &Vec<T>::back() noexcept {
+ assert(!this->empty());
+ return (*this)[this->size() - 1];
+}
+
+template <typename T> void Vec<T>::reserve(std::size_t new_cap) {
+ this->reserve_total(new_cap);
+}
+
+template <typename T> void Vec<T>::push_back(const T &value) {
+ this->emplace_back(value);
+}
+
+template <typename T> void Vec<T>::push_back(T &&value) {
+ this->emplace_back(std::move(value));
+}
+
+template <typename T>
+template <typename... Args>
+void Vec<T>::emplace_back(Args &&...args) {
+ auto size = this->size();
+ this->reserve_total(size + 1);
+ ::new (reinterpret_cast<T *>(
+ reinterpret_cast<char *>(this->data()) + size * size_of<T>()))
+ T(std::forward<Args>(args)...);
+ this->set_len(size + 1);
+}
+
+template <typename T> void Vec<T>::clear() {
+ this->truncate(0);
+}
+
+template <typename T> typename Vec<T>::iterator Vec<T>::begin() noexcept {
+ return Slice<T>(this->data(), this->size()).begin();
+}
+
+template <typename T> typename Vec<T>::iterator Vec<T>::end() noexcept {
+ return Slice<T>(this->data(), this->size()).end();
+}
+
+template <typename T>
+typename Vec<T>::const_iterator Vec<T>::begin() const noexcept {
+ return this->cbegin();
+}
+
+template <typename T>
+typename Vec<T>::const_iterator Vec<T>::end() const noexcept {
+ return this->cend();
+}
+
+template <typename T>
+typename Vec<T>::const_iterator Vec<T>::cbegin() const noexcept {
+ return Slice<const T>(this->data(), this->size()).begin();
+}
+
+template <typename T>
+typename Vec<T>::const_iterator Vec<T>::cend() const noexcept {
+ return Slice<const T>(this->data(), this->size()).end();
+}
+
+template <typename T> void Vec<T>::swap(Vec &rhs) noexcept {
+ using std::swap;
+ swap(this->repr, rhs.repr);
+}
+
+template <typename T>
+Vec<T>::Vec(unsafe_bitcopy_t, const Vec &bits) noexcept : repr(bits.repr) {
+}
+#endif // CXXBRIDGE1_RUST_VEC
+
+#ifndef CXXBRIDGE1_RUST_OPAQUE
+#define CXXBRIDGE1_RUST_OPAQUE
+class Opaque {
+public:
+ Opaque() = delete;
+ Opaque(const Opaque &) = delete;
+ ~Opaque() = delete;
+};
+#endif // CXXBRIDGE1_RUST_OPAQUE
+
+#ifndef CXXBRIDGE1_IS_COMPLETE
+#define CXXBRIDGE1_IS_COMPLETE
+namespace detail {
+namespace {
+template <typename T, typename = std::size_t>
+struct is_complete : std::false_type {};
+template <typename T>
+struct is_complete<T, decltype(sizeof(T))> : std::true_type {};
+} // namespace
+} // namespace detail
+#endif // CXXBRIDGE1_IS_COMPLETE
+
+#ifndef CXXBRIDGE1_LAYOUT
+#define CXXBRIDGE1_LAYOUT
+class layout {
+ template <typename T> friend std::size_t size_of();
+ template <typename T> friend std::size_t align_of();
+ template <typename T>
+ static typename std::
+ enable_if<std::is_base_of<Opaque, T>::value, std::size_t>::type
+ do_size_of() {
+ return T::layout::size();
+ }
+ template <typename T>
+ static typename std::
+ enable_if<!std::is_base_of<Opaque, T>::value, std::size_t>::type
+ do_size_of() {
+ return sizeof(T);
+ }
+ template <typename T>
+ static
+ typename std::enable_if<detail::is_complete<T>::value, std::size_t>::type
+ size_of() {
+ return do_size_of<T>();
+ }
+ template <typename T>
+ static typename std::
+ enable_if<std::is_base_of<Opaque, T>::value, std::size_t>::type
+ do_align_of() {
+ return T::layout::align();
+ }
+ template <typename T>
+ static typename std::
+ enable_if<!std::is_base_of<Opaque, T>::value, std::size_t>::type
+ do_align_of() {
+ return alignof(T);
+ }
+ template <typename T>
+ static
+ typename std::enable_if<detail::is_complete<T>::value, std::size_t>::type
+ align_of() {
+ return do_align_of<T>();
+ }
+};
+
+template <typename T> std::size_t size_of() {
+ return layout::size_of<T>();
+}
+
+template <typename T> std::size_t align_of() {
+ return layout::align_of<T>();
+}
+#endif // CXXBRIDGE1_LAYOUT
+} // namespace cxxbridge1
+} // namespace rust
+
+namespace identity {
+struct Client;
+}
+
+namespace identity {
+#ifndef CXXBRIDGE1_STRUCT_identity$Client
+#define CXXBRIDGE1_STRUCT_identity$Client
+struct Client final : public ::rust::Opaque {
+ ~Client() = delete;
+
+private:
+ friend ::rust::layout;
+ struct layout {
+ static ::std::size_t size() noexcept;
+ static ::std::size_t align() noexcept;
+ };
+};
+#endif // CXXBRIDGE1_STRUCT_identity$Client
+
+::rust::Box<::identity::Client> initialize_client() noexcept;
+
+::rust::String get_user_id_blocking(
+ ::rust::Box<::identity::Client> client,
+ ::std::int32_t auth_type,
+ ::rust::String user_info);
+
+bool verify_user_token_blocking(
+ ::rust::Box<::identity::Client> client,
+ ::rust::String user_id,
+ ::rust::String device_id,
+ ::rust::String access_token);
+
+::rust::String register_user_blocking(
+ ::rust::Box<::identity::Client> client,
+ ::rust::String user_id,
+ ::rust::String device_id,
+ ::rust::String username,
+ ::rust::String password,
+ ::rust::String user_public_key);
+
+::rust::String login_user_pake_blocking(
+ ::rust::Box<::identity::Client> client,
+ ::rust::String user_id,
+ ::rust::String device_id,
+ ::rust::String password);
+
+::rust::String login_user_wallet_blocking(
+ ::rust::Box<::identity::Client> client,
+ ::rust::String user_id,
+ ::rust::String device_id,
+ ::rust::String siwe_message,
+ ::rust::Vec<::std::uint8_t> siwe_signature,
+ ::rust::String user_public_key);
+} // namespace identity
diff --git a/native/ios/Comm.xcodeproj/project.pbxproj b/native/ios/Comm.xcodeproj/project.pbxproj
--- a/native/ios/Comm.xcodeproj/project.pbxproj
+++ b/native/ios/Comm.xcodeproj/project.pbxproj
@@ -176,6 +176,8 @@
7FCEA2DC2444010B004017B1 /* Comm-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Comm-Bridging-Header.h"; sourceTree = "<group>"; };
7FCFD8BD1E81B8DF00629B0E /* Comm.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = Comm.entitlements; path = Comm/Comm.entitlements; sourceTree = "<group>"; };
891D1495EE1F375F3AF6C7ED /* Pods-NotificationService.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificationService.debug.xcconfig"; path = "Target Support Files/Pods-NotificationService/Pods-NotificationService.debug.xcconfig"; sourceTree = "<group>"; };
+ 8B15717928CA36B400209C6A /* lib.rs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lib.rs.h; path = grpc_client/lib.rs.h; sourceTree = "<group>"; };
+ 8B15717B28CA442C00209C6A /* cxx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cxx.h; path = grpc_client/cxx.h; sourceTree = "<group>"; };
8B3EE8BD28C7C3AA00C8303A /* lib.rs.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lib.rs.cc; path = grpc_client/lib.rs.cc; sourceTree = "<group>"; };
8BF9F24C28B7943000E20C13 /* libgrpc_client.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgrpc_client.a; path = ../cpp/CommonCpp/grpc/grpc_client/target/universal/release/libgrpc_client.a; sourceTree = "<group>"; };
913E5A7BDECB327E3DE11053 /* Pods-NotificationService.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificationService.release.xcconfig"; path = "Target Support Files/Pods-NotificationService/Pods-NotificationService.release.xcconfig"; sourceTree = "<group>"; };
@@ -313,6 +315,8 @@
718A3C0426F22BD100F04A8D /* grpc */ = {
isa = PBXGroup;
children = (
+ 8B15717B28CA442C00209C6A /* cxx.h */,
+ 8B15717928CA36B400209C6A /* lib.rs.h */,
8B3EE8BD28C7C3AA00C8303A /* lib.rs.cc */,
71009A7926FDCD71002C8453 /* Client.cpp */,
71009A7A26FDCD71002C8453 /* Client.h */,
@@ -879,7 +883,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "#!/bin/bash\nset -x\n# The $PATH used by Xcode likely won't contain Cargo, fix that.\n# In addition, the $PATH used by XCode has lots of Apple-specific\n# developer tools that your Cargo isn't expecting to use, fix that.\n# Note: This assumes a default `rustup` setup and default path.\nbuild_path=\"$HOME/.cargo/bin:/usr/local/bin:/usr/bin:/bin\"\n# cd to Cargo project\ncd ${SRCROOT}/../cpp/CommonCpp/grpc/grpc_client\n# Add iOS targets for cross-compilation\nenv PATH=\"${build_path}\" rustup target add aarch64-apple-ios\nenv PATH=\"${build_path}\" rustup target add x86_64-apple-ios\n# Install cargo lipo\nenv PATH=\"${build_path}\" cargo install cargo-lipo\n# Build cxx bridge\nenv PATH=\"${build_path}\" cargo build\n# Build universal static library (works on simulator and iOS)\nenv PATH=\"${build_path}\" cargo lipo --release \"${build_args[@]}\"\n# Copy the .cc file to the cargo project root to make it available\n# to XCode\ncp $(readlink target/cxxbridge/grpc_client/src/lib.rs.cc) .\n";
+ shellScript = "#!/bin/bash\nset -x\n# The $PATH used by Xcode likely won't contain Cargo, fix that.\n# In addition, the $PATH used by XCode has lots of Apple-specific\n# developer tools that your Cargo isn't expecting to use, fix that.\n# Note: This assumes a default `rustup` setup and default path.\nbuild_path=\"$HOME/.cargo/bin:/usr/local/bin:/usr/bin:/bin\"\n# cd to Cargo project\ncd ${SRCROOT}/../cpp/CommonCpp/grpc/grpc_client\n# Add iOS targets for cross-compilation\nenv PATH=\"${build_path}\" rustup target add aarch64-apple-ios\nenv PATH=\"${build_path}\" rustup target add x86_64-apple-ios\n# Install cargo lipo\nenv PATH=\"${build_path}\" cargo install cargo-lipo\n# Build cxx bridge\nenv PATH=\"${build_path}\" cargo build\n# Build universal static library (works on simulator and iOS)\nenv PATH=\"${build_path}\" cargo lipo --release \"${build_args[@]}\"\n# Copy the CXX files to the cargo project root to make them\n# available to XCode\ncp $(readlink target/cxxbridge/grpc_client/src/lib.rs.cc) .\ncp $(readlink target/cxxbridge/grpc_client/src/lib.rs.h) .\ncp $(readlink target/cxxbridge/rust/cxx.h) .\n# Mark the header files as generated for Phabricator\necho '// @generated' | cat - lib.rs.h > temp && mv temp lib.rs.h\necho '// @generated' | cat - cxx.h > temp && mv temp cxx.h\n";
};
8BFD334828CBC1910091411F /* Clean up generated CXX files */ = {
isa = PBXShellScriptBuildPhase;
@@ -1114,7 +1118,7 @@
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS",
"$(PODS_ROOT)/boost-for-react-native",
- "$(SRCROOT)/../cpp/CommonCpp/grpc/grpc_client/target/cxxbridge/**",
+ "$(SRCROOT)/../cpp/CommonCpp/grpc/grpc_client",
);
INFOPLIST_FILE = Comm/Info.debug.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
@@ -1259,7 +1263,7 @@
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS",
"$(PODS_ROOT)/boost-for-react-native",
- "$(SRCROOT)/../cpp/CommonCpp/grpc/grpc_client/target/cxxbridge/**",
+ "$(SRCROOT)/../cpp/CommonCpp/grpc/grpc_client",
);
INFOPLIST_FILE = Comm/Info.release.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 2, 12:22 AM (21 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2404155
Default Alt Text
D5084.id16562.diff (58 KB)

Event Timeline