| // This file is generated by src/gn/ffi/update_bridge.sh. Do not edit manually. |
| // Source: src/gn/ffi/starlark/crates/ffi/src/bridge.rs |
| #include "gn/err.h" |
| #include "gn/ffi/err.h" |
| #include "gn/ffi/scope.h" |
| #include "gn/ffi/test_with_scope.h" |
| #include "gn/ffi/value.h" |
| #include "gn/label.h" |
| #include "gn/output_file.h" |
| #include "gn/scope.h" |
| #include "gn/settings.h" |
| #include "gn/source_dir.h" |
| #include "gn/test_with_scope.h" |
| #include "gn/value.h" |
| #include <array> |
| #include <cassert> |
| #include <cstddef> |
| #include <cstdint> |
| #include <iterator> |
| #include <memory> |
| #include <new> |
| #include <stdexcept> |
| #include <string> |
| #include <type_traits> |
| #include <utility> |
| #if __cplusplus >= 201703L |
| #include <string_view> |
| #endif |
| #if __cplusplus >= 202002L |
| #include <ranges> |
| #endif |
| |
| #ifdef __GNUC__ |
| #pragma GCC diagnostic ignored "-Wmissing-declarations" |
| #pragma GCC diagnostic ignored "-Wshadow" |
| #ifdef __clang__ |
| #pragma clang diagnostic ignored "-Wdollar-in-identifier-extension" |
| #endif // __clang__ |
| #endif // __GNUC__ |
| |
| 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); |
| #ifdef __cpp_char8_t |
| String(const char8_t *s); |
| String(const char8_t *s, std::size_t len); |
| #endif |
| |
| 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_STR |
| #define CXXBRIDGE1_RUST_STR |
| class Str final { |
| public: |
| Str() noexcept; |
| Str(const String &) noexcept; |
| Str(const std::string &); |
| Str(const char *); |
| Str(const char *, std::size_t); |
| #if __cplusplus >= 201703L |
| Str(std::string_view s) : Str(s.data(), s.size()) {} |
| #endif |
| |
| Str &operator=(const Str &) & noexcept = default; |
| |
| explicit operator std::string() const; |
| #if __cplusplus >= 201703L |
| explicit operator std::string_view() const; |
| #endif |
| |
| const char *data() const noexcept; |
| std::size_t size() const noexcept; |
| std::size_t length() const noexcept; |
| bool empty() const noexcept; |
| |
| 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; |
| }; |
| |
| #if __cplusplus >= 201703L |
| inline Str cxx_to_rust(std::string_view view) { return Str(view); } |
| #endif |
| |
| inline Str cxx_to_rust(const std::string &s) { return Str(s); } |
| #endif // CXXBRIDGE1_RUST_STR |
| |
| #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; |
| |
| template <typename C> |
| explicit Slice(C &c) : Slice(c.data(), c.size()) {} |
| |
| 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; |
| }; |
| |
| #ifdef __cpp_deduction_guides |
| template <typename C> |
| explicit Slice(C &c) |
| -> Slice<std::remove_reference_t<decltype(*std::declval<C>().data())>>; |
| #endif // __cpp_deduction_guides |
| |
| template <typename T> |
| class Slice<T>::iterator final { |
| public: |
| #if __cplusplus >= 202002L |
| using iterator_category = std::contiguous_iterator_tag; |
| #else |
| using iterator_category = std::random_access_iterator_tag; |
| #endif |
| using value_type = T; |
| using element_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; |
| friend inline iterator operator+(difference_type lhs, iterator rhs) noexcept { |
| return rhs + lhs; |
| } |
| 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; |
| }; |
| |
| #if __cplusplus >= 202002L |
| static_assert(std::ranges::contiguous_range<rust::Slice<const uint8_t>>); |
| static_assert(std::contiguous_iterator<rust::Slice<const uint8_t>::iterator>); |
| #endif |
| |
| 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 / static_cast<typename Slice<T>::iterator::difference_type>( |
| 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_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 |
| |
| template <typename T> |
| union ManuallyDrop { |
| T value; |
| ManuallyDrop(T &&value) : value(::std::move(value)) {} |
| ~ManuallyDrop() {} |
| }; |
| |
| namespace { |
| template <bool> struct deleter_if { |
| template <typename T> void operator()(T *) {} |
| }; |
| template <> struct deleter_if<true> { |
| template <typename T> void operator()(T *ptr) { ptr->~T(); } |
| }; |
| } // namespace |
| } // namespace cxxbridge1 |
| } // namespace rust |
| |
| #if __cplusplus >= 201402L |
| #define CXX_DEFAULT_VALUE(value) = value |
| #else |
| #define CXX_DEFAULT_VALUE(value) |
| #endif |
| |
| struct Any; |
| struct SliceAny; |
| struct KeyValue; |
| struct ParseNodePtr; |
| enum class ValueType : ::std::uint8_t; |
| using Err = ::Err; |
| using InputFile = ::InputFile; |
| using OutputFile = ::OutputFile; |
| using SourceDir = ::SourceDir; |
| using Label = ::Label; |
| using Settings = ::Settings; |
| using Scope = ::Scope; |
| using TestWithScope = ::TestWithScope; |
| using Value = ::Value; |
| using ParseNode = ::ParseNode; |
| struct Session; |
| |
| #ifndef CXXBRIDGE1_STRUCT_Any |
| #define CXXBRIDGE1_STRUCT_Any |
| struct Any final { |
| ::std::uint8_t _private CXX_DEFAULT_VALUE(0); |
| |
| using IsRelocatable = ::std::true_type; |
| }; |
| #endif // CXXBRIDGE1_STRUCT_Any |
| |
| #ifndef CXXBRIDGE1_STRUCT_SliceAny |
| #define CXXBRIDGE1_STRUCT_SliceAny |
| struct SliceAny final { |
| ::std::size_t len CXX_DEFAULT_VALUE(0); |
| ::Any *ptr CXX_DEFAULT_VALUE(nullptr); |
| |
| using IsRelocatable = ::std::true_type; |
| }; |
| #endif // CXXBRIDGE1_STRUCT_SliceAny |
| |
| #ifndef CXXBRIDGE1_STRUCT_KeyValue |
| #define CXXBRIDGE1_STRUCT_KeyValue |
| struct KeyValue final { |
| ::rust::Str key; |
| ::Value const &value; |
| |
| using IsRelocatable = ::std::true_type; |
| }; |
| #endif // CXXBRIDGE1_STRUCT_KeyValue |
| |
| #ifndef CXXBRIDGE1_STRUCT_ParseNodePtr |
| #define CXXBRIDGE1_STRUCT_ParseNodePtr |
| struct ParseNodePtr final { |
| ::ParseNode const *ptr CXX_DEFAULT_VALUE(nullptr); |
| |
| using IsRelocatable = ::std::true_type; |
| }; |
| #endif // CXXBRIDGE1_STRUCT_ParseNodePtr |
| |
| #ifndef CXXBRIDGE1_ENUM_ValueType |
| #define CXXBRIDGE1_ENUM_ValueType |
| enum class ValueType : ::std::uint8_t { |
| None = 0, |
| Boolean = 1, |
| Integer = 2, |
| String = 3, |
| List = 4, |
| Scope = 5, |
| }; |
| #endif // CXXBRIDGE1_ENUM_ValueType |
| |
| #ifndef CXXBRIDGE1_STRUCT_Session |
| #define CXXBRIDGE1_STRUCT_Session |
| struct Session final : public ::rust::Opaque { |
| static ::rust::Box<::Session> new_cxx(::rust::Str source_root, ::rust::Str source_root_rel) noexcept; |
| static ::rust::Box<::Session> new_for_testing() noexcept; |
| void load_values(::rust::Str label, ::rust::Str relative_to, ::rust::Slice<::rust::Str const> keys, ::Scope &scope, ::Settings const &settings, ::ParseNodePtr origin, ::Err &err) const noexcept; |
| ~Session() = delete; |
| |
| private: |
| friend ::rust::layout; |
| struct layout { |
| static ::std::size_t size() noexcept; |
| static ::std::size_t align() noexcept; |
| }; |
| }; |
| #endif // CXXBRIDGE1_STRUCT_Session |
| |
| extern "C" { |
| bool cxxbridge1$196$Err$has_error(::Err const &self) noexcept { |
| bool (::Err::*has_error$)() const = &::Err::has_error; |
| return (self.*has_error$)(); |
| } |
| |
| ::Err *cxxbridge1$196$NewErr() noexcept { |
| ::std::unique_ptr<::Err> (*NewErr$)() = ::NewErr; |
| return NewErr$().release(); |
| } |
| |
| void cxxbridge1$196$ErrToString(::Err const &err, ::rust::String *return$) noexcept { |
| ::rust::String (*ErrToString$)(::Err const &) = ::ErrToString; |
| new (return$) ::rust::String(ErrToString$(err)); |
| } |
| |
| void cxxbridge1$196$PopulateErrWithLocation(::Err &err, ::rust::Str message, ::rust::Str help, ::InputFile const &file, ::std::int32_t start_line, ::std::int32_t start_column, ::std::int32_t end_line, ::std::int32_t end_column) noexcept { |
| void (*PopulateErrWithLocation$)(::Err &, ::rust::Str, ::rust::Str, ::InputFile const &, ::std::int32_t, ::std::int32_t, ::std::int32_t, ::std::int32_t) = ::PopulateErrWithLocation; |
| PopulateErrWithLocation$(err, message, help, file, start_line, start_column, end_line, end_column); |
| } |
| |
| void cxxbridge1$196$PopulateErrWithMessage(::Err &err, ::rust::Str message, ::rust::Str help) noexcept { |
| void (*PopulateErrWithMessage$)(::Err &, ::rust::Str, ::rust::Str) = ::PopulateErrWithMessage; |
| PopulateErrWithMessage$(err, message, help); |
| } |
| |
| void cxxbridge1$196$AppendSubErr(::Err &err, ::rust::Str message, ::InputFile const &file, ::std::int32_t start_line, ::std::int32_t start_column, ::std::int32_t end_line, ::std::int32_t end_column) noexcept { |
| void (*AppendSubErr$)(::Err &, ::rust::Str, ::InputFile const &, ::std::int32_t, ::std::int32_t, ::std::int32_t, ::std::int32_t) = ::AppendSubErr; |
| AppendSubErr$(err, message, file, start_line, start_column, end_line, end_column); |
| } |
| |
| ::InputFile const *cxxbridge1$196$NewInputFile(::rust::Str name, ::rust::Str code) noexcept { |
| ::InputFile const &(*NewInputFile$)(::rust::Str, ::rust::Str) = ::NewInputFile; |
| return &NewInputFile$(name, code); |
| } |
| |
| void cxxbridge1$196$OutputFile$value(::OutputFile const &self, ::rust::Str *return$) noexcept { |
| std::string_view (::OutputFile::*value$)() const = &::OutputFile::value; |
| new (return$) ::rust::Str(::rust::cxx_to_rust((self.*value$)())); |
| } |
| |
| void cxxbridge1$196$SourceDir$SourceWithNoTrailingSlash(::SourceDir const &self, ::rust::Str *return$) noexcept { |
| std::string_view (::SourceDir::*SourceWithNoTrailingSlash$)() const = &::SourceDir::SourceWithNoTrailingSlash; |
| new (return$) ::rust::Str(::rust::cxx_to_rust((self.*SourceWithNoTrailingSlash$)())); |
| } |
| |
| void cxxbridge1$196$Label$dir(::Label const &self, ::SourceDir const **return$) noexcept { |
| ::SourceDir const &(::Label::*dir$)() const = &::Label::dir; |
| new (return$) ::SourceDir const *(&(self.*dir$)()); |
| } |
| |
| void cxxbridge1$196$Label$name(::Label const &self, ::rust::Str *return$) noexcept { |
| const std::string& (::Label::*name$)() const = &::Label::name; |
| new (return$) ::rust::Str(::rust::cxx_to_rust((self.*name$)())); |
| } |
| |
| void cxxbridge1$196$Settings$toolchain_label(::Settings const &self, ::Label const **return$) noexcept { |
| ::Label const &(::Settings::*toolchain_label$)() const = &::Settings::toolchain_label; |
| new (return$) ::Label const *(&(self.*toolchain_label$)()); |
| } |
| |
| void cxxbridge1$196$NewScope(::Scope const &parent_scope, ::rust::Slice<::rust::Str const> keys, ::std::unique_ptr<::Scope> &out_scope, ::SliceAny *return$) noexcept { |
| ::SliceAny (*NewScope$)(::Scope const &, ::rust::Slice<::rust::Str const>, ::std::unique_ptr<::Scope> &) = ::NewScope; |
| new (return$) ::SliceAny(NewScope$(parent_scope, keys, out_scope)); |
| } |
| |
| void cxxbridge1$196$NewStruct(::Settings const &settings, ::rust::Slice<::rust::Str const> keys, ::std::unique_ptr<::Scope> &out_scope, ::SliceAny *return$) noexcept { |
| ::SliceAny (*NewStruct$)(::Settings const &, ::rust::Slice<::rust::Str const>, ::std::unique_ptr<::Scope> &) = ::NewStruct; |
| new (return$) ::SliceAny(NewStruct$(settings, keys, out_scope)); |
| } |
| |
| void cxxbridge1$196$GetScopeItems(::Scope const &scope, ::SliceAny *return$) noexcept { |
| ::SliceAny (*GetScopeItems$)(::Scope const &) = ::GetScopeItems; |
| new (return$) ::SliceAny(GetScopeItems$(scope)); |
| } |
| |
| ::Value const *cxxbridge1$196$GetValue(::Scope const &scope, ::rust::Str ident) noexcept { |
| ::Value const *(*GetValue$)(::Scope const &, ::rust::Str) = ::GetValue; |
| return GetValue$(scope, ident); |
| } |
| |
| ::Value *cxxbridge1$196$SetValue(::Scope &scope, ::rust::Str ident, ::ParseNodePtr *origin) noexcept { |
| ::Value &(*SetValue$)(::Scope &, ::rust::Str, ::ParseNodePtr) = ::SetValue; |
| return &SetValue$(scope, ident, ::std::move(*origin)); |
| } |
| |
| ::Settings const *cxxbridge1$196$Scope$settings_cxx(::Scope const &self) noexcept { |
| ::Settings const *(::Scope::*settings_cxx$)() const = &::Scope::settings; |
| return (self.*settings_cxx$)(); |
| } |
| |
| ::TestWithScope *cxxbridge1$196$NewTestWithScope() noexcept { |
| ::std::unique_ptr<::TestWithScope> (*NewTestWithScope$)() = ::NewTestWithScope; |
| return NewTestWithScope$().release(); |
| } |
| |
| ::Scope *cxxbridge1$196$TestWithScope$scope_cxx(::TestWithScope &self) noexcept { |
| ::Scope *(::TestWithScope::*scope_cxx$)() = &::TestWithScope::scope; |
| return (self.*scope_cxx$)(); |
| } |
| |
| ::Value *cxxbridge1$196$NewValueForTesting() noexcept { |
| ::std::unique_ptr<::Value> (*NewValueForTesting$)() = ::NewValueForTesting; |
| return NewValueForTesting$().release(); |
| } |
| |
| ::std::size_t cxxbridge1$196$ValueSize() noexcept { |
| ::std::size_t (*ValueSize$)() = ::ValueSize; |
| return ValueSize$(); |
| } |
| |
| ::ValueType cxxbridge1$196$Value$kind(::Value const &self) noexcept { |
| Value::Type (::Value::*kind$)() const = &::Value::type; |
| return ::rust::cxx_to_rust((self.*kind$)()); |
| } |
| |
| void cxxbridge1$196$Value$boolean_value(::Value const &self, bool const **return$) noexcept { |
| bool const &(::Value::*boolean_value$)() const = &::Value::boolean_value; |
| new (return$) bool const *(&(self.*boolean_value$)()); |
| } |
| |
| void cxxbridge1$196$Value$int_value(::Value const &self, ::std::int64_t const **return$) noexcept { |
| ::std::int64_t const &(::Value::*int_value$)() const = &::Value::int_value; |
| new (return$) ::std::int64_t const *(&(self.*int_value$)()); |
| } |
| |
| void cxxbridge1$196$Value$string_value(::Value const &self, ::rust::Str *return$) noexcept { |
| const std::string& (::Value::*string_value$)() const = &::Value::string_value; |
| new (return$) ::rust::Str(::rust::cxx_to_rust((self.*string_value$)())); |
| } |
| |
| void cxxbridge1$196$list_value_cxx(::Value const &val, ::SliceAny *return$) noexcept { |
| ::SliceAny (*list_value_cxx$)(::Value const &) = ::GetValueList; |
| new (return$) ::SliceAny(list_value_cxx$(val)); |
| } |
| |
| ::Scope const *cxxbridge1$196$Value$scope_value(::Value const &self) noexcept { |
| ::Scope const *(::Value::*scope_value$)() const = &::Value::scope_value; |
| return (self.*scope_value$)(); |
| } |
| |
| void cxxbridge1$196$SetValueNone(::Value &val, ::ParseNodePtr *origin) noexcept { |
| void (*SetValueNone$)(::Value &, ::ParseNodePtr) = ::SetValueNone; |
| SetValueNone$(val, ::std::move(*origin)); |
| } |
| |
| void cxxbridge1$196$SetValueBool(::Value &val, ::ParseNodePtr *origin, bool b) noexcept { |
| void (*SetValueBool$)(::Value &, ::ParseNodePtr, bool) = ::SetValueBool; |
| SetValueBool$(val, ::std::move(*origin), b); |
| } |
| |
| void cxxbridge1$196$SetValueInt(::Value &val, ::ParseNodePtr *origin, ::std::int64_t i) noexcept { |
| void (*SetValueInt$)(::Value &, ::ParseNodePtr, ::std::int64_t) = ::SetValueInt; |
| SetValueInt$(val, ::std::move(*origin), i); |
| } |
| |
| void cxxbridge1$196$SetValueString(::Value &val, ::ParseNodePtr *origin, ::rust::Str s) noexcept { |
| void (*SetValueString$)(::Value &, ::ParseNodePtr, ::rust::Str) = ::SetValueString; |
| SetValueString$(val, ::std::move(*origin), s); |
| } |
| |
| ::Any *cxxbridge1$196$SetValueList(::Value &val, ::ParseNodePtr *origin, ::std::size_t size) noexcept { |
| ::Any *(*SetValueList$)(::Value &, ::ParseNodePtr, ::std::size_t) = ::SetValueList; |
| return SetValueList$(val, ::std::move(*origin), size); |
| } |
| |
| void cxxbridge1$196$SetValueScope(::Value &val, ::ParseNodePtr *origin, ::Scope *scope) noexcept { |
| void (*SetValueScope$)(::Value &, ::ParseNodePtr, ::std::unique_ptr<::Scope>) = ::SetValueScope; |
| SetValueScope$(val, ::std::move(*origin), ::std::unique_ptr<::Scope>(scope)); |
| } |
| ::std::size_t cxxbridge1$196$Session$operator$sizeof() noexcept; |
| ::std::size_t cxxbridge1$196$Session$operator$alignof() noexcept; |
| |
| ::Session *cxxbridge1$196$Session$new(::rust::Str source_root, ::rust::Str source_root_rel) noexcept; |
| |
| ::Session *cxxbridge1$196$Session$new_for_testing() noexcept; |
| |
| void cxxbridge1$196$Session$load_values(::Session const &self, ::rust::Str label, ::rust::Str relative_to, ::rust::Slice<::rust::Str const> keys, ::Scope &scope, ::Settings const &settings, ::ParseNodePtr *origin, ::Err &err) noexcept; |
| } // extern "C" |
| |
| ::std::size_t Session::layout::size() noexcept { |
| return cxxbridge1$196$Session$operator$sizeof(); |
| } |
| |
| ::std::size_t Session::layout::align() noexcept { |
| return cxxbridge1$196$Session$operator$alignof(); |
| } |
| |
| ::rust::Box<::Session> Session::new_cxx(::rust::Str source_root, ::rust::Str source_root_rel) noexcept { |
| return ::rust::Box<::Session>::from_raw(cxxbridge1$196$Session$new(source_root, source_root_rel)); |
| } |
| |
| ::rust::Box<::Session> Session::new_for_testing() noexcept { |
| return ::rust::Box<::Session>::from_raw(cxxbridge1$196$Session$new_for_testing()); |
| } |
| |
| void Session::load_values(::rust::Str label, ::rust::Str relative_to, ::rust::Slice<::rust::Str const> keys, ::Scope &scope, ::Settings const &settings, ::ParseNodePtr origin, ::Err &err) const noexcept { |
| ::rust::ManuallyDrop<::ParseNodePtr> origin$(::std::move(origin)); |
| cxxbridge1$196$Session$load_values(*this, label, relative_to, keys, scope, settings, &origin$.value, err); |
| } |
| |
| extern "C" { |
| static_assert(::rust::detail::is_complete<::std::remove_extent<::Err>::type>::value, "definition of `::Err` is required"); |
| static_assert(sizeof(::std::unique_ptr<::Err>) == sizeof(void *), ""); |
| static_assert(alignof(::std::unique_ptr<::Err>) == alignof(void *), ""); |
| void cxxbridge1$unique_ptr$Err$null(::std::unique_ptr<::Err> *ptr) noexcept { |
| ::new (ptr) ::std::unique_ptr<::Err>(); |
| } |
| void cxxbridge1$unique_ptr$Err$raw(::std::unique_ptr<::Err> *ptr, ::std::unique_ptr<::Err>::pointer raw) noexcept { |
| ::new (ptr) ::std::unique_ptr<::Err>(raw); |
| } |
| ::std::unique_ptr<::Err>::element_type const *cxxbridge1$unique_ptr$Err$get(::std::unique_ptr<::Err> const &ptr) noexcept { |
| return ptr.get(); |
| } |
| ::std::unique_ptr<::Err>::pointer cxxbridge1$unique_ptr$Err$release(::std::unique_ptr<::Err> &ptr) noexcept { |
| return ptr.release(); |
| } |
| void cxxbridge1$unique_ptr$Err$drop(::std::unique_ptr<::Err> *ptr) noexcept { |
| ::rust::deleter_if<::rust::detail::is_complete<::Err>::value>{}(ptr); |
| } |
| |
| static_assert(::rust::detail::is_complete<::std::remove_extent<::Scope>::type>::value, "definition of `::Scope` is required"); |
| static_assert(sizeof(::std::unique_ptr<::Scope>) == sizeof(void *), ""); |
| static_assert(alignof(::std::unique_ptr<::Scope>) == alignof(void *), ""); |
| void cxxbridge1$unique_ptr$Scope$null(::std::unique_ptr<::Scope> *ptr) noexcept { |
| ::new (ptr) ::std::unique_ptr<::Scope>(); |
| } |
| void cxxbridge1$unique_ptr$Scope$raw(::std::unique_ptr<::Scope> *ptr, ::std::unique_ptr<::Scope>::pointer raw) noexcept { |
| ::new (ptr) ::std::unique_ptr<::Scope>(raw); |
| } |
| ::std::unique_ptr<::Scope>::element_type const *cxxbridge1$unique_ptr$Scope$get(::std::unique_ptr<::Scope> const &ptr) noexcept { |
| return ptr.get(); |
| } |
| ::std::unique_ptr<::Scope>::pointer cxxbridge1$unique_ptr$Scope$release(::std::unique_ptr<::Scope> &ptr) noexcept { |
| return ptr.release(); |
| } |
| void cxxbridge1$unique_ptr$Scope$drop(::std::unique_ptr<::Scope> *ptr) noexcept { |
| ::rust::deleter_if<::rust::detail::is_complete<::Scope>::value>{}(ptr); |
| } |
| |
| static_assert(::rust::detail::is_complete<::std::remove_extent<::TestWithScope>::type>::value, "definition of `::TestWithScope` is required"); |
| static_assert(sizeof(::std::unique_ptr<::TestWithScope>) == sizeof(void *), ""); |
| static_assert(alignof(::std::unique_ptr<::TestWithScope>) == alignof(void *), ""); |
| void cxxbridge1$unique_ptr$TestWithScope$null(::std::unique_ptr<::TestWithScope> *ptr) noexcept { |
| ::new (ptr) ::std::unique_ptr<::TestWithScope>(); |
| } |
| void cxxbridge1$unique_ptr$TestWithScope$raw(::std::unique_ptr<::TestWithScope> *ptr, ::std::unique_ptr<::TestWithScope>::pointer raw) noexcept { |
| ::new (ptr) ::std::unique_ptr<::TestWithScope>(raw); |
| } |
| ::std::unique_ptr<::TestWithScope>::element_type const *cxxbridge1$unique_ptr$TestWithScope$get(::std::unique_ptr<::TestWithScope> const &ptr) noexcept { |
| return ptr.get(); |
| } |
| ::std::unique_ptr<::TestWithScope>::pointer cxxbridge1$unique_ptr$TestWithScope$release(::std::unique_ptr<::TestWithScope> &ptr) noexcept { |
| return ptr.release(); |
| } |
| void cxxbridge1$unique_ptr$TestWithScope$drop(::std::unique_ptr<::TestWithScope> *ptr) noexcept { |
| ::rust::deleter_if<::rust::detail::is_complete<::TestWithScope>::value>{}(ptr); |
| } |
| |
| static_assert(::rust::detail::is_complete<::std::remove_extent<::Value>::type>::value, "definition of `::Value` is required"); |
| static_assert(sizeof(::std::unique_ptr<::Value>) == sizeof(void *), ""); |
| static_assert(alignof(::std::unique_ptr<::Value>) == alignof(void *), ""); |
| void cxxbridge1$unique_ptr$Value$null(::std::unique_ptr<::Value> *ptr) noexcept { |
| ::new (ptr) ::std::unique_ptr<::Value>(); |
| } |
| void cxxbridge1$unique_ptr$Value$raw(::std::unique_ptr<::Value> *ptr, ::std::unique_ptr<::Value>::pointer raw) noexcept { |
| ::new (ptr) ::std::unique_ptr<::Value>(raw); |
| } |
| ::std::unique_ptr<::Value>::element_type const *cxxbridge1$unique_ptr$Value$get(::std::unique_ptr<::Value> const &ptr) noexcept { |
| return ptr.get(); |
| } |
| ::std::unique_ptr<::Value>::pointer cxxbridge1$unique_ptr$Value$release(::std::unique_ptr<::Value> &ptr) noexcept { |
| return ptr.release(); |
| } |
| void cxxbridge1$unique_ptr$Value$drop(::std::unique_ptr<::Value> *ptr) noexcept { |
| ::rust::deleter_if<::rust::detail::is_complete<::Value>::value>{}(ptr); |
| } |
| |
| ::Session *cxxbridge1$box$Session$alloc() noexcept; |
| void cxxbridge1$box$Session$dealloc(::Session *) noexcept; |
| void cxxbridge1$box$Session$drop(::rust::Box<::Session> *ptr) noexcept; |
| } // extern "C" |
| |
| namespace rust { |
| inline namespace cxxbridge1 { |
| template <> |
| ::Session *Box<::Session>::allocation::alloc() noexcept { |
| return cxxbridge1$box$Session$alloc(); |
| } |
| template <> |
| void Box<::Session>::allocation::dealloc(::Session *ptr) noexcept { |
| cxxbridge1$box$Session$dealloc(ptr); |
| } |
| template <> |
| void Box<::Session>::drop() noexcept { |
| cxxbridge1$box$Session$drop(this); |
| } |
| } // namespace cxxbridge1 |
| } // namespace rust |