chromium/third_party/rust/chromium_crates_io/vendor/cxx-1.0.126/include/cxx.h

#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 {};
#endif // CXXBRIDGE1_RUST_STRING

#ifndef CXXBRIDGE1_RUST_STR
#define CXXBRIDGE1_RUST_STR
// https://cxx.rs/binding/str.html
class Str final {};
#endif // CXXBRIDGE1_RUST_STR

#ifndef CXXBRIDGE1_RUST_SLICE
namespace detail {
template <bool>
struct copy_assignable_if {};

template <>
struct copy_assignable_if<false> {};
} // namespace detail

// https://cxx.rs/binding/slice.html
template <typename T>
class Slice final
    : private detail::copy_assignable_if<std::is_const<T>::value> {};

template <typename T>
class Slice<T>::iterator final {};
#endif // CXXBRIDGE1_RUST_SLICE

#ifndef CXXBRIDGE1_RUST_BOX
// https://cxx.rs/binding/box.html
template <typename T>
class Box final {};
#endif // CXXBRIDGE1_RUST_BOX

#ifndef CXXBRIDGE1_RUST_VEC
// https://cxx.rs/binding/vec.html
template <typename T>
class Vec final {};
#endif // CXXBRIDGE1_RUST_VEC

#ifndef CXXBRIDGE1_RUST_FN
// https://cxx.rs/binding/fn.html
template <typename Signature>
class Fn;

Fn<Ret (Args...)>;
#endif // CXXBRIDGE1_RUST_FN

#ifndef CXXBRIDGE1_RUST_ERROR
#define CXXBRIDGE1_RUST_ERROR
// https://cxx.rs/binding/result.html
class Error final : public std::exception {};
#endif // CXXBRIDGE1_RUST_ERROR

#ifndef CXXBRIDGE1_RUST_ISIZE
#define CXXBRIDGE1_RUST_ISIZE
#if defined(_WIN32)
using isize = SSIZE_T;
#else
isize;
#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 {};
#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;

u8;
u16;
u32;
u64;
usize; // see static asserts in cxx.cc
i8;
i16;
i32;
i64;
f32;
f64;

// Snake case aliases for use in code that uses this style for type names.
string;
str;
slice;
box;
vec;
error;
fn;
is_relocatable;



////////////////////////////////////////////////////////////////////////////////
/// 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 {}

template <typename Ret, typename... Args>
Fn<Ret(Args...)> Fn<Ret(Args...)>::operator*() const noexcept {}
#endif // CXXBRIDGE1_RUST_FN

#ifndef CXXBRIDGE1_RUST_BITCOPY_T
#define CXXBRIDGE1_RUST_BITCOPY_T
struct unsafe_bitcopy_t final {};
#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 {}

template <typename T>
Slice<T>::Slice(T *s, std::size_t count) noexcept {}

template <typename T>
T *Slice<T>::data() const noexcept {}

template <typename T>
std::size_t Slice<T>::size() const noexcept {}

template <typename T>
std::size_t Slice<T>::length() const noexcept {}

template <typename T>
bool Slice<T>::empty() const noexcept {}

template <typename T>
T &Slice<T>::operator[](std::size_t n) const noexcept {}

template <typename T>
T &Slice<T>::at(std::size_t n) const {}

template <typename T>
T &Slice<T>::front() const noexcept {}

template <typename T>
T &Slice<T>::back() const noexcept {}

template <typename T>
typename Slice<T>::iterator::reference
Slice<T>::iterator::operator*() const noexcept {}

template <typename T>
typename Slice<T>::iterator::pointer
Slice<T>::iterator::operator->() const noexcept {}

template <typename T>
typename Slice<T>::iterator::reference Slice<T>::iterator::operator[](
    typename Slice<T>::iterator::difference_type n) const noexcept {}

template <typename T>
typename Slice<T>::iterator &Slice<T>::iterator::operator++() noexcept {}

template <typename T>
typename Slice<T>::iterator Slice<T>::iterator::operator++(int) noexcept {}

template <typename T>
typename Slice<T>::iterator &Slice<T>::iterator::operator--() noexcept {}

template <typename T>
typename Slice<T>::iterator Slice<T>::iterator::operator--(int) noexcept {}

template <typename T>
typename Slice<T>::iterator &Slice<T>::iterator::operator+=(
    typename Slice<T>::iterator::difference_type n) noexcept {}

template <typename T>
typename Slice<T>::iterator &Slice<T>::iterator::operator-=(
    typename Slice<T>::iterator::difference_type n) noexcept {}

template <typename T>
typename Slice<T>::iterator Slice<T>::iterator::operator+(
    typename Slice<T>::iterator::difference_type n) const noexcept {}

template <typename T>
typename Slice<T>::iterator Slice<T>::iterator::operator-(
    typename Slice<T>::iterator::difference_type n) const noexcept {}

template <typename T>
typename Slice<T>::iterator::difference_type
Slice<T>::iterator::operator-(const iterator &other) const noexcept {}

