chromium/third_party/rust/chromium_crates_io/vendor/cxx-1.0.126/src/cxx.cc

#include "third_party/rust/cxx/v1/cxx.h"
#include <cstdio>
#include <cstring>
#include <iostream>
#include <memory>

#ifndef CXX_RS_EXPORT
#define CXX_RS_EXPORT
#endif
#ifndef CXX_CPP_EXPORT
#define CXX_CPP_EXPORT
#endif

extern "C" {
CXX_RS_EXPORT void cxxbridge1$cxx_string$init(std::string *s,
                                              const std::uint8_t *ptr,
                                              std::size_t len) noexcept {}

CXX_RS_EXPORT void cxxbridge1$cxx_string$destroy(std::string *s) noexcept {}

CXX_RS_EXPORT const char *
cxxbridge1$cxx_string$data(const std::string &s) noexcept {}

CXX_RS_EXPORT std::size_t
cxxbridge1$cxx_string$length(const std::string &s) noexcept {}

CXX_RS_EXPORT void cxxbridge1$cxx_string$clear(std::string &s) noexcept {}

CXX_RS_EXPORT void
cxxbridge1$cxx_string$reserve_total(std::string &s, size_t new_cap) noexcept {}

CXX_RS_EXPORT void cxxbridge1$cxx_string$push(std::string &s,
                                              const std::uint8_t *ptr,
                                              std::size_t len) noexcept {}

// rust::String
CXX_RS_EXPORT void cxxbridge1$string$new(rust::String *self) noexcept;
CXX_RS_EXPORT void cxxbridge1$string$clone(rust::String *self,
                                           const rust::String &other) noexcept;
CXX_RS_EXPORT bool cxxbridge1$string$from_utf8(rust::String *self,
                                               const char *ptr,
                                               std::size_t len) noexcept;
CXX_RS_EXPORT void cxxbridge1$string$from_utf8_lossy(rust::String *self,
                                                     const char *ptr,
                                                     std::size_t len) noexcept;
CXX_RS_EXPORT bool cxxbridge1$string$from_utf16(rust::String *self,
                                                const char16_t *ptr,
                                                std::size_t len) noexcept;
CXX_RS_EXPORT void cxxbridge1$string$from_utf16_lossy(rust::String *self,
                                                      const char16_t *ptr,
                                                      std::size_t len) noexcept;
CXX_RS_EXPORT void cxxbridge1$string$drop(rust::String *self) noexcept;
CXX_RS_EXPORT const char *
cxxbridge1$string$ptr(const rust::String *self) noexcept;
CXX_RS_EXPORT std::size_t
cxxbridge1$string$len(const rust::String *self) noexcept;
CXX_RS_EXPORT std::size_t
cxxbridge1$string$capacity(const rust::String *self) noexcept;
CXX_RS_EXPORT void
cxxbridge1$string$reserve_additional(rust::String *self,
                                     size_t additional) noexcept;
CXX_RS_EXPORT void cxxbridge1$string$reserve_total(rust::String *self,
                                                   size_t new_cap) noexcept;

// rust::Str
CXX_RS_EXPORT void cxxbridge1$str$new(rust::Str *self) noexcept;
CXX_RS_EXPORT void cxxbridge1$str$ref(rust::Str *self,
                                      const rust::String *string) noexcept;
CXX_RS_EXPORT bool cxxbridge1$str$from(rust::Str *self, const char *ptr,
                                       std::size_t len) noexcept;
CXX_RS_EXPORT const char *cxxbridge1$str$ptr(const rust::Str *self) noexcept;
CXX_RS_EXPORT std::size_t cxxbridge1$str$len(const rust::Str *self) noexcept;

// rust::Slice
CXX_RS_EXPORT void cxxbridge1$slice$new(void *self, const void *ptr,
                                        std::size_t len) noexcept;
CXX_RS_EXPORT void *cxxbridge1$slice$ptr(const void *self) noexcept;
CXX_RS_EXPORT std::size_t cxxbridge1$slice$len(const void *self) noexcept;
} // extern "C"