template <typename T>
bool Slice<T>::iterator::operator==(const iterator &other) const noexcept {}

template <typename T>
bool Slice<T>::iterator::operator!=(const iterator &other) const noexcept {}

template <typename T>
bool Slice<T>::iterator::operator<(const iterator &other) const noexcept {}

template <typename T>
bool Slice<T>::iterator::operator<=(const iterator &other) const noexcept {}

template <typename T>
bool Slice<T>::iterator::operator>(const iterator &other) const noexcept {}

template <typename T>
bool Slice<T>::iterator::operator>=(const iterator &other) const noexcept {}

template <typename T>
typename Slice<T>::iterator Slice<T>::begin() const noexcept {}

template <typename T>
typename Slice<T>::iterator Slice<T>::end() const noexcept {}

template <typename T>
void Slice<T>::swap(Slice &rhs) noexcept {}
#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 {};

template <typename T>
Box<T>::Box(Box &&other) noexcept :{}

template <typename T>
Box<T>::Box(const T &val) {}

template <typename T>
Box<T>::Box(T &&val) {}

template <typename T>
Box<T>::~Box() noexcept {}

template <typename T>
Box<T> &Box<T>::operator=(Box &&other) &noexcept {}

template <typename T>
const T *Box<T>::operator->() const noexcept {}

template <typename T>
const T &Box<T>::operator*() const noexcept {}

template <typename T>
T *Box<T>::operator->() noexcept {}

template <typename T>
T &Box<T>::operator*() noexcept {}

template <typename T>
template <typename... Fields>
Box<T> Box<T>::in_place(Fields &&...fields) {}

template <typename T>
void Box<T>::swap(Box &rhs) noexcept {}

template <typename T>
Box<T> Box<T>::from_raw(T *raw) noexcept {}

template <typename T>
T *Box<T>::into_raw() noexcept {}

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) :{}

template <typename T>
Vec<T>::Vec(const Vec &other) :{}

template <typename T>
Vec<T>::Vec(Vec &&other) noexcept :{}

template <typename T>
Vec<T>::~Vec() noexcept {}

template <typename T>
Vec<T> &Vec<T>::operator=(Vec &&other) &noexcept {}

template <typename T>
Vec<T> &Vec<T>::operator=(const Vec &other) & {}

template <typename T>
bool Vec<T>::empty() const noexcept {}

template <typename T>
T *Vec<T>::data() noexcept {}

template <typename T>
const T &Vec<T>::operator[](std::size_t n) const noexcept {}

template <typename T>
const T &Vec<T>::at(std::size_t n) const {}

template <typename T>
const T &Vec<T>::front() const noexcept {}

template <typename T>
const T &Vec<T>::back() const noexcept {}

template <typename T>
T &Vec<T>::operator[](std::size_t n) noexcept {}

template <typename T>
T &Vec<T>::at(std::size_t n) {}

template <typename T>
T &Vec<T>::front() noexcept {}

template <typename T>
T &Vec<T>::back() noexcept {}

template <typename T>
void Vec<T>::reserve(std::size_t new_cap) {}

template <typename T>
void Vec<T>::push_back(const T &value) {}

template <typename T>
void Vec<T>::push_back(T &&value) {}

template <typename T>
template <typename... Args>
void Vec<T>::emplace_back(Args &&...args) {}

template <typename T>
void Vec<T>::clear() {}

template <typename T>
typename Vec<T>::iterator Vec<T>::begin() noexcept {}

template <typename T>
typename Vec<T>::iterator Vec<T>::end() noexcept {}

template <typename T>
typename Vec<T>::const_iterator Vec<T>::begin() const noexcept {}

template <typename T>
typename Vec<T>::const_iterator Vec<T>::end() const noexcept {}

template <typename T>
typename Vec<T>::const_iterator Vec<T>::cbegin() const noexcept {}

template <typename T>
typename Vec<T>::const_iterator Vec<T>::cend() const noexcept {}

template <typename T>
void Vec<T>::swap(Vec &rhs) noexcept {}

// Internal API only intended for the cxxbridge code generator.
template <typename T>
Vec<T>::Vec(unsafe_bitcopy_t, const Vec &bits) noexcept :{}
#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 {};
is_complete<T, decltype(sizeof(T))>;
} // namespace
} // namespace detail
#endif // CXXBRIDGE1_IS_COMPLETE

#ifndef CXXBRIDGE1_LAYOUT
#define CXXBRIDGE1_LAYOUT
class layout {};

template <typename T>
std::size_t size_of() {}

template <typename T>
std::size_t align_of() {}
#endif // CXXBRIDGE1_LAYOUT

#ifndef CXXBRIDGE1_RELOCATABLE
#define CXXBRIDGE1_RELOCATABLE
namespace detail {
template <typename... Ts>
struct make_void {};

void_t;

template <typename Void, template <typename...> class, typename...>
struct detect : std::false_type {};
detect<void_t<T<A...>>, T, A...>;

is_detected;

detect_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