namespace rust {
inline namespace cxxbridge1 {

template <typename Exception>
void panic [[noreturn]] (const char *msg) {}

template void panic<std::out_of_range> [[noreturn]] (const char *msg);


template <typename T>
static bool is_aligned(const void *ptr) noexcept {}

CXX_CPP_EXPORT String::String() noexcept {}

CXX_CPP_EXPORT String::String(const String &other) noexcept {}

CXX_CPP_EXPORT String::String(String &&other) noexcept :{}

CXX_CPP_EXPORT String::~String() noexcept {}

static void initString(String *self, const char *s, std::size_t len) {}

static void initString(String *self, const char16_t *s, std::size_t len) {}

CXX_CPP_EXPORT String::String(const std::string &s) {}

CXX_CPP_EXPORT String::String(const char *s) {}

CXX_CPP_EXPORT String::String(const char *s, std::size_t len) {}

CXX_CPP_EXPORT String::String(const char16_t *s) {}

CXX_CPP_EXPORT String::String(const char16_t *s, std::size_t len) {}

struct String::lossy_t {};

CXX_CPP_EXPORT String::String(lossy_t, const char *s,
                              std::size_t len) noexcept {}

CXX_CPP_EXPORT String::String(lossy_t, const char16_t *s,
                              std::size_t len) noexcept {}

CXX_CPP_EXPORT String String::lossy(const std::string &s) noexcept {}

CXX_CPP_EXPORT String String::lossy(const char *s) noexcept {}

CXX_CPP_EXPORT String String::lossy(const char *s, std::size_t len) noexcept {}

CXX_CPP_EXPORT String String::lossy(const char16_t *s) noexcept {}

CXX_CPP_EXPORT String String::lossy(const char16_t *s,
                                    std::size_t len) noexcept {}

CXX_CPP_EXPORT String &String::operator=(const String &other) &noexcept {}

CXX_CPP_EXPORT String &String::operator=(String &&other) &noexcept {}

CXX_CPP_EXPORT operator basic_string()

CXX_CPP_EXPORT const char *String::data() const noexcept {}

CXX_CPP_EXPORT std::size_t String::size() const noexcept {}

CXX_CPP_EXPORT std::size_t String::length() const noexcept {}

CXX_CPP_EXPORT bool String::empty() const noexcept {}

CXX_CPP_EXPORT const char *String::c_str() noexcept {}

CXX_CPP_EXPORT std::size_t String::capacity() const noexcept {}

CXX_CPP_EXPORT void String::reserve(std::size_t new_cap) noexcept {}

CXX_CPP_EXPORT String::iterator String::begin() noexcept {}

CXX_CPP_EXPORT String::iterator String::end() noexcept {}

CXX_CPP_EXPORT String::const_iterator String::begin() const noexcept {}

CXX_CPP_EXPORT String::const_iterator String::end() const noexcept {}

CXX_CPP_EXPORT String::const_iterator String::cbegin() const noexcept {}

CXX_CPP_EXPORT String::const_iterator String::cend() const noexcept {}

CXX_CPP_EXPORT bool String::operator==(const String &rhs) const noexcept {}

CXX_CPP_EXPORT bool String::operator!=(const String &rhs) const noexcept {}

CXX_CPP_EXPORT bool String::operator<(const String &rhs) const noexcept {}

CXX_CPP_EXPORT bool String::operator<=(const String &rhs) const noexcept {}

CXX_CPP_EXPORT bool String::operator>(const String &rhs) const noexcept {}

CXX_CPP_EXPORT bool String::operator>=(const String &rhs) const noexcept {}

CXX_CPP_EXPORT void String::swap(String &rhs) noexcept {}

CXX_CPP_EXPORT String::String(unsafe_bitcopy_t, const String &bits) noexcept
    :{}

CXX_CPP_EXPORT std::ostream &operator<<(std::ostream &os, const String &s) {}

CXX_CPP_EXPORT Str::Str() noexcept {}

CXX_CPP_EXPORT Str::Str(const String &s) noexcept {}

static void initStr(Str *self, const char *ptr, std::size_t len) {}

CXX_CPP_EXPORT Str::Str(const std::string &s) {}

CXX_CPP_EXPORT Str::Str(const char *s) {}

CXX_CPP_EXPORT Str::Str(const char *s, std::size_t len) {}

CXX_CPP_EXPORT operator basic_string()

CXX_CPP_EXPORT const char *Str::data() const noexcept {}

CXX_CPP_EXPORT std::size_t Str::size() const noexcept {}

CXX_CPP_EXPORT std::size_t Str::length() const noexcept {}

CXX_CPP_EXPORT bool Str::empty() const noexcept {}

CXX_CPP_EXPORT Str::const_iterator Str::begin() const noexcept {}

CXX_CPP_EXPORT Str::const_iterator Str::end() const noexcept {}

CXX_CPP_EXPORT Str::const_iterator Str::cbegin() const noexcept {}

CXX_CPP_EXPORT Str::const_iterator Str::cend() const noexcept {}

CXX_CPP_EXPORT bool Str::operator==(const Str &rhs) const noexcept {}

CXX_CPP_EXPORT bool Str::operator!=(const Str &rhs) const noexcept {}

CXX_CPP_EXPORT bool Str::operator<(const Str &rhs) const noexcept {}

CXX_CPP_EXPORT bool Str::operator<=(const Str &rhs) const noexcept {}

CXX_CPP_EXPORT bool Str::operator>(const Str &rhs) const noexcept {}

CXX_CPP_EXPORT bool Str::operator>=(const Str &rhs) const noexcept {}

CXX_CPP_EXPORT void Str::swap(Str &rhs) noexcept {}

CXX_CPP_EXPORT std::ostream &operator<<(std::ostream &os, const Str &s) {}

CXX_CPP_EXPORT void sliceInit(void *self, const void *ptr, std::size_t len) noexcept {}

CXX_CPP_EXPORT void *slicePtr(const void *self) noexcept {}

CXX_CPP_EXPORT std::size_t sliceLen(const void *self) noexcept {}

// Rust specifies that usize is ABI compatible with C's uintptr_t.
// https://rust-lang.github.io/unsafe-code-guidelines/layout/scalars.html#isize-and-usize
// However there is no direct Rust equivalent for size_t. C does not guarantee
// that size_t and uintptr_t are compatible. In practice though, on all
// platforms supported by Rust, they are identical for ABI purposes. See the
// libc crate which unconditionally defines libc::size_t = usize. We expect the
// same here and these assertions are just here to explicitly document that.
// *Note that no assumption is made about C++ name mangling of signatures
// containing these types, not here nor anywhere in CXX.*
static_assert;
static_assert;
static_assert;
static_assert;

static_assert;
static_assert;
static_assert;

static_assert;
static_assert;
static_assert;
static_assert;
static_assert;

static_assert;
static_assert;
static_assert;
static_assert;
static_assert;

static_assert;
static_assert;
static_assert;

static const char *errorCopy(const char *ptr, std::size_t len) {}

extern "C" {
CXX_RS_EXPORT const char *cxxbridge1$error(const char *ptr,
                                           std::size_t len) noexcept {}
} // extern "C"

CXX_CPP_EXPORT Error::Error(const Error &other)
    :{}

CXX_CPP_EXPORT Error::Error(Error &&other) noexcept
    :{}

CXX_CPP_EXPORT Error::~Error() noexcept {}

CXX_CPP_EXPORT Error &Error::operator=(const Error &other) & {}

CXX_CPP_EXPORT Error &Error::operator=(Error &&other) &noexcept {}

CXX_CPP_EXPORT const char *Error::what() const noexcept {}

namespace {
template <typename T>
union MaybeUninit {};
} // namespace

namespace repr {
struct PtrLen final {};
} // namespace repr

extern "C" {
CXX_RS_EXPORT repr::PtrLen cxxbridge1$exception(const char *, std::size_t len) noexcept;
}

namespace detail {
// On some platforms size_t is the same C++ type as one of the sized integer
// types; on others it is a distinct type. Only in the latter case do we need to
// define a specialized impl of rust::Vec<size_t>, because in the former case it
// would collide with one of the other specializations.
usize_if_unique;
isize_if_unique;
// Similarly, on some platforms char may just be an alias for [u]int8_t.
char_if_unique;

class Fail final {};

CXX_CPP_EXPORT void Fail::operator()(const char *catch$) noexcept {}

CXX_CPP_EXPORT void Fail::operator()(const std::string &catch$) noexcept {}
} // namespace detail

} // namespace cxxbridge1
} // namespace rust

namespace {
template <typename T>
void destroy(T *ptr) {}
} // namespace

extern "C" {
CXX_RS_EXPORT void cxxbridge1$unique_ptr$std$string$null(
    std::unique_ptr<std::string> *ptr) noexcept {}
CXX_RS_EXPORT void
cxxbridge1$unique_ptr$std$string$raw(std::unique_ptr<std::string> *ptr,
                                     std::string *raw) noexcept {}
CXX_RS_EXPORT const std::string *cxxbridge1$unique_ptr$std$string$get(
    const std::unique_ptr<std::string> &ptr) noexcept {}
CXX_RS_EXPORT std::string *cxxbridge1$unique_ptr$std$string$release(
    std::unique_ptr<std::string> &ptr) noexcept {}
CXX_RS_EXPORT void cxxbridge1$unique_ptr$std$string$drop(
    std::unique_ptr<std::string> *ptr) noexcept {}
} // extern "C"

namespace {
const std::size_t kMaxExpectedWordsInString =;
static_assert;
static_assert;
} // namespace

#define STD_VECTOR_OPS(RUST_TYPE, CXX_TYPE)

#define STD_VECTOR_TRIVIAL_OPS(RUST_TYPE, CXX_TYPE)

#define RUST_VEC_EXTERNS(RUST_TYPE, CXX_TYPE)

#define RUST_VEC_OPS(RUST_TYPE, CXX_TYPE)

#define SHARED_PTR_OPS(RUST_TYPE, CXX_TYPE)

// Usize and isize are the same type as one of the below.
#define FOR_EACH_NUMERIC(MACRO)

#define FOR_EACH_TRIVIAL_STD_VECTOR(MACRO)

#define FOR_EACH_STD_VECTOR(MACRO)

#define FOR_EACH_RUST_VEC(MACRO)

#define FOR_EACH_SHARED_PTR(MACRO)

extern // extern "C"

namespace rust {
cxxbridge1 // namespace cxxbridge1
} // namespace rust