/**
 * Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/src/module.thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated @nocommit
 */
#pragma once

#include <thrift/lib/cpp2/gen/module_types_h.h>



namespace apache {
namespace thrift {
namespace ident {
struct err_code;
struct optional_blob;
struct is_on;
struct tiny_int;
struct small_int;
struct nice_sized_int;
struct big_int;
struct real;
struct smaller_real;
struct something;
struct hidden_field;
struct field1;
struct field2;
struct field3;
struct best;
struct test;
struct structOne;
struct structTwo;
struct an_integer;
struct name;
struct an_enum;
struct some_bytes;
struct from;
struct cdef;
struct bytes_with_cpp_type;
struct iobuf_val;
struct u;
} // namespace ident
namespace detail {
#ifndef APACHE_THRIFT_ACCESSOR_err_code
#define APACHE_THRIFT_ACCESSOR_err_code
APACHE_THRIFT_DEFINE_ACCESSOR(err_code);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_optional_blob
#define APACHE_THRIFT_ACCESSOR_optional_blob
APACHE_THRIFT_DEFINE_ACCESSOR(optional_blob);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_is_on
#define APACHE_THRIFT_ACCESSOR_is_on
APACHE_THRIFT_DEFINE_ACCESSOR(is_on);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_tiny_int
#define APACHE_THRIFT_ACCESSOR_tiny_int
APACHE_THRIFT_DEFINE_ACCESSOR(tiny_int);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_small_int
#define APACHE_THRIFT_ACCESSOR_small_int
APACHE_THRIFT_DEFINE_ACCESSOR(small_int);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_nice_sized_int
#define APACHE_THRIFT_ACCESSOR_nice_sized_int
APACHE_THRIFT_DEFINE_ACCESSOR(nice_sized_int);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_big_int
#define APACHE_THRIFT_ACCESSOR_big_int
APACHE_THRIFT_DEFINE_ACCESSOR(big_int);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_real
#define APACHE_THRIFT_ACCESSOR_real
APACHE_THRIFT_DEFINE_ACCESSOR(real);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_smaller_real
#define APACHE_THRIFT_ACCESSOR_smaller_real
APACHE_THRIFT_DEFINE_ACCESSOR(smaller_real);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_something
#define APACHE_THRIFT_ACCESSOR_something
APACHE_THRIFT_DEFINE_ACCESSOR(something);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_hidden_field
#define APACHE_THRIFT_ACCESSOR_hidden_field
APACHE_THRIFT_DEFINE_ACCESSOR(hidden_field);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_field1
#define APACHE_THRIFT_ACCESSOR_field1
APACHE_THRIFT_DEFINE_ACCESSOR(field1);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_field2
#define APACHE_THRIFT_ACCESSOR_field2
APACHE_THRIFT_DEFINE_ACCESSOR(field2);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_field3
#define APACHE_THRIFT_ACCESSOR_field3
APACHE_THRIFT_DEFINE_ACCESSOR(field3);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_best
#define APACHE_THRIFT_ACCESSOR_best
APACHE_THRIFT_DEFINE_ACCESSOR(best);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_test
#define APACHE_THRIFT_ACCESSOR_test
APACHE_THRIFT_DEFINE_ACCESSOR(test);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_structOne
#define APACHE_THRIFT_ACCESSOR_structOne
APACHE_THRIFT_DEFINE_ACCESSOR(structOne);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_structTwo
#define APACHE_THRIFT_ACCESSOR_structTwo
APACHE_THRIFT_DEFINE_ACCESSOR(structTwo);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_an_integer
#define APACHE_THRIFT_ACCESSOR_an_integer
APACHE_THRIFT_DEFINE_ACCESSOR(an_integer);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_name
#define APACHE_THRIFT_ACCESSOR_name
APACHE_THRIFT_DEFINE_ACCESSOR(name);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_an_enum
#define APACHE_THRIFT_ACCESSOR_an_enum
APACHE_THRIFT_DEFINE_ACCESSOR(an_enum);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_some_bytes
#define APACHE_THRIFT_ACCESSOR_some_bytes
APACHE_THRIFT_DEFINE_ACCESSOR(some_bytes);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_from
#define APACHE_THRIFT_ACCESSOR_from
APACHE_THRIFT_DEFINE_ACCESSOR(from);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_cdef
#define APACHE_THRIFT_ACCESSOR_cdef
APACHE_THRIFT_DEFINE_ACCESSOR(cdef);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_bytes_with_cpp_type
#define APACHE_THRIFT_ACCESSOR_bytes_with_cpp_type
APACHE_THRIFT_DEFINE_ACCESSOR(bytes_with_cpp_type);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_iobuf_val
#define APACHE_THRIFT_ACCESSOR_iobuf_val
APACHE_THRIFT_DEFINE_ACCESSOR(iobuf_val);
#endif
#ifndef APACHE_THRIFT_ACCESSOR_u
#define APACHE_THRIFT_ACCESSOR_u
APACHE_THRIFT_DEFINE_ACCESSOR(u);
#endif
} // namespace detail
} // namespace thrift
} // namespace apache

// BEGIN declare_enums
namespace py3::simple {

/** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "name": "AnEnum", "kind": "enum" } */
enum class AnEnum {
  None = 0,
  ONE = 1,
  TWO = 2,
  THREE = 3,
  FOUR = 4,
};



/** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "name": "AnEnumRenamed", "kind": "enum" } */
enum class AnEnumRenamed {
  name = 0,
  value = 1,
  normal = 2,
};



/** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "name": "Flags", "kind": "enum" } */
enum class Flags {
  flag_A = 1,
  flag_B = 2,
  flag_C = 4,
  flag_D = 8,
};



} // namespace py3::simple

namespace std {
template<> struct hash<::py3::simple::AnEnum> :
  ::apache::thrift::detail::enum_hash<::py3::simple::AnEnum> {};
template<> struct hash<::py3::simple::AnEnumRenamed> :
  ::apache::thrift::detail::enum_hash<::py3::simple::AnEnumRenamed> {};
template<> struct hash<::py3::simple::Flags> :
  ::apache::thrift::detail::enum_hash<::py3::simple::Flags> {};
} // std

namespace apache { namespace thrift {


template <> struct TEnumDataStorage<::py3::simple::AnEnum>;

template <> struct TEnumTraits<::py3::simple::AnEnum> {
  using type = ::py3::simple::AnEnum;

  static constexpr std::size_t const size = 5;
  static folly::Range<type const*> const values;
  static folly::Range<std::string_view const*> const names;
  static const std::string_view __fbthrift_module_name_internal_do_not_use;

  static bool findName(type value, std::string_view* out) noexcept;
  static bool findValue(std::string_view name, type* out) noexcept;

  template <class ...>
  FOLLY_ERASE static std::string_view typeName() noexcept {
    return "AnEnum";
  }

  static char const* findName(type value) noexcept {
    std::string_view ret;
    (void)findName(value, &ret);
    return ret.data();
  }
  static constexpr type min() { return type::None; }
  static constexpr type max() { return type::FOUR; }
};


template <> struct TEnumDataStorage<::py3::simple::AnEnumRenamed>;

template <> struct TEnumTraits<::py3::simple::AnEnumRenamed> {
  using type = ::py3::simple::AnEnumRenamed;

  static constexpr std::size_t const size = 3;
  static folly::Range<type const*> const values;
  static folly::Range<std::string_view const*> const names;
  static const std::string_view __fbthrift_module_name_internal_do_not_use;

  static bool findName(type value, std::string_view* out) noexcept;
  static bool findValue(std::string_view name, type* out) noexcept;

  template <class ...>
  FOLLY_ERASE static std::string_view typeName() noexcept {
    return "AnEnumRenamed";
  }

  static char const* findName(type value) noexcept {
    std::string_view ret;
    (void)findName(value, &ret);
    return ret.data();
  }
  static constexpr type min() { return type::name; }
  static constexpr type max() { return type::normal; }
};


template <> struct TEnumDataStorage<::py3::simple::Flags>;

template <> struct TEnumTraits<::py3::simple::Flags> {
  using type = ::py3::simple::Flags;

  static constexpr std::size_t const size = 4;
  static folly::Range<type const*> const values;
  static folly::Range<std::string_view const*> const names;
  static const std::string_view __fbthrift_module_name_internal_do_not_use;

  static bool findName(type value, std::string_view* out) noexcept;
  static bool findValue(std::string_view name, type* out) noexcept;

  template <class ...>
  FOLLY_ERASE static std::string_view typeName() noexcept {
    return "Flags";
  }

  static char const* findName(type value) noexcept {
    std::string_view ret;
    (void)findName(value, &ret);
    return ret.data();
  }
  static constexpr type min() { return type::flag_A; }
  static constexpr type max() { return type::flag_D; }
};


}} // apache::thrift


// END declare_enums
// BEGIN forward_declare
namespace py3::simple {
class SimpleException;
class OptionalRefStruct;
class SimpleStruct;
class HiddenTypeFieldsStruct;
namespace detail {
class AdaptedUnion;
} // namespace detail
class HiddenException;
class ComplexStruct;
class BinaryUnion;
class BinaryUnionStruct;
} // namespace py3::simple
// END forward_declare
namespace apache::thrift::detail::annotation {
} // namespace apache::thrift::detail::annotation

namespace apache::thrift::detail::qualifier {
} // namespace apache::thrift::detail::qualifier

// BEGIN hash_and_equal_to
// END hash_and_equal_to
namespace py3::simple {
using ::apache::thrift::detail::operator!=;
using ::apache::thrift::detail::operator>;
using ::apache::thrift::detail::operator<=;
using ::apache::thrift::detail::operator>=;

/** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "name": "IOBufPtr", "kind": "typedef" } */
typedef std::unique_ptr<folly::IOBuf> IOBufPtr;
/** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "name": "IOBuf", "kind": "typedef" } */
typedef folly::IOBuf IOBuf;

/** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "name": "SimpleStruct", "kind": "struct" } */
class SimpleStruct final  {
 private:
  friend struct ::apache::thrift::detail::st::struct_private_access;
  template<class> friend struct ::apache::thrift::detail::invoke_reffer;

  //  used by a static_assert in the corresponding source
  static constexpr bool __fbthrift_cpp2_gen_json = false;
  static constexpr bool __fbthrift_cpp2_is_runtime_annotation = false;
  static std::string_view __fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord);
  static std::string_view __fbthrift_get_class_name();
  using __fbthrift_reflection_ident_list = folly::tag_t<
    ::apache::thrift::ident::is_on,
    ::apache::thrift::ident::tiny_int,
    ::apache::thrift::ident::small_int,
    ::apache::thrift::ident::nice_sized_int,
    ::apache::thrift::ident::big_int,
    ::apache::thrift::ident::real,
    ::apache::thrift::ident::smaller_real,
    ::apache::thrift::ident::something,
    ::apache::thrift::ident::hidden_field
  >;

  static constexpr std::int16_t __fbthrift_reflection_field_id_list[] = {0,1,2,3,4,5,6,7,9,8};
  using __fbthrift_reflection_type_tags = folly::tag_t<
    ::apache::thrift::type::bool_t,
    ::apache::thrift::type::byte_t,
    ::apache::thrift::type::i16_t,
    ::apache::thrift::type::i32_t,
    ::apache::thrift::type::i64_t,
    ::apache::thrift::type::double_t,
    ::apache::thrift::type::float_t,
    ::apache::thrift::type::cpp_type<::std::unordered_map<::std::int32_t, ::std::int32_t>, ::apache::thrift::type::map<::apache::thrift::type::i32_t, ::apache::thrift::type::i32_t>>,
    ::apache::thrift::type::i16_t
  >;

  static constexpr std::size_t __fbthrift_field_size_v = 9;

  template<class T>
  using __fbthrift_id = ::apache::thrift::type::field_id<__fbthrift_reflection_field_id_list[folly::to_underlying(T::value)]>;

  template<class T>
  using __fbthrift_type_tag = ::apache::thrift::detail::at<__fbthrift_reflection_type_tags, T::value>;

  template<class T>
  using __fbthrift_ident = ::apache::thrift::detail::at<__fbthrift_reflection_ident_list, T::value>;

  template<class T> using __fbthrift_ordinal = ::apache::thrift::type::ordinal_tag<
    ::apache::thrift::detail::getFieldOrdinal<T,
                                              __fbthrift_reflection_ident_list,
                                              __fbthrift_reflection_type_tags>(
      __fbthrift_reflection_field_id_list
    )
  >;
  void __fbthrift_clear();
  void __fbthrift_clear_terse_fields();
  bool __fbthrift_is_empty() const;

 public:
  using __fbthrift_cpp2_type = SimpleStruct;
  static constexpr bool __fbthrift_cpp2_is_union =
    false;
  static constexpr bool __fbthrift_cpp2_uses_op_encode =
    false;


 public:

  SimpleStruct();

  // FragileConstructor for use in initialization lists only.
  [[deprecated("This constructor is deprecated")]]
  SimpleStruct(apache::thrift::FragileConstructor, bool is_on__arg, ::std::int8_t tiny_int__arg, ::std::int16_t small_int__arg, ::std::int32_t nice_sized_int__arg, ::std::int64_t big_int__arg, double real__arg, float smaller_real__arg, ::std::unordered_map<::std::int32_t, ::std::int32_t> something__arg, ::std::int16_t hidden_field__arg);

  SimpleStruct(SimpleStruct&&) noexcept;

  SimpleStruct(const SimpleStruct& src);


  SimpleStruct& operator=(SimpleStruct&&) noexcept;
  SimpleStruct& operator=(const SimpleStruct& src);

  ~SimpleStruct();

 private:
  bool __fbthrift_field_is_on;
 private:
  ::std::int8_t __fbthrift_field_tiny_int;
 private:
  ::std::int16_t __fbthrift_field_small_int;
 private:
  ::std::int32_t __fbthrift_field_nice_sized_int;
 private:
  ::std::int64_t __fbthrift_field_big_int;
 private:
  double __fbthrift_field_real;
 private:
  float __fbthrift_field_smaller_real;
 private:
  ::std::unordered_map<::std::int32_t, ::std::int32_t> __fbthrift_field_something;
 private:
  ::std::int16_t __fbthrift_field_hidden_field;
 private:
  apache::thrift::detail::isset_bitset<9, apache::thrift::detail::IssetBitsetOption::Unpacked> __isset;

 public:

  bool operator==(const SimpleStruct&) const;
  bool operator<(const SimpleStruct&) const;

  /** Glean { "field": "is_on" } */
  template <typename..., typename T = bool>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> is_on_ref() const& {
    return {this->__fbthrift_field_is_on, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "is_on" } */
  template <typename..., typename T = bool>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> is_on_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_is_on), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "is_on" } */
  template <typename..., typename T = bool>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> is_on_ref() & {
    return {this->__fbthrift_field_is_on, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "is_on" } */
  template <typename..., typename T = bool>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> is_on_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_is_on), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "is_on" } */
  template <typename..., typename T = bool>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> is_on() const& {
    return {this->__fbthrift_field_is_on, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "is_on" } */
  template <typename..., typename T = bool>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> is_on() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_is_on), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "is_on" } */
  template <typename..., typename T = bool>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> is_on() & {
    return {this->__fbthrift_field_is_on, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "is_on" } */
  template <typename..., typename T = bool>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> is_on() && {
    return {static_cast<T&&>(this->__fbthrift_field_is_on), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "tiny_int" } */
  template <typename..., typename T = ::std::int8_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> tiny_int_ref() const& {
    return {this->__fbthrift_field_tiny_int, __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "tiny_int" } */
  template <typename..., typename T = ::std::int8_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> tiny_int_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_tiny_int), __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "tiny_int" } */
  template <typename..., typename T = ::std::int8_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> tiny_int_ref() & {
    return {this->__fbthrift_field_tiny_int, __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "tiny_int" } */
  template <typename..., typename T = ::std::int8_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> tiny_int_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_tiny_int), __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "tiny_int" } */
  template <typename..., typename T = ::std::int8_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> tiny_int() const& {
    return {this->__fbthrift_field_tiny_int, __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "tiny_int" } */
  template <typename..., typename T = ::std::int8_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> tiny_int() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_tiny_int), __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "tiny_int" } */
  template <typename..., typename T = ::std::int8_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> tiny_int() & {
    return {this->__fbthrift_field_tiny_int, __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "tiny_int" } */
  template <typename..., typename T = ::std::int8_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> tiny_int() && {
    return {static_cast<T&&>(this->__fbthrift_field_tiny_int), __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "small_int" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> small_int_ref() const& {
    return {this->__fbthrift_field_small_int, __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "small_int" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> small_int_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_small_int), __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "small_int" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> small_int_ref() & {
    return {this->__fbthrift_field_small_int, __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "small_int" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> small_int_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_small_int), __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "small_int" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> small_int() const& {
    return {this->__fbthrift_field_small_int, __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "small_int" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> small_int() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_small_int), __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "small_int" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> small_int() & {
    return {this->__fbthrift_field_small_int, __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "small_int" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> small_int() && {
    return {static_cast<T&&>(this->__fbthrift_field_small_int), __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "nice_sized_int" } */
  template <typename..., typename T = ::std::int32_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> nice_sized_int_ref() const& {
    return {this->__fbthrift_field_nice_sized_int, __isset.at(3), __isset.bit(3)};
  }

  /** Glean { "field": "nice_sized_int" } */
  template <typename..., typename T = ::std::int32_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> nice_sized_int_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_nice_sized_int), __isset.at(3), __isset.bit(3)};
  }

  /** Glean { "field": "nice_sized_int" } */
  template <typename..., typename T = ::std::int32_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> nice_sized_int_ref() & {
    return {this->__fbthrift_field_nice_sized_int, __isset.at(3), __isset.bit(3)};
  }

  /** Glean { "field": "nice_sized_int" } */
  template <typename..., typename T = ::std::int32_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> nice_sized_int_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_nice_sized_int), __isset.at(3), __isset.bit(3)};
  }

  /** Glean { "field": "nice_sized_int" } */
  template <typename..., typename T = ::std::int32_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> nice_sized_int() const& {
    return {this->__fbthrift_field_nice_sized_int, __isset.at(3), __isset.bit(3)};
  }

  /** Glean { "field": "nice_sized_int" } */
  template <typename..., typename T = ::std::int32_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> nice_sized_int() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_nice_sized_int), __isset.at(3), __isset.bit(3)};
  }

  /** Glean { "field": "nice_sized_int" } */
  template <typename..., typename T = ::std::int32_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> nice_sized_int() & {
    return {this->__fbthrift_field_nice_sized_int, __isset.at(3), __isset.bit(3)};
  }

  /** Glean { "field": "nice_sized_int" } */
  template <typename..., typename T = ::std::int32_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> nice_sized_int() && {
    return {static_cast<T&&>(this->__fbthrift_field_nice_sized_int), __isset.at(3), __isset.bit(3)};
  }

  /** Glean { "field": "big_int" } */
  template <typename..., typename T = ::std::int64_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> big_int_ref() const& {
    return {this->__fbthrift_field_big_int, __isset.at(4), __isset.bit(4)};
  }

  /** Glean { "field": "big_int" } */
  template <typename..., typename T = ::std::int64_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> big_int_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_big_int), __isset.at(4), __isset.bit(4)};
  }

  /** Glean { "field": "big_int" } */
  template <typename..., typename T = ::std::int64_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> big_int_ref() & {
    return {this->__fbthrift_field_big_int, __isset.at(4), __isset.bit(4)};
  }

  /** Glean { "field": "big_int" } */
  template <typename..., typename T = ::std::int64_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> big_int_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_big_int), __isset.at(4), __isset.bit(4)};
  }

  /** Glean { "field": "big_int" } */
  template <typename..., typename T = ::std::int64_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> big_int() const& {
    return {this->__fbthrift_field_big_int, __isset.at(4), __isset.bit(4)};
  }

  /** Glean { "field": "big_int" } */
  template <typename..., typename T = ::std::int64_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> big_int() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_big_int), __isset.at(4), __isset.bit(4)};
  }

  /** Glean { "field": "big_int" } */
  template <typename..., typename T = ::std::int64_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> big_int() & {
    return {this->__fbthrift_field_big_int, __isset.at(4), __isset.bit(4)};
  }

  /** Glean { "field": "big_int" } */
  template <typename..., typename T = ::std::int64_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> big_int() && {
    return {static_cast<T&&>(this->__fbthrift_field_big_int), __isset.at(4), __isset.bit(4)};
  }

  /** Glean { "field": "real" } */
  template <typename..., typename T = double>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> real_ref() const& {
    return {this->__fbthrift_field_real, __isset.at(5), __isset.bit(5)};
  }

  /** Glean { "field": "real" } */
  template <typename..., typename T = double>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> real_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_real), __isset.at(5), __isset.bit(5)};
  }

  /** Glean { "field": "real" } */
  template <typename..., typename T = double>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> real_ref() & {
    return {this->__fbthrift_field_real, __isset.at(5), __isset.bit(5)};
  }

  /** Glean { "field": "real" } */
  template <typename..., typename T = double>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> real_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_real), __isset.at(5), __isset.bit(5)};
  }

  /** Glean { "field": "real" } */
  template <typename..., typename T = double>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> real() const& {
    return {this->__fbthrift_field_real, __isset.at(5), __isset.bit(5)};
  }

  /** Glean { "field": "real" } */
  template <typename..., typename T = double>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> real() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_real), __isset.at(5), __isset.bit(5)};
  }

  /** Glean { "field": "real" } */
  template <typename..., typename T = double>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> real() & {
    return {this->__fbthrift_field_real, __isset.at(5), __isset.bit(5)};
  }

  /** Glean { "field": "real" } */
  template <typename..., typename T = double>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> real() && {
    return {static_cast<T&&>(this->__fbthrift_field_real), __isset.at(5), __isset.bit(5)};
  }

  /** Glean { "field": "smaller_real" } */
  template <typename..., typename T = float>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> smaller_real_ref() const& {
    return {this->__fbthrift_field_smaller_real, __isset.at(6), __isset.bit(6)};
  }

  /** Glean { "field": "smaller_real" } */
  template <typename..., typename T = float>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> smaller_real_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_smaller_real), __isset.at(6), __isset.bit(6)};
  }

  /** Glean { "field": "smaller_real" } */
  template <typename..., typename T = float>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> smaller_real_ref() & {
    return {this->__fbthrift_field_smaller_real, __isset.at(6), __isset.bit(6)};
  }

  /** Glean { "field": "smaller_real" } */
  template <typename..., typename T = float>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> smaller_real_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_smaller_real), __isset.at(6), __isset.bit(6)};
  }

  /** Glean { "field": "smaller_real" } */
  template <typename..., typename T = float>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> smaller_real() const& {
    return {this->__fbthrift_field_smaller_real, __isset.at(6), __isset.bit(6)};
  }

  /** Glean { "field": "smaller_real" } */
  template <typename..., typename T = float>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> smaller_real() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_smaller_real), __isset.at(6), __isset.bit(6)};
  }

  /** Glean { "field": "smaller_real" } */
  template <typename..., typename T = float>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> smaller_real() & {
    return {this->__fbthrift_field_smaller_real, __isset.at(6), __isset.bit(6)};
  }

  /** Glean { "field": "smaller_real" } */
  template <typename..., typename T = float>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> smaller_real() && {
    return {static_cast<T&&>(this->__fbthrift_field_smaller_real), __isset.at(6), __isset.bit(6)};
  }

  /** Glean { "field": "something" } */
  template <typename..., typename T = ::std::unordered_map<::std::int32_t, ::std::int32_t>>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> something_ref() const& {
    return {this->__fbthrift_field_something, __isset.at(7), __isset.bit(7)};
  }

  /** Glean { "field": "something" } */
  template <typename..., typename T = ::std::unordered_map<::std::int32_t, ::std::int32_t>>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> something_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_something), __isset.at(7), __isset.bit(7)};
  }

  /** Glean { "field": "something" } */
  template <typename..., typename T = ::std::unordered_map<::std::int32_t, ::std::int32_t>>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> something_ref() & {
    return {this->__fbthrift_field_something, __isset.at(7), __isset.bit(7)};
  }

  /** Glean { "field": "something" } */
  template <typename..., typename T = ::std::unordered_map<::std::int32_t, ::std::int32_t>>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> something_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_something), __isset.at(7), __isset.bit(7)};
  }

  /** Glean { "field": "something" } */
  template <typename..., typename T = ::std::unordered_map<::std::int32_t, ::std::int32_t>>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> something() const& {
    return {this->__fbthrift_field_something, __isset.at(7), __isset.bit(7)};
  }

  /** Glean { "field": "something" } */
  template <typename..., typename T = ::std::unordered_map<::std::int32_t, ::std::int32_t>>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> something() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_something), __isset.at(7), __isset.bit(7)};
  }

  /** Glean { "field": "something" } */
  template <typename..., typename T = ::std::unordered_map<::std::int32_t, ::std::int32_t>>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> something() & {
    return {this->__fbthrift_field_something, __isset.at(7), __isset.bit(7)};
  }

  /** Glean { "field": "something" } */
  template <typename..., typename T = ::std::unordered_map<::std::int32_t, ::std::int32_t>>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> something() && {
    return {static_cast<T&&>(this->__fbthrift_field_something), __isset.at(7), __isset.bit(7)};
  }

  /** Glean { "field": "hidden_field" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> hidden_field_ref() const& {
    return {this->__fbthrift_field_hidden_field, __isset.at(8), __isset.bit(8)};
  }

  /** Glean { "field": "hidden_field" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> hidden_field_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_hidden_field), __isset.at(8), __isset.bit(8)};
  }

  /** Glean { "field": "hidden_field" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> hidden_field_ref() & {
    return {this->__fbthrift_field_hidden_field, __isset.at(8), __isset.bit(8)};
  }

  /** Glean { "field": "hidden_field" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> hidden_field_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_hidden_field), __isset.at(8), __isset.bit(8)};
  }

  /** Glean { "field": "hidden_field" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> hidden_field() const& {
    return {this->__fbthrift_field_hidden_field, __isset.at(8), __isset.bit(8)};
  }

  /** Glean { "field": "hidden_field" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> hidden_field() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_hidden_field), __isset.at(8), __isset.bit(8)};
  }

  /** Glean { "field": "hidden_field" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> hidden_field() & {
    return {this->__fbthrift_field_hidden_field, __isset.at(8), __isset.bit(8)};
  }

  /** Glean { "field": "hidden_field" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> hidden_field() && {
    return {static_cast<T&&>(this->__fbthrift_field_hidden_field), __isset.at(8), __isset.bit(8)};
  }

  /** Glean { "field": "is_on" } */
  bool get_is_on() const {
    return __fbthrift_field_is_on;
  }

  /** Glean { "field": "is_on" } */
  [[deprecated("Use `FOO.is_on() = BAR;` instead of `FOO.set_is_on(BAR);`")]]
  bool& set_is_on(bool is_on_) {
    is_on_ref() = is_on_;
    return __fbthrift_field_is_on;
  }

  /** Glean { "field": "tiny_int" } */
  ::std::int8_t get_tiny_int() const {
    return __fbthrift_field_tiny_int;
  }

  /** Glean { "field": "tiny_int" } */
  [[deprecated("Use `FOO.tiny_int() = BAR;` instead of `FOO.set_tiny_int(BAR);`")]]
  ::std::int8_t& set_tiny_int(::std::int8_t tiny_int_) {
    tiny_int_ref() = tiny_int_;
    return __fbthrift_field_tiny_int;
  }

  /** Glean { "field": "small_int" } */
  ::std::int16_t get_small_int() const {
    return __fbthrift_field_small_int;
  }

  /** Glean { "field": "small_int" } */
  [[deprecated("Use `FOO.small_int() = BAR;` instead of `FOO.set_small_int(BAR);`")]]
  ::std::int16_t& set_small_int(::std::int16_t small_int_) {
    small_int_ref() = small_int_;
    return __fbthrift_field_small_int;
  }

  /** Glean { "field": "nice_sized_int" } */
  ::std::int32_t get_nice_sized_int() const {
    return __fbthrift_field_nice_sized_int;
  }

  /** Glean { "field": "nice_sized_int" } */
  [[deprecated("Use `FOO.nice_sized_int() = BAR;` instead of `FOO.set_nice_sized_int(BAR);`")]]
  ::std::int32_t& set_nice_sized_int(::std::int32_t nice_sized_int_) {
    nice_sized_int_ref() = nice_sized_int_;
    return __fbthrift_field_nice_sized_int;
  }

  /** Glean { "field": "big_int" } */
  ::std::int64_t get_big_int() const {
    return __fbthrift_field_big_int;
  }

  /** Glean { "field": "big_int" } */
  [[deprecated("Use `FOO.big_int() = BAR;` instead of `FOO.set_big_int(BAR);`")]]
  ::std::int64_t& set_big_int(::std::int64_t big_int_) {
    big_int_ref() = big_int_;
    return __fbthrift_field_big_int;
  }

  /** Glean { "field": "real" } */
  double get_real() const {
    return __fbthrift_field_real;
  }

  /** Glean { "field": "real" } */
  [[deprecated("Use `FOO.real() = BAR;` instead of `FOO.set_real(BAR);`")]]
  double& set_real(double real_) {
    real_ref() = real_;
    return __fbthrift_field_real;
  }

  /** Glean { "field": "smaller_real" } */
  float get_smaller_real() const {
    return __fbthrift_field_smaller_real;
  }

  /** Glean { "field": "smaller_real" } */
  [[deprecated("Use `FOO.smaller_real() = BAR;` instead of `FOO.set_smaller_real(BAR);`")]]
  float& set_smaller_real(float smaller_real_) {
    smaller_real_ref() = smaller_real_;
    return __fbthrift_field_smaller_real;
  }
  /** Glean { "field": "something" } */
  const ::std::unordered_map<::std::int32_t, ::std::int32_t>& get_something() const&;
  /** Glean { "field": "something" } */
  ::std::unordered_map<::std::int32_t, ::std::int32_t> get_something() &&;

  /** Glean { "field": "something" } */
  template <typename T_SimpleStruct_something_struct_setter = ::std::unordered_map<::std::int32_t, ::std::int32_t>>
  [[deprecated("Use `FOO.something() = BAR;` instead of `FOO.set_something(BAR);`")]]
  ::std::unordered_map<::std::int32_t, ::std::int32_t>& set_something(T_SimpleStruct_something_struct_setter&& something_) {
    something_ref() = std::forward<T_SimpleStruct_something_struct_setter>(something_);
    return __fbthrift_field_something;
  }

  /** Glean { "field": "hidden_field" } */
  ::std::int16_t get_hidden_field() const {
    return __fbthrift_field_hidden_field;
  }

  /** Glean { "field": "hidden_field" } */
  [[deprecated("Use `FOO.hidden_field() = BAR;` instead of `FOO.set_hidden_field(BAR);`")]]
  ::std::int16_t& set_hidden_field(::std::int16_t hidden_field_) {
    hidden_field_ref() = hidden_field_;
    return __fbthrift_field_hidden_field;
  }

  template <class Protocol_>
  unsigned long read(Protocol_* iprot);
  template <class Protocol_>
  uint32_t serializedSize(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t serializedSizeZC(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t write(Protocol_* prot_) const;

 private:
  template <class Protocol_>
  void readNoXfer(Protocol_* iprot);

  friend class ::apache::thrift::Cpp2Ops<SimpleStruct>;
  friend void swap(SimpleStruct& a, SimpleStruct& b);
};

template <class Protocol_>
unsigned long SimpleStruct::read(Protocol_* iprot) {
  auto _xferStart = iprot->getCursorPosition();
  readNoXfer(iprot);
  return iprot->getCursorPosition() - _xferStart;
}

/** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "name": "AdaptedTypeDef", "kind": "typedef" } */
typedef ::apache::thrift::adapt_detail::adapted_t<Adapter, ::py3::simple::SimpleStruct> AdaptedTypeDef;
/** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "name": "HiddenTypeDef", "kind": "typedef" } */
typedef ::py3::simple::SimpleStruct HiddenTypeDef;

namespace detail {
/** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "name": "AdaptedUnion", "kind": "union" } */
class AdaptedUnion final  {
 private:
  friend struct ::apache::thrift::detail::st::struct_private_access;
  template<class> friend struct ::apache::thrift::detail::invoke_reffer;

  //  used by a static_assert in the corresponding source
  static constexpr bool __fbthrift_cpp2_gen_json = false;
  static constexpr bool __fbthrift_cpp2_is_runtime_annotation = false;
  static std::string_view __fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord);
  static std::string_view __fbthrift_get_class_name();
  using __fbthrift_reflection_ident_list = folly::tag_t<
    ::apache::thrift::ident::best
  >;

  static constexpr std::int16_t __fbthrift_reflection_field_id_list[] = {0,1};
  using __fbthrift_reflection_type_tags = folly::tag_t<
    ::apache::thrift::type::i16_t
  >;

  static constexpr std::size_t __fbthrift_field_size_v = 1;

  template<class T>
  using __fbthrift_id = ::apache::thrift::type::field_id<__fbthrift_reflection_field_id_list[folly::to_underlying(T::value)]>;

  template<class T>
  using __fbthrift_type_tag = ::apache::thrift::detail::at<__fbthrift_reflection_type_tags, T::value>;

  template<class T>
  using __fbthrift_ident = ::apache::thrift::detail::at<__fbthrift_reflection_ident_list, T::value>;

  template<class T> using __fbthrift_ordinal = ::apache::thrift::type::ordinal_tag<
    ::apache::thrift::detail::getFieldOrdinal<T,
                                              __fbthrift_reflection_ident_list,
                                              __fbthrift_reflection_type_tags>(
      __fbthrift_reflection_field_id_list
    )
  >;
  void __fbthrift_clear();
  void __fbthrift_destruct();
  bool __fbthrift_is_empty() const;

 public:
  using __fbthrift_cpp2_type = AdaptedUnion;
  static constexpr bool __fbthrift_cpp2_is_union =
    true;
  static constexpr bool __fbthrift_cpp2_uses_op_encode =
    false;


 public:
  enum Type : int {
    __EMPTY__ = 0,
    best = 1,
  } ;

  AdaptedUnion()
      : type_(folly::to_underlying(Type::__EMPTY__)) {}

  AdaptedUnion(AdaptedUnion&& rhs) noexcept
      : type_(folly::to_underlying(Type::__EMPTY__)) {
    if (this == &rhs) { return; }
    switch (rhs.getType()) {
      case Type::__EMPTY__:
      {
        return;
      }
      case Type::best:
      {
        set_best(std::move(rhs.value_.best));
        break;
      }
      default:
      {
        assert(false);
        break;
      }
    }
    apache::thrift::clear(rhs);
  }

  AdaptedUnion(const AdaptedUnion& rhs);

  AdaptedUnion& operator=(AdaptedUnion&& rhs) noexcept {
    if (this == &rhs) { return *this; }
    switch (rhs.getType()) {
      case Type::__EMPTY__:
      {
        __fbthrift_clear();
        return *this;
      }
      case Type::best:
      {
        set_best(std::move(rhs.value_.best));
        break;
      }
      default:
      {
        assert(false);
        __fbthrift_clear();
      }
    }
    apache::thrift::clear(rhs);
    return *this;
  }

  AdaptedUnion& operator=(const AdaptedUnion& rhs);


  union storage_type {
    ::std::int16_t best;

  } ;

  bool operator==(const AdaptedUnion&) const;
  bool operator<(const AdaptedUnion&) const;

  /** Glean { "field": "best" } */
  template <typename... A, std::enable_if_t<!sizeof...(A), int> = 0>
  ::std::int16_t& set_best(::std::int16_t t = ::std::int16_t()) {
    using T0 = ::std::int16_t;
    using T = folly::type_t<T0, A...>;
    __fbthrift_clear();
    type_ = folly::to_underlying(Type::best);
    ::new (std::addressof(value_.best)) T(t);
    return value_.best;
  }


  ::std::int16_t const& get_best() const {
    if (getType() != Type::best) {
      ::apache::thrift::detail::throw_on_bad_union_field_access();
    }
    return value_.best;
  }

  ::std::int16_t& mutable_best() {
    assert(getType() == Type::best);
    return value_.best;
  }

  template <typename..., typename T = ::std::int16_t>
  T move_best() {
    assert(getType() == Type::best);
    return std::move(value_.best);
  }

  /** Glean { "field": "best" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::union_field_ref<const T&> best_ref() const& {
    return {value_.best, type_, folly::to_underlying(Type::best), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for<decltype(*this)>};
  }

  /** Glean { "field": "best" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::union_field_ref<const T&&> best_ref() const&& {
    return {std::move(value_.best), type_, folly::to_underlying(Type::best), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for<decltype(*this)>};
  }

  /** Glean { "field": "best" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::union_field_ref<T&> best_ref() & {
    return {value_.best, type_, folly::to_underlying(Type::best), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for<decltype(*this)>};
  }

  /** Glean { "field": "best" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::union_field_ref<T&&> best_ref() && {
    return {std::move(value_.best), type_, folly::to_underlying(Type::best), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for<decltype(*this)>};
  }
  Type getType() const { return static_cast<Type>(type_); }

  template <class Protocol_>
  unsigned long read(Protocol_* iprot);
  template <class Protocol_>
  uint32_t serializedSize(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t serializedSizeZC(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t write(Protocol_* prot_) const;
 protected:
  storage_type value_;
  std::underlying_type_t<Type> type_;

 private:
  template <class Protocol_>
  void readNoXfer(Protocol_* iprot);

  friend class ::apache::thrift::Cpp2Ops<AdaptedUnion>;
  friend void swap(AdaptedUnion& a, AdaptedUnion& b);
};

template <class Protocol_>
unsigned long AdaptedUnion::read(Protocol_* iprot) {
  auto _xferStart = iprot->getCursorPosition();
  readNoXfer(iprot);
  return iprot->getCursorPosition() - _xferStart;
}
} // namespace detail

using AdaptedUnion = ::apache::thrift::adapt_detail::adapted_t<Adapter, ::py3::simple::detail::AdaptedUnion>;

/** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "name": "ImplicitlyHiddenTypeDef", "kind": "typedef" } */
typedef ::py3::simple::AdaptedUnion ImplicitlyHiddenTypeDef;
/** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "name": "foo_bar", "kind": "typedef" } */
typedef foo::Bar foo_bar;

/** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "name": "SimpleException", "kind": "exception" } */
class FOLLY_EXPORT SimpleException : public virtual apache::thrift::TException {
 private:
  friend struct ::apache::thrift::detail::st::struct_private_access;
  template<class> friend struct ::apache::thrift::detail::invoke_reffer;

  //  used by a static_assert in the corresponding source
  static constexpr bool __fbthrift_cpp2_gen_json = false;
  static constexpr bool __fbthrift_cpp2_is_runtime_annotation = false;
  static std::string_view __fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord);
  static std::string_view __fbthrift_get_class_name();
  using __fbthrift_reflection_ident_list = folly::tag_t<
    ::apache::thrift::ident::err_code
  >;

  static constexpr std::int16_t __fbthrift_reflection_field_id_list[] = {0,1};
  using __fbthrift_reflection_type_tags = folly::tag_t<
    ::apache::thrift::type::i16_t
  >;

  static constexpr std::size_t __fbthrift_field_size_v = 1;

  template<class T>
  using __fbthrift_id = ::apache::thrift::type::field_id<__fbthrift_reflection_field_id_list[folly::to_underlying(T::value)]>;

  template<class T>
  using __fbthrift_type_tag = ::apache::thrift::detail::at<__fbthrift_reflection_type_tags, T::value>;

  template<class T>
  using __fbthrift_ident = ::apache::thrift::detail::at<__fbthrift_reflection_ident_list, T::value>;

  template<class T> using __fbthrift_ordinal = ::apache::thrift::type::ordinal_tag<
    ::apache::thrift::detail::getFieldOrdinal<T,
                                              __fbthrift_reflection_ident_list,
                                              __fbthrift_reflection_type_tags>(
      __fbthrift_reflection_field_id_list
    )
  >;
  void __fbthrift_clear();
  void __fbthrift_clear_terse_fields();
  bool __fbthrift_is_empty() const;
  static constexpr ::apache::thrift::ExceptionKind __fbthrift_cpp2_gen_exception_kind =
         ::apache::thrift::ExceptionKind::UNSPECIFIED;
  static constexpr ::apache::thrift::ExceptionSafety __fbthrift_cpp2_gen_exception_safety =
         ::apache::thrift::ExceptionSafety::UNSPECIFIED;
  static constexpr ::apache::thrift::ExceptionBlame __fbthrift_cpp2_gen_exception_blame =
         ::apache::thrift::ExceptionBlame::UNSPECIFIED;

 public:
  using __fbthrift_cpp2_type = SimpleException;
  static constexpr bool __fbthrift_cpp2_is_union =
    false;
  static constexpr bool __fbthrift_cpp2_uses_op_encode =
    false;


 public:

  SimpleException();

  // FragileConstructor for use in initialization lists only.
  [[deprecated("This constructor is deprecated")]]
  SimpleException(apache::thrift::FragileConstructor, ::std::int16_t err_code__arg);

  SimpleException(SimpleException&&) noexcept;

  SimpleException(const SimpleException& src);


  SimpleException& operator=(SimpleException&&) noexcept;
  SimpleException& operator=(const SimpleException& src);

  ~SimpleException() override;

 private:
  ::std::int16_t __fbthrift_field_err_code;
 private:
  apache::thrift::detail::isset_bitset<1, apache::thrift::detail::IssetBitsetOption::Unpacked> __isset;

 public:

  bool operator==(const SimpleException&) const;
  bool operator<(const SimpleException&) const;

  /** Glean { "field": "err_code" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> err_code_ref() const& {
    return {this->__fbthrift_field_err_code, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "err_code" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> err_code_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_err_code), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "err_code" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> err_code_ref() & {
    return {this->__fbthrift_field_err_code, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "err_code" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> err_code_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_err_code), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "err_code" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> err_code() const& {
    return {this->__fbthrift_field_err_code, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "err_code" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> err_code() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_err_code), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "err_code" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> err_code() & {
    return {this->__fbthrift_field_err_code, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "err_code" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> err_code() && {
    return {static_cast<T&&>(this->__fbthrift_field_err_code), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "err_code" } */
  ::std::int16_t get_err_code() const {
    return __fbthrift_field_err_code;
  }

  /** Glean { "field": "err_code" } */
  [[deprecated("Use `FOO.err_code() = BAR;` instead of `FOO.set_err_code(BAR);`")]]
  ::std::int16_t& set_err_code(::std::int16_t err_code_) {
    err_code_ref() = err_code_;
    return __fbthrift_field_err_code;
  }

  template <class Protocol_>
  unsigned long read(Protocol_* iprot);
  template <class Protocol_>
  uint32_t serializedSize(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t serializedSizeZC(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t write(Protocol_* prot_) const;

  const char* what() const noexcept override {
    return "::py3::simple::SimpleException";
  }

 private:
  template <class Protocol_>
  void readNoXfer(Protocol_* iprot);

  friend class ::apache::thrift::Cpp2Ops<SimpleException>;
  friend void swap(SimpleException& a, SimpleException& b);
};

template <class Protocol_>
unsigned long SimpleException::read(Protocol_* iprot) {
  auto _xferStart = iprot->getCursorPosition();
  readNoXfer(iprot);
  return iprot->getCursorPosition() - _xferStart;
}


/** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "name": "OptionalRefStruct", "kind": "struct" } */
class OptionalRefStruct final  {
 private:
  friend struct ::apache::thrift::detail::st::struct_private_access;
  template<class> friend struct ::apache::thrift::detail::invoke_reffer;

  //  used by a static_assert in the corresponding source
  static constexpr bool __fbthrift_cpp2_gen_json = false;
  static constexpr bool __fbthrift_cpp2_is_runtime_annotation = false;
  static std::string_view __fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord);
  static std::string_view __fbthrift_get_class_name();
  using __fbthrift_reflection_ident_list = folly::tag_t<
    ::apache::thrift::ident::optional_blob
  >;

  static constexpr std::int16_t __fbthrift_reflection_field_id_list[] = {0,1};
  using __fbthrift_reflection_type_tags = folly::tag_t<
    ::apache::thrift::type::cpp_type<std::unique_ptr<folly::IOBuf>, ::apache::thrift::type::binary_t>
  >;

  static constexpr std::size_t __fbthrift_field_size_v = 1;

  template<class T>
  using __fbthrift_id = ::apache::thrift::type::field_id<__fbthrift_reflection_field_id_list[folly::to_underlying(T::value)]>;

  template<class T>
  using __fbthrift_type_tag = ::apache::thrift::detail::at<__fbthrift_reflection_type_tags, T::value>;

  template<class T>
  using __fbthrift_ident = ::apache::thrift::detail::at<__fbthrift_reflection_ident_list, T::value>;

  template<class T> using __fbthrift_ordinal = ::apache::thrift::type::ordinal_tag<
    ::apache::thrift::detail::getFieldOrdinal<T,
                                              __fbthrift_reflection_ident_list,
                                              __fbthrift_reflection_type_tags>(
      __fbthrift_reflection_field_id_list
    )
  >;
  void __fbthrift_clear();
  void __fbthrift_clear_terse_fields();
  bool __fbthrift_is_empty() const;

 public:
  using __fbthrift_cpp2_type = OptionalRefStruct;
  static constexpr bool __fbthrift_cpp2_is_union =
    false;
  static constexpr bool __fbthrift_cpp2_uses_op_encode =
    false;


 public:

  OptionalRefStruct();

  // FragileConstructor for use in initialization lists only.
  [[deprecated("This constructor is deprecated")]]
  OptionalRefStruct(apache::thrift::FragileConstructor, ::py3::simple::IOBufPtr optional_blob__arg);

  OptionalRefStruct(OptionalRefStruct&&) noexcept;
  OptionalRefStruct(const OptionalRefStruct& src);


  OptionalRefStruct& operator=(OptionalRefStruct&&) noexcept;
  OptionalRefStruct& operator=(const OptionalRefStruct& src);

  ~OptionalRefStruct();

 private:
  ::py3::simple::IOBufPtr __fbthrift_field_optional_blob;
 private:
  apache::thrift::detail::isset_bitset<1, apache::thrift::detail::IssetBitsetOption::Unpacked> __isset;

 public:

  bool operator==(const OptionalRefStruct&) const;
  bool operator<(const OptionalRefStruct&) const;

  /** Glean { "field": "optional_blob" } */
  template <typename..., typename T = ::py3::simple::IOBufPtr>
  FOLLY_ERASE ::apache::thrift::optional_field_ref<const T&> optional_blob_ref() const& {
    return {this->__fbthrift_field_optional_blob, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "optional_blob" } */
  template <typename..., typename T = ::py3::simple::IOBufPtr>
  FOLLY_ERASE ::apache::thrift::optional_field_ref<const T&&> optional_blob_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_optional_blob), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "optional_blob" } */
  template <typename..., typename T = ::py3::simple::IOBufPtr>
  FOLLY_ERASE ::apache::thrift::optional_field_ref<T&> optional_blob_ref() & {
    return {this->__fbthrift_field_optional_blob, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "optional_blob" } */
  template <typename..., typename T = ::py3::simple::IOBufPtr>
  FOLLY_ERASE ::apache::thrift::optional_field_ref<T&&> optional_blob_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_optional_blob), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "optional_blob" } */
  template <typename..., typename T = ::py3::simple::IOBufPtr>
  FOLLY_ERASE ::apache::thrift::optional_field_ref<const T&> optional_blob() const& {
    return {this->__fbthrift_field_optional_blob, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "optional_blob" } */
  template <typename..., typename T = ::py3::simple::IOBufPtr>
  FOLLY_ERASE ::apache::thrift::optional_field_ref<const T&&> optional_blob() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_optional_blob), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "optional_blob" } */
  template <typename..., typename T = ::py3::simple::IOBufPtr>
  FOLLY_ERASE ::apache::thrift::optional_field_ref<T&> optional_blob() & {
    return {this->__fbthrift_field_optional_blob, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "optional_blob" } */
  template <typename..., typename T = ::py3::simple::IOBufPtr>
  FOLLY_ERASE ::apache::thrift::optional_field_ref<T&&> optional_blob() && {
    return {static_cast<T&&>(this->__fbthrift_field_optional_blob), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "optional_blob" } */
  const ::py3::simple::IOBufPtr* get_optional_blob() const& {
    return optional_blob_ref() ? std::addressof(__fbthrift_field_optional_blob) : nullptr;
  }

  /** Glean { "field": "optional_blob" } */
  ::py3::simple::IOBufPtr* get_optional_blob() & {
    return optional_blob_ref() ? std::addressof(__fbthrift_field_optional_blob) : nullptr;
  }
  /** Glean { "field": "optional_blob" } */
  ::py3::simple::IOBufPtr* get_optional_blob() && = delete;

  /** Glean { "field": "optional_blob" } */
  template <typename T_OptionalRefStruct_optional_blob_struct_setter = ::py3::simple::IOBufPtr>
  [[deprecated("Use `FOO.optional_blob() = BAR;` instead of `FOO.set_optional_blob(BAR);`")]]
  ::py3::simple::IOBufPtr& set_optional_blob(T_OptionalRefStruct_optional_blob_struct_setter&& optional_blob_) {
    optional_blob_ref() = std::forward<T_OptionalRefStruct_optional_blob_struct_setter>(optional_blob_);
    return __fbthrift_field_optional_blob;
  }

  template <class Protocol_>
  unsigned long read(Protocol_* iprot);
  template <class Protocol_>
  uint32_t serializedSize(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t serializedSizeZC(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t write(Protocol_* prot_) const;

 private:
  template <class Protocol_>
  void readNoXfer(Protocol_* iprot);

  friend class ::apache::thrift::Cpp2Ops<OptionalRefStruct>;
  friend void swap(OptionalRefStruct& a, OptionalRefStruct& b);
};

template <class Protocol_>
unsigned long OptionalRefStruct::read(Protocol_* iprot) {
  auto _xferStart = iprot->getCursorPosition();
  readNoXfer(iprot);
  return iprot->getCursorPosition() - _xferStart;
}


/** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "name": "HiddenTypeFieldsStruct", "kind": "struct" } */
class HiddenTypeFieldsStruct final  {
 private:
  friend struct ::apache::thrift::detail::st::struct_private_access;
  template<class> friend struct ::apache::thrift::detail::invoke_reffer;

  //  used by a static_assert in the corresponding source
  static constexpr bool __fbthrift_cpp2_gen_json = false;
  static constexpr bool __fbthrift_cpp2_is_runtime_annotation = false;
  static std::string_view __fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord);
  static std::string_view __fbthrift_get_class_name();
  using __fbthrift_reflection_ident_list = folly::tag_t<
    ::apache::thrift::ident::field1,
    ::apache::thrift::ident::field2,
    ::apache::thrift::ident::field3
  >;

  static constexpr std::int16_t __fbthrift_reflection_field_id_list[] = {0,1,2,3};
  using __fbthrift_reflection_type_tags = folly::tag_t<
    ::apache::thrift::type::adapted<Adapter, ::apache::thrift::type::struct_t<::py3::simple::SimpleStruct>>,
    ::apache::thrift::type::list<::apache::thrift::type::adapted<Adapter, ::apache::thrift::type::struct_t<::py3::simple::SimpleStruct>>>,
    ::apache::thrift::type::cpp_type<::std::unordered_map<::std::int32_t, ::py3::simple::AdaptedTypeDef>, ::apache::thrift::type::map<::apache::thrift::type::i32_t, ::apache::thrift::type::adapted<Adapter, ::apache::thrift::type::struct_t<::py3::simple::SimpleStruct>>>>
  >;

  static constexpr std::size_t __fbthrift_field_size_v = 3;

  template<class T>
  using __fbthrift_id = ::apache::thrift::type::field_id<__fbthrift_reflection_field_id_list[folly::to_underlying(T::value)]>;

  template<class T>
  using __fbthrift_type_tag = ::apache::thrift::detail::at<__fbthrift_reflection_type_tags, T::value>;

  template<class T>
  using __fbthrift_ident = ::apache::thrift::detail::at<__fbthrift_reflection_ident_list, T::value>;

  template<class T> using __fbthrift_ordinal = ::apache::thrift::type::ordinal_tag<
    ::apache::thrift::detail::getFieldOrdinal<T,
                                              __fbthrift_reflection_ident_list,
                                              __fbthrift_reflection_type_tags>(
      __fbthrift_reflection_field_id_list
    )
  >;
  void __fbthrift_clear();
  void __fbthrift_clear_terse_fields();
  bool __fbthrift_is_empty() const;

 public:
  using __fbthrift_cpp2_type = HiddenTypeFieldsStruct;
  static constexpr bool __fbthrift_cpp2_is_union =
    false;
  static constexpr bool __fbthrift_cpp2_uses_op_encode =
    true;


 public:

  HiddenTypeFieldsStruct();

  // FragileConstructor for use in initialization lists only.
  [[deprecated("This constructor is deprecated")]]
  HiddenTypeFieldsStruct(apache::thrift::FragileConstructor, ::py3::simple::AdaptedTypeDef field1__arg, ::std::vector<::py3::simple::AdaptedTypeDef> field2__arg, ::std::unordered_map<::std::int32_t, ::py3::simple::AdaptedTypeDef> field3__arg);

  HiddenTypeFieldsStruct(HiddenTypeFieldsStruct&&) noexcept;
  HiddenTypeFieldsStruct(const HiddenTypeFieldsStruct& src);


  HiddenTypeFieldsStruct& operator=(HiddenTypeFieldsStruct&&) noexcept;
  HiddenTypeFieldsStruct& operator=(const HiddenTypeFieldsStruct& src);

  ~HiddenTypeFieldsStruct();

 private:
  ::py3::simple::AdaptedTypeDef __fbthrift_field_field1;
 private:
  ::std::vector<::py3::simple::AdaptedTypeDef> __fbthrift_field_field2;
 private:
  ::std::unordered_map<::std::int32_t, ::py3::simple::AdaptedTypeDef> __fbthrift_field_field3;
 private:
  apache::thrift::detail::isset_bitset<3, apache::thrift::detail::IssetBitsetOption::Unpacked> __isset;

 public:

  bool operator==(const HiddenTypeFieldsStruct&) const;
  bool operator<(const HiddenTypeFieldsStruct&) const;

  /** Glean { "field": "field1" } */
  template <typename..., typename T = ::py3::simple::AdaptedTypeDef>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> field1_ref() const& {
    return {this->__fbthrift_field_field1, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "field1" } */
  template <typename..., typename T = ::py3::simple::AdaptedTypeDef>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> field1_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_field1), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "field1" } */
  template <typename..., typename T = ::py3::simple::AdaptedTypeDef>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> field1_ref() & {
    return {this->__fbthrift_field_field1, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "field1" } */
  template <typename..., typename T = ::py3::simple::AdaptedTypeDef>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> field1_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_field1), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "field1" } */
  template <typename..., typename T = ::py3::simple::AdaptedTypeDef>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> field1() const& {
    return {this->__fbthrift_field_field1, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "field1" } */
  template <typename..., typename T = ::py3::simple::AdaptedTypeDef>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> field1() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_field1), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "field1" } */
  template <typename..., typename T = ::py3::simple::AdaptedTypeDef>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> field1() & {
    return {this->__fbthrift_field_field1, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "field1" } */
  template <typename..., typename T = ::py3::simple::AdaptedTypeDef>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> field1() && {
    return {static_cast<T&&>(this->__fbthrift_field_field1), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "field2" } */
  template <typename..., typename T = ::std::vector<::py3::simple::AdaptedTypeDef>>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> field2_ref() const& {
    return {this->__fbthrift_field_field2, __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "field2" } */
  template <typename..., typename T = ::std::vector<::py3::simple::AdaptedTypeDef>>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> field2_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_field2), __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "field2" } */
  template <typename..., typename T = ::std::vector<::py3::simple::AdaptedTypeDef>>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> field2_ref() & {
    return {this->__fbthrift_field_field2, __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "field2" } */
  template <typename..., typename T = ::std::vector<::py3::simple::AdaptedTypeDef>>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> field2_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_field2), __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "field2" } */
  template <typename..., typename T = ::std::vector<::py3::simple::AdaptedTypeDef>>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> field2() const& {
    return {this->__fbthrift_field_field2, __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "field2" } */
  template <typename..., typename T = ::std::vector<::py3::simple::AdaptedTypeDef>>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> field2() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_field2), __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "field2" } */
  template <typename..., typename T = ::std::vector<::py3::simple::AdaptedTypeDef>>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> field2() & {
    return {this->__fbthrift_field_field2, __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "field2" } */
  template <typename..., typename T = ::std::vector<::py3::simple::AdaptedTypeDef>>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> field2() && {
    return {static_cast<T&&>(this->__fbthrift_field_field2), __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "field3" } */
  template <typename..., typename T = ::std::unordered_map<::std::int32_t, ::py3::simple::AdaptedTypeDef>>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> field3_ref() const& {
    return {this->__fbthrift_field_field3, __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "field3" } */
  template <typename..., typename T = ::std::unordered_map<::std::int32_t, ::py3::simple::AdaptedTypeDef>>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> field3_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_field3), __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "field3" } */
  template <typename..., typename T = ::std::unordered_map<::std::int32_t, ::py3::simple::AdaptedTypeDef>>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> field3_ref() & {
    return {this->__fbthrift_field_field3, __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "field3" } */
  template <typename..., typename T = ::std::unordered_map<::std::int32_t, ::py3::simple::AdaptedTypeDef>>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> field3_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_field3), __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "field3" } */
  template <typename..., typename T = ::std::unordered_map<::std::int32_t, ::py3::simple::AdaptedTypeDef>>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> field3() const& {
    return {this->__fbthrift_field_field3, __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "field3" } */
  template <typename..., typename T = ::std::unordered_map<::std::int32_t, ::py3::simple::AdaptedTypeDef>>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> field3() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_field3), __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "field3" } */
  template <typename..., typename T = ::std::unordered_map<::std::int32_t, ::py3::simple::AdaptedTypeDef>>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> field3() & {
    return {this->__fbthrift_field_field3, __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "field3" } */
  template <typename..., typename T = ::std::unordered_map<::std::int32_t, ::py3::simple::AdaptedTypeDef>>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> field3() && {
    return {static_cast<T&&>(this->__fbthrift_field_field3), __isset.at(2), __isset.bit(2)};
  }
  /** Glean { "field": "field2" } */
  const ::std::vector<::py3::simple::AdaptedTypeDef>& get_field2() const&;
  /** Glean { "field": "field2" } */
  ::std::vector<::py3::simple::AdaptedTypeDef> get_field2() &&;

  /** Glean { "field": "field2" } */
  template <typename T_HiddenTypeFieldsStruct_field2_struct_setter = ::std::vector<::py3::simple::AdaptedTypeDef>>
  [[deprecated("Use `FOO.field2() = BAR;` instead of `FOO.set_field2(BAR);`")]]
  ::std::vector<::py3::simple::AdaptedTypeDef>& set_field2(T_HiddenTypeFieldsStruct_field2_struct_setter&& field2_) {
    field2_ref() = std::forward<T_HiddenTypeFieldsStruct_field2_struct_setter>(field2_);
    return __fbthrift_field_field2;
  }
  /** Glean { "field": "field3" } */
  const ::std::unordered_map<::std::int32_t, ::py3::simple::AdaptedTypeDef>& get_field3() const&;
  /** Glean { "field": "field3" } */
  ::std::unordered_map<::std::int32_t, ::py3::simple::AdaptedTypeDef> get_field3() &&;

  /** Glean { "field": "field3" } */
  template <typename T_HiddenTypeFieldsStruct_field3_struct_setter = ::std::unordered_map<::std::int32_t, ::py3::simple::AdaptedTypeDef>>
  [[deprecated("Use `FOO.field3() = BAR;` instead of `FOO.set_field3(BAR);`")]]
  ::std::unordered_map<::std::int32_t, ::py3::simple::AdaptedTypeDef>& set_field3(T_HiddenTypeFieldsStruct_field3_struct_setter&& field3_) {
    field3_ref() = std::forward<T_HiddenTypeFieldsStruct_field3_struct_setter>(field3_);
    return __fbthrift_field_field3;
  }

  template <class Protocol_>
  unsigned long read(Protocol_* iprot);
  template <class Protocol_>
  uint32_t serializedSize(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t serializedSizeZC(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t write(Protocol_* prot_) const;

 private:
  template <class Protocol_>
  void readNoXfer(Protocol_* iprot);

  friend class ::apache::thrift::Cpp2Ops<HiddenTypeFieldsStruct>;
  friend void swap(HiddenTypeFieldsStruct& a, HiddenTypeFieldsStruct& b);
};

template <class Protocol_>
unsigned long HiddenTypeFieldsStruct::read(Protocol_* iprot) {
  auto _xferStart = iprot->getCursorPosition();
  readNoXfer(iprot);
  return iprot->getCursorPosition() - _xferStart;
}


/** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "name": "HiddenException", "kind": "exception" } */
class FOLLY_EXPORT HiddenException : public virtual apache::thrift::TException {
 private:
  friend struct ::apache::thrift::detail::st::struct_private_access;
  template<class> friend struct ::apache::thrift::detail::invoke_reffer;

  //  used by a static_assert in the corresponding source
  static constexpr bool __fbthrift_cpp2_gen_json = false;
  static constexpr bool __fbthrift_cpp2_is_runtime_annotation = false;
  static std::string_view __fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord);
  static std::string_view __fbthrift_get_class_name();
  using __fbthrift_reflection_ident_list = folly::tag_t<
    ::apache::thrift::ident::test
  >;

  static constexpr std::int16_t __fbthrift_reflection_field_id_list[] = {0,1};
  using __fbthrift_reflection_type_tags = folly::tag_t<
    ::apache::thrift::type::i16_t
  >;

  static constexpr std::size_t __fbthrift_field_size_v = 1;

  template<class T>
  using __fbthrift_id = ::apache::thrift::type::field_id<__fbthrift_reflection_field_id_list[folly::to_underlying(T::value)]>;

  template<class T>
  using __fbthrift_type_tag = ::apache::thrift::detail::at<__fbthrift_reflection_type_tags, T::value>;

  template<class T>
  using __fbthrift_ident = ::apache::thrift::detail::at<__fbthrift_reflection_ident_list, T::value>;

  template<class T> using __fbthrift_ordinal = ::apache::thrift::type::ordinal_tag<
    ::apache::thrift::detail::getFieldOrdinal<T,
                                              __fbthrift_reflection_ident_list,
                                              __fbthrift_reflection_type_tags>(
      __fbthrift_reflection_field_id_list
    )
  >;
  void __fbthrift_clear();
  void __fbthrift_clear_terse_fields();
  bool __fbthrift_is_empty() const;
  static constexpr ::apache::thrift::ExceptionKind __fbthrift_cpp2_gen_exception_kind =
         ::apache::thrift::ExceptionKind::UNSPECIFIED;
  static constexpr ::apache::thrift::ExceptionSafety __fbthrift_cpp2_gen_exception_safety =
         ::apache::thrift::ExceptionSafety::SAFE;
  static constexpr ::apache::thrift::ExceptionBlame __fbthrift_cpp2_gen_exception_blame =
         ::apache::thrift::ExceptionBlame::UNSPECIFIED;

 public:
  using __fbthrift_cpp2_type = HiddenException;
  static constexpr bool __fbthrift_cpp2_is_union =
    false;
  static constexpr bool __fbthrift_cpp2_uses_op_encode =
    false;


 public:

  HiddenException();

  // FragileConstructor for use in initialization lists only.
  [[deprecated("This constructor is deprecated")]]
  HiddenException(apache::thrift::FragileConstructor, ::std::int16_t test__arg);

  HiddenException(HiddenException&&) noexcept;

  HiddenException(const HiddenException& src);


  HiddenException& operator=(HiddenException&&) noexcept;
  HiddenException& operator=(const HiddenException& src);

  ~HiddenException() override;

 private:
  ::std::int16_t __fbthrift_field_test;
 private:
  apache::thrift::detail::isset_bitset<1, apache::thrift::detail::IssetBitsetOption::Unpacked> __isset;

 public:

  bool operator==(const HiddenException&) const;
  bool operator<(const HiddenException&) const;

  /** Glean { "field": "test" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> test_ref() const& {
    return {this->__fbthrift_field_test, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "test" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> test_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_test), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "test" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> test_ref() & {
    return {this->__fbthrift_field_test, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "test" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> test_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_test), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "test" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> test() const& {
    return {this->__fbthrift_field_test, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "test" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> test() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_test), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "test" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> test() & {
    return {this->__fbthrift_field_test, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "test" } */
  template <typename..., typename T = ::std::int16_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> test() && {
    return {static_cast<T&&>(this->__fbthrift_field_test), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "test" } */
  ::std::int16_t get_test() const {
    return __fbthrift_field_test;
  }

  /** Glean { "field": "test" } */
  [[deprecated("Use `FOO.test() = BAR;` instead of `FOO.set_test(BAR);`")]]
  ::std::int16_t& set_test(::std::int16_t test_) {
    test_ref() = test_;
    return __fbthrift_field_test;
  }

  template <class Protocol_>
  unsigned long read(Protocol_* iprot);
  template <class Protocol_>
  uint32_t serializedSize(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t serializedSizeZC(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t write(Protocol_* prot_) const;

  const char* what() const noexcept override {
    return "::py3::simple::HiddenException";
  }

 private:
  template <class Protocol_>
  void readNoXfer(Protocol_* iprot);

  friend class ::apache::thrift::Cpp2Ops<HiddenException>;
  friend void swap(HiddenException& a, HiddenException& b);
};

template <class Protocol_>
unsigned long HiddenException::read(Protocol_* iprot) {
  auto _xferStart = iprot->getCursorPosition();
  readNoXfer(iprot);
  return iprot->getCursorPosition() - _xferStart;
}


/** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "name": "ComplexStruct", "kind": "struct" } */
class ComplexStruct final  {
 private:
  friend struct ::apache::thrift::detail::st::struct_private_access;
  template<class> friend struct ::apache::thrift::detail::invoke_reffer;

  //  used by a static_assert in the corresponding source
  static constexpr bool __fbthrift_cpp2_gen_json = false;
  static constexpr bool __fbthrift_cpp2_is_runtime_annotation = false;
  static std::string_view __fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord);
  static std::string_view __fbthrift_get_class_name();
  using __fbthrift_reflection_ident_list = folly::tag_t<
    ::apache::thrift::ident::structOne,
    ::apache::thrift::ident::structTwo,
    ::apache::thrift::ident::an_integer,
    ::apache::thrift::ident::name,
    ::apache::thrift::ident::an_enum,
    ::apache::thrift::ident::some_bytes,
    ::apache::thrift::ident::from,
    ::apache::thrift::ident::cdef,
    ::apache::thrift::ident::bytes_with_cpp_type
  >;

  static constexpr std::int16_t __fbthrift_reflection_field_id_list[] = {0,1,2,3,4,5,6,7,8,9};
  using __fbthrift_reflection_type_tags = folly::tag_t<
    ::apache::thrift::type::struct_t<::py3::simple::SimpleStruct>,
    ::apache::thrift::type::struct_t<::py3::simple::SimpleStruct>,
    ::apache::thrift::type::i32_t,
    ::apache::thrift::type::string_t,
    ::apache::thrift::type::enum_t<::py3::simple::AnEnum>,
    ::apache::thrift::type::binary_t,
    ::apache::thrift::type::string_t,
    ::apache::thrift::type::string_t,
    ::apache::thrift::type::cpp_type<foo::Bar, ::apache::thrift::type::binary_t>
  >;

  static constexpr std::size_t __fbthrift_field_size_v = 9;

  template<class T>
  using __fbthrift_id = ::apache::thrift::type::field_id<__fbthrift_reflection_field_id_list[folly::to_underlying(T::value)]>;

  template<class T>
  using __fbthrift_type_tag = ::apache::thrift::detail::at<__fbthrift_reflection_type_tags, T::value>;

  template<class T>
  using __fbthrift_ident = ::apache::thrift::detail::at<__fbthrift_reflection_ident_list, T::value>;

  template<class T> using __fbthrift_ordinal = ::apache::thrift::type::ordinal_tag<
    ::apache::thrift::detail::getFieldOrdinal<T,
                                              __fbthrift_reflection_ident_list,
                                              __fbthrift_reflection_type_tags>(
      __fbthrift_reflection_field_id_list
    )
  >;
  void __fbthrift_clear();
  void __fbthrift_clear_terse_fields();
  bool __fbthrift_is_empty() const;

 public:
  using __fbthrift_cpp2_type = ComplexStruct;
  static constexpr bool __fbthrift_cpp2_is_union =
    false;
  static constexpr bool __fbthrift_cpp2_uses_op_encode =
    false;


 public:

  ComplexStruct();

  // FragileConstructor for use in initialization lists only.
  [[deprecated("This constructor is deprecated")]]
  ComplexStruct(apache::thrift::FragileConstructor, ::py3::simple::SimpleStruct structOne__arg, ::py3::simple::SimpleStruct structTwo__arg, ::std::int32_t an_integer__arg, ::std::string name__arg, ::py3::simple::AnEnum an_enum__arg, ::std::string some_bytes__arg, ::std::string from__arg, ::std::string cdef__arg, ::py3::simple::foo_bar bytes_with_cpp_type__arg);

  ComplexStruct(ComplexStruct&&) noexcept;

  ComplexStruct(const ComplexStruct& src);


  ComplexStruct& operator=(ComplexStruct&&) noexcept;
  ComplexStruct& operator=(const ComplexStruct& src);

  ~ComplexStruct();

 private:
  ::py3::simple::SimpleStruct __fbthrift_field_structOne;
 private:
  ::py3::simple::SimpleStruct __fbthrift_field_structTwo;
 private:
  ::std::int32_t __fbthrift_field_an_integer;
 private:
  ::std::string __fbthrift_field_name;
 private:
  ::py3::simple::AnEnum __fbthrift_field_an_enum;
 private:
  ::std::string __fbthrift_field_some_bytes;
 private:
  ::std::string __fbthrift_field_from;
 private:
  ::std::string __fbthrift_field_cdef;
 private:
  ::py3::simple::foo_bar __fbthrift_field_bytes_with_cpp_type;
 private:
  apache::thrift::detail::isset_bitset<9, apache::thrift::detail::IssetBitsetOption::Unpacked> __isset;

 public:

  bool operator==(const ComplexStruct&) const;
  bool operator<(const ComplexStruct&) const;

  /** Glean { "field": "structOne" } */
  template <typename..., typename T = ::py3::simple::SimpleStruct>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> structOne_ref() const& {
    return {this->__fbthrift_field_structOne, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "structOne" } */
  template <typename..., typename T = ::py3::simple::SimpleStruct>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> structOne_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_structOne), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "structOne" } */
  template <typename..., typename T = ::py3::simple::SimpleStruct>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> structOne_ref() & {
    return {this->__fbthrift_field_structOne, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "structOne" } */
  template <typename..., typename T = ::py3::simple::SimpleStruct>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> structOne_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_structOne), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "structOne" } */
  template <typename..., typename T = ::py3::simple::SimpleStruct>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> structOne() const& {
    return {this->__fbthrift_field_structOne, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "structOne" } */
  template <typename..., typename T = ::py3::simple::SimpleStruct>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> structOne() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_structOne), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "structOne" } */
  template <typename..., typename T = ::py3::simple::SimpleStruct>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> structOne() & {
    return {this->__fbthrift_field_structOne, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "structOne" } */
  template <typename..., typename T = ::py3::simple::SimpleStruct>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> structOne() && {
    return {static_cast<T&&>(this->__fbthrift_field_structOne), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "structTwo" } */
  template <typename..., typename T = ::py3::simple::SimpleStruct>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> structTwo_ref() const& {
    return {this->__fbthrift_field_structTwo, __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "structTwo" } */
  template <typename..., typename T = ::py3::simple::SimpleStruct>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> structTwo_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_structTwo), __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "structTwo" } */
  template <typename..., typename T = ::py3::simple::SimpleStruct>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> structTwo_ref() & {
    return {this->__fbthrift_field_structTwo, __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "structTwo" } */
  template <typename..., typename T = ::py3::simple::SimpleStruct>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> structTwo_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_structTwo), __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "structTwo" } */
  template <typename..., typename T = ::py3::simple::SimpleStruct>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> structTwo() const& {
    return {this->__fbthrift_field_structTwo, __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "structTwo" } */
  template <typename..., typename T = ::py3::simple::SimpleStruct>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> structTwo() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_structTwo), __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "structTwo" } */
  template <typename..., typename T = ::py3::simple::SimpleStruct>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> structTwo() & {
    return {this->__fbthrift_field_structTwo, __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "structTwo" } */
  template <typename..., typename T = ::py3::simple::SimpleStruct>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> structTwo() && {
    return {static_cast<T&&>(this->__fbthrift_field_structTwo), __isset.at(1), __isset.bit(1)};
  }

  /** Glean { "field": "an_integer" } */
  template <typename..., typename T = ::std::int32_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> an_integer_ref() const& {
    return {this->__fbthrift_field_an_integer, __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "an_integer" } */
  template <typename..., typename T = ::std::int32_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> an_integer_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_an_integer), __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "an_integer" } */
  template <typename..., typename T = ::std::int32_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> an_integer_ref() & {
    return {this->__fbthrift_field_an_integer, __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "an_integer" } */
  template <typename..., typename T = ::std::int32_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> an_integer_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_an_integer), __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "an_integer" } */
  template <typename..., typename T = ::std::int32_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> an_integer() const& {
    return {this->__fbthrift_field_an_integer, __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "an_integer" } */
  template <typename..., typename T = ::std::int32_t>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> an_integer() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_an_integer), __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "an_integer" } */
  template <typename..., typename T = ::std::int32_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> an_integer() & {
    return {this->__fbthrift_field_an_integer, __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "an_integer" } */
  template <typename..., typename T = ::std::int32_t>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> an_integer() && {
    return {static_cast<T&&>(this->__fbthrift_field_an_integer), __isset.at(2), __isset.bit(2)};
  }

  /** Glean { "field": "name" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> name_ref() const& {
    return {this->__fbthrift_field_name, __isset.at(3), __isset.bit(3)};
  }

  /** Glean { "field": "name" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> name_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_name), __isset.at(3), __isset.bit(3)};
  }

  /** Glean { "field": "name" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> name_ref() & {
    return {this->__fbthrift_field_name, __isset.at(3), __isset.bit(3)};
  }

  /** Glean { "field": "name" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> name_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_name), __isset.at(3), __isset.bit(3)};
  }

  /** Glean { "field": "name" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> name() const& {
    return {this->__fbthrift_field_name, __isset.at(3), __isset.bit(3)};
  }

  /** Glean { "field": "name" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> name() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_name), __isset.at(3), __isset.bit(3)};
  }

  /** Glean { "field": "name" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> name() & {
    return {this->__fbthrift_field_name, __isset.at(3), __isset.bit(3)};
  }

  /** Glean { "field": "name" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> name() && {
    return {static_cast<T&&>(this->__fbthrift_field_name), __isset.at(3), __isset.bit(3)};
  }

  /** Glean { "field": "an_enum" } */
  template <typename..., typename T = ::py3::simple::AnEnum>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> an_enum_ref() const& {
    return {this->__fbthrift_field_an_enum, __isset.at(4), __isset.bit(4)};
  }

  /** Glean { "field": "an_enum" } */
  template <typename..., typename T = ::py3::simple::AnEnum>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> an_enum_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_an_enum), __isset.at(4), __isset.bit(4)};
  }

  /** Glean { "field": "an_enum" } */
  template <typename..., typename T = ::py3::simple::AnEnum>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> an_enum_ref() & {
    return {this->__fbthrift_field_an_enum, __isset.at(4), __isset.bit(4)};
  }

  /** Glean { "field": "an_enum" } */
  template <typename..., typename T = ::py3::simple::AnEnum>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> an_enum_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_an_enum), __isset.at(4), __isset.bit(4)};
  }

  /** Glean { "field": "an_enum" } */
  template <typename..., typename T = ::py3::simple::AnEnum>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> an_enum() const& {
    return {this->__fbthrift_field_an_enum, __isset.at(4), __isset.bit(4)};
  }

  /** Glean { "field": "an_enum" } */
  template <typename..., typename T = ::py3::simple::AnEnum>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> an_enum() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_an_enum), __isset.at(4), __isset.bit(4)};
  }

  /** Glean { "field": "an_enum" } */
  template <typename..., typename T = ::py3::simple::AnEnum>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> an_enum() & {
    return {this->__fbthrift_field_an_enum, __isset.at(4), __isset.bit(4)};
  }

  /** Glean { "field": "an_enum" } */
  template <typename..., typename T = ::py3::simple::AnEnum>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> an_enum() && {
    return {static_cast<T&&>(this->__fbthrift_field_an_enum), __isset.at(4), __isset.bit(4)};
  }

  /** Glean { "field": "some_bytes" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> some_bytes_ref() const& {
    return {this->__fbthrift_field_some_bytes, __isset.at(5), __isset.bit(5)};
  }

  /** Glean { "field": "some_bytes" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> some_bytes_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_some_bytes), __isset.at(5), __isset.bit(5)};
  }

  /** Glean { "field": "some_bytes" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> some_bytes_ref() & {
    return {this->__fbthrift_field_some_bytes, __isset.at(5), __isset.bit(5)};
  }

  /** Glean { "field": "some_bytes" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> some_bytes_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_some_bytes), __isset.at(5), __isset.bit(5)};
  }

  /** Glean { "field": "some_bytes" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> some_bytes() const& {
    return {this->__fbthrift_field_some_bytes, __isset.at(5), __isset.bit(5)};
  }

  /** Glean { "field": "some_bytes" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> some_bytes() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_some_bytes), __isset.at(5), __isset.bit(5)};
  }

  /** Glean { "field": "some_bytes" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> some_bytes() & {
    return {this->__fbthrift_field_some_bytes, __isset.at(5), __isset.bit(5)};
  }

  /** Glean { "field": "some_bytes" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> some_bytes() && {
    return {static_cast<T&&>(this->__fbthrift_field_some_bytes), __isset.at(5), __isset.bit(5)};
  }

  /** Glean { "field": "from" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> from_ref() const& {
    return {this->__fbthrift_field_from, __isset.at(6), __isset.bit(6)};
  }

  /** Glean { "field": "from" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> from_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_from), __isset.at(6), __isset.bit(6)};
  }

  /** Glean { "field": "from" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> from_ref() & {
    return {this->__fbthrift_field_from, __isset.at(6), __isset.bit(6)};
  }

  /** Glean { "field": "from" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> from_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_from), __isset.at(6), __isset.bit(6)};
  }

  /** Glean { "field": "from" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> from() const& {
    return {this->__fbthrift_field_from, __isset.at(6), __isset.bit(6)};
  }

  /** Glean { "field": "from" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> from() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_from), __isset.at(6), __isset.bit(6)};
  }

  /** Glean { "field": "from" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> from() & {
    return {this->__fbthrift_field_from, __isset.at(6), __isset.bit(6)};
  }

  /** Glean { "field": "from" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> from() && {
    return {static_cast<T&&>(this->__fbthrift_field_from), __isset.at(6), __isset.bit(6)};
  }

  /** Glean { "field": "cdef" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> cdef_ref() const& {
    return {this->__fbthrift_field_cdef, __isset.at(7), __isset.bit(7)};
  }

  /** Glean { "field": "cdef" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> cdef_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_cdef), __isset.at(7), __isset.bit(7)};
  }

  /** Glean { "field": "cdef" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> cdef_ref() & {
    return {this->__fbthrift_field_cdef, __isset.at(7), __isset.bit(7)};
  }

  /** Glean { "field": "cdef" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> cdef_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_cdef), __isset.at(7), __isset.bit(7)};
  }

  /** Glean { "field": "cdef" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> cdef() const& {
    return {this->__fbthrift_field_cdef, __isset.at(7), __isset.bit(7)};
  }

  /** Glean { "field": "cdef" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> cdef() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_cdef), __isset.at(7), __isset.bit(7)};
  }

  /** Glean { "field": "cdef" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> cdef() & {
    return {this->__fbthrift_field_cdef, __isset.at(7), __isset.bit(7)};
  }

  /** Glean { "field": "cdef" } */
  template <typename..., typename T = ::std::string>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> cdef() && {
    return {static_cast<T&&>(this->__fbthrift_field_cdef), __isset.at(7), __isset.bit(7)};
  }

  /** Glean { "field": "bytes_with_cpp_type" } */
  template <typename..., typename T = ::py3::simple::foo_bar>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> bytes_with_cpp_type_ref() const& {
    return {this->__fbthrift_field_bytes_with_cpp_type, __isset.at(8), __isset.bit(8)};
  }

  /** Glean { "field": "bytes_with_cpp_type" } */
  template <typename..., typename T = ::py3::simple::foo_bar>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> bytes_with_cpp_type_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_bytes_with_cpp_type), __isset.at(8), __isset.bit(8)};
  }

  /** Glean { "field": "bytes_with_cpp_type" } */
  template <typename..., typename T = ::py3::simple::foo_bar>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> bytes_with_cpp_type_ref() & {
    return {this->__fbthrift_field_bytes_with_cpp_type, __isset.at(8), __isset.bit(8)};
  }

  /** Glean { "field": "bytes_with_cpp_type" } */
  template <typename..., typename T = ::py3::simple::foo_bar>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> bytes_with_cpp_type_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_bytes_with_cpp_type), __isset.at(8), __isset.bit(8)};
  }

  /** Glean { "field": "bytes_with_cpp_type" } */
  template <typename..., typename T = ::py3::simple::foo_bar>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> bytes_with_cpp_type() const& {
    return {this->__fbthrift_field_bytes_with_cpp_type, __isset.at(8), __isset.bit(8)};
  }

  /** Glean { "field": "bytes_with_cpp_type" } */
  template <typename..., typename T = ::py3::simple::foo_bar>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> bytes_with_cpp_type() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_bytes_with_cpp_type), __isset.at(8), __isset.bit(8)};
  }

  /** Glean { "field": "bytes_with_cpp_type" } */
  template <typename..., typename T = ::py3::simple::foo_bar>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> bytes_with_cpp_type() & {
    return {this->__fbthrift_field_bytes_with_cpp_type, __isset.at(8), __isset.bit(8)};
  }

  /** Glean { "field": "bytes_with_cpp_type" } */
  template <typename..., typename T = ::py3::simple::foo_bar>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> bytes_with_cpp_type() && {
    return {static_cast<T&&>(this->__fbthrift_field_bytes_with_cpp_type), __isset.at(8), __isset.bit(8)};
  }
  /** Glean { "field": "structOne" } */
  const ::py3::simple::SimpleStruct& get_structOne() const&;
  /** Glean { "field": "structOne" } */
  ::py3::simple::SimpleStruct get_structOne() &&;

  /** Glean { "field": "structOne" } */
  template <typename T_ComplexStruct_structOne_struct_setter = ::py3::simple::SimpleStruct>
  [[deprecated("Use `FOO.structOne() = BAR;` instead of `FOO.set_structOne(BAR);`")]]
  ::py3::simple::SimpleStruct& set_structOne(T_ComplexStruct_structOne_struct_setter&& structOne_) {
    structOne_ref() = std::forward<T_ComplexStruct_structOne_struct_setter>(structOne_);
    return __fbthrift_field_structOne;
  }
  /** Glean { "field": "structTwo" } */
  const ::py3::simple::SimpleStruct& get_structTwo() const&;
  /** Glean { "field": "structTwo" } */
  ::py3::simple::SimpleStruct get_structTwo() &&;

  /** Glean { "field": "structTwo" } */
  template <typename T_ComplexStruct_structTwo_struct_setter = ::py3::simple::SimpleStruct>
  [[deprecated("Use `FOO.structTwo() = BAR;` instead of `FOO.set_structTwo(BAR);`")]]
  ::py3::simple::SimpleStruct& set_structTwo(T_ComplexStruct_structTwo_struct_setter&& structTwo_) {
    structTwo_ref() = std::forward<T_ComplexStruct_structTwo_struct_setter>(structTwo_);
    return __fbthrift_field_structTwo;
  }

  /** Glean { "field": "an_integer" } */
  ::std::int32_t get_an_integer() const {
    return __fbthrift_field_an_integer;
  }

  /** Glean { "field": "an_integer" } */
  [[deprecated("Use `FOO.an_integer() = BAR;` instead of `FOO.set_an_integer(BAR);`")]]
  ::std::int32_t& set_an_integer(::std::int32_t an_integer_) {
    an_integer_ref() = an_integer_;
    return __fbthrift_field_an_integer;
  }

  /** Glean { "field": "name" } */
  const ::std::string& get_name() const& {
    return __fbthrift_field_name;
  }

  /** Glean { "field": "name" } */
  ::std::string get_name() && {
    return std::move(__fbthrift_field_name);
  }

  /** Glean { "field": "name" } */
  template <typename T_ComplexStruct_name_struct_setter = ::std::string>
  [[deprecated("Use `FOO.name() = BAR;` instead of `FOO.set_name(BAR);`")]]
  ::std::string& set_name(T_ComplexStruct_name_struct_setter&& name_) {
    name_ref() = std::forward<T_ComplexStruct_name_struct_setter>(name_);
    return __fbthrift_field_name;
  }

  /** Glean { "field": "an_enum" } */
  ::py3::simple::AnEnum get_an_enum() const {
    return __fbthrift_field_an_enum;
  }

  /** Glean { "field": "an_enum" } */
  [[deprecated("Use `FOO.an_enum() = BAR;` instead of `FOO.set_an_enum(BAR);`")]]
  ::py3::simple::AnEnum& set_an_enum(::py3::simple::AnEnum an_enum_) {
    an_enum_ref() = an_enum_;
    return __fbthrift_field_an_enum;
  }

  /** Glean { "field": "some_bytes" } */
  const ::std::string& get_some_bytes() const& {
    return __fbthrift_field_some_bytes;
  }

  /** Glean { "field": "some_bytes" } */
  ::std::string get_some_bytes() && {
    return std::move(__fbthrift_field_some_bytes);
  }

  /** Glean { "field": "some_bytes" } */
  template <typename T_ComplexStruct_some_bytes_struct_setter = ::std::string>
  [[deprecated("Use `FOO.some_bytes() = BAR;` instead of `FOO.set_some_bytes(BAR);`")]]
  ::std::string& set_some_bytes(T_ComplexStruct_some_bytes_struct_setter&& some_bytes_) {
    some_bytes_ref() = std::forward<T_ComplexStruct_some_bytes_struct_setter>(some_bytes_);
    return __fbthrift_field_some_bytes;
  }

  /** Glean { "field": "from" } */
  const ::std::string& get_from() const& {
    return __fbthrift_field_from;
  }

  /** Glean { "field": "from" } */
  ::std::string get_from() && {
    return std::move(__fbthrift_field_from);
  }

  /** Glean { "field": "from" } */
  template <typename T_ComplexStruct_from_struct_setter = ::std::string>
  [[deprecated("Use `FOO.from() = BAR;` instead of `FOO.set_from(BAR);`")]]
  ::std::string& set_from(T_ComplexStruct_from_struct_setter&& from_) {
    from_ref() = std::forward<T_ComplexStruct_from_struct_setter>(from_);
    return __fbthrift_field_from;
  }

  /** Glean { "field": "cdef" } */
  const ::std::string& get_cdef() const& {
    return __fbthrift_field_cdef;
  }

  /** Glean { "field": "cdef" } */
  ::std::string get_cdef() && {
    return std::move(__fbthrift_field_cdef);
  }

  /** Glean { "field": "cdef" } */
  template <typename T_ComplexStruct_cdef_struct_setter = ::std::string>
  [[deprecated("Use `FOO.cdef() = BAR;` instead of `FOO.set_cdef(BAR);`")]]
  ::std::string& set_cdef(T_ComplexStruct_cdef_struct_setter&& cdef_) {
    cdef_ref() = std::forward<T_ComplexStruct_cdef_struct_setter>(cdef_);
    return __fbthrift_field_cdef;
  }

  /** Glean { "field": "bytes_with_cpp_type" } */
  const ::py3::simple::foo_bar& get_bytes_with_cpp_type() const& {
    return __fbthrift_field_bytes_with_cpp_type;
  }

  /** Glean { "field": "bytes_with_cpp_type" } */
  ::py3::simple::foo_bar get_bytes_with_cpp_type() && {
    return std::move(__fbthrift_field_bytes_with_cpp_type);
  }

  /** Glean { "field": "bytes_with_cpp_type" } */
  template <typename T_ComplexStruct_bytes_with_cpp_type_struct_setter = ::py3::simple::foo_bar>
  [[deprecated("Use `FOO.bytes_with_cpp_type() = BAR;` instead of `FOO.set_bytes_with_cpp_type(BAR);`")]]
  ::py3::simple::foo_bar& set_bytes_with_cpp_type(T_ComplexStruct_bytes_with_cpp_type_struct_setter&& bytes_with_cpp_type_) {
    bytes_with_cpp_type_ref() = std::forward<T_ComplexStruct_bytes_with_cpp_type_struct_setter>(bytes_with_cpp_type_);
    return __fbthrift_field_bytes_with_cpp_type;
  }

  template <class Protocol_>
  unsigned long read(Protocol_* iprot);
  template <class Protocol_>
  uint32_t serializedSize(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t serializedSizeZC(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t write(Protocol_* prot_) const;

 private:
  template <class Protocol_>
  void readNoXfer(Protocol_* iprot);

  friend class ::apache::thrift::Cpp2Ops<ComplexStruct>;
  friend void swap(ComplexStruct& a, ComplexStruct& b);
};

template <class Protocol_>
unsigned long ComplexStruct::read(Protocol_* iprot) {
  auto _xferStart = iprot->getCursorPosition();
  readNoXfer(iprot);
  return iprot->getCursorPosition() - _xferStart;
}


/** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "name": "BinaryUnion", "kind": "union" } */
class BinaryUnion final  {
 private:
  friend struct ::apache::thrift::detail::st::struct_private_access;
  template<class> friend struct ::apache::thrift::detail::invoke_reffer;

  //  used by a static_assert in the corresponding source
  static constexpr bool __fbthrift_cpp2_gen_json = false;
  static constexpr bool __fbthrift_cpp2_is_runtime_annotation = false;
  static std::string_view __fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord);
  static std::string_view __fbthrift_get_class_name();
  using __fbthrift_reflection_ident_list = folly::tag_t<
    ::apache::thrift::ident::iobuf_val
  >;

  static constexpr std::int16_t __fbthrift_reflection_field_id_list[] = {0,1};
  using __fbthrift_reflection_type_tags = folly::tag_t<
    ::apache::thrift::type::cpp_type<folly::IOBuf, ::apache::thrift::type::binary_t>
  >;

  static constexpr std::size_t __fbthrift_field_size_v = 1;

  template<class T>
  using __fbthrift_id = ::apache::thrift::type::field_id<__fbthrift_reflection_field_id_list[folly::to_underlying(T::value)]>;

  template<class T>
  using __fbthrift_type_tag = ::apache::thrift::detail::at<__fbthrift_reflection_type_tags, T::value>;

  template<class T>
  using __fbthrift_ident = ::apache::thrift::detail::at<__fbthrift_reflection_ident_list, T::value>;

  template<class T> using __fbthrift_ordinal = ::apache::thrift::type::ordinal_tag<
    ::apache::thrift::detail::getFieldOrdinal<T,
                                              __fbthrift_reflection_ident_list,
                                              __fbthrift_reflection_type_tags>(
      __fbthrift_reflection_field_id_list
    )
  >;
  void __fbthrift_clear();
  void __fbthrift_destruct();
  bool __fbthrift_is_empty() const;

 public:
  using __fbthrift_cpp2_type = BinaryUnion;
  static constexpr bool __fbthrift_cpp2_is_union =
    true;
  static constexpr bool __fbthrift_cpp2_uses_op_encode =
    false;


 public:
  enum Type : int {
    __EMPTY__ = 0,
    iobuf_val = 1,
  } ;

  BinaryUnion()
      : type_(folly::to_underlying(Type::__EMPTY__)) {}

  BinaryUnion(BinaryUnion&& rhs) noexcept
      : type_(folly::to_underlying(Type::__EMPTY__)) {
    if (this == &rhs) { return; }
    switch (rhs.getType()) {
      case Type::__EMPTY__:
      {
        return;
      }
      case Type::iobuf_val:
      {
        set_iobuf_val(std::move(rhs.value_.iobuf_val));
        break;
      }
      default:
      {
        assert(false);
        break;
      }
    }
    apache::thrift::clear(rhs);
  }

  BinaryUnion(const BinaryUnion& rhs);

  BinaryUnion& operator=(BinaryUnion&& rhs) noexcept {
    if (this == &rhs) { return *this; }
    switch (rhs.getType()) {
      case Type::__EMPTY__:
      {
        __fbthrift_clear();
        return *this;
      }
      case Type::iobuf_val:
      {
        set_iobuf_val(std::move(rhs.value_.iobuf_val));
        break;
      }
      default:
      {
        assert(false);
        __fbthrift_clear();
      }
    }
    apache::thrift::clear(rhs);
    return *this;
  }

  BinaryUnion& operator=(const BinaryUnion& rhs);

  ~BinaryUnion();

  union storage_type {
    ::py3::simple::IOBuf iobuf_val;

    storage_type() {}
    ~storage_type() {}
  } ;

  /** Glean { "field": "iobuf_val" } */
  template <typename... A, std::enable_if_t<!sizeof...(A), int> = 0>
  ::py3::simple::IOBuf& set_iobuf_val(::py3::simple::IOBuf const &t) {
    using T0 = ::py3::simple::IOBuf;
    using T = folly::type_t<T0, A...>;
    __fbthrift_clear();
    type_ = folly::to_underlying(Type::iobuf_val);
    ::new (std::addressof(value_.iobuf_val)) T(t);
    return value_.iobuf_val;
  }

  /** Glean { "field": "iobuf_val" } */
  template <typename... A, std::enable_if_t<!sizeof...(A), int> = 0>
  ::py3::simple::IOBuf& set_iobuf_val(::py3::simple::IOBuf&& t) {
    using T0 = ::py3::simple::IOBuf;
    using T = folly::type_t<T0, A...>;
    __fbthrift_clear();
    type_ = folly::to_underlying(Type::iobuf_val);
    ::new (std::addressof(value_.iobuf_val)) T(std::move(t));
    return value_.iobuf_val;
  }

  /** Glean { "field": "iobuf_val" } */
  template<typename... T, typename = ::apache::thrift::safe_overload_t<::py3::simple::IOBuf, T...>> ::py3::simple::IOBuf& set_iobuf_val(T&&... t) {
    __fbthrift_clear();
    type_ = folly::to_underlying(Type::iobuf_val);
    ::new (std::addressof(value_.iobuf_val)) ::py3::simple::IOBuf(std::forward<T>(t)...);
    return value_.iobuf_val;
  }


  ::py3::simple::IOBuf const& get_iobuf_val() const {
    if (getType() != Type::iobuf_val) {
      ::apache::thrift::detail::throw_on_bad_union_field_access();
    }
    return value_.iobuf_val;
  }

  ::py3::simple::IOBuf& mutable_iobuf_val() {
    assert(getType() == Type::iobuf_val);
    return value_.iobuf_val;
  }

  template <typename..., typename T = ::py3::simple::IOBuf>
  T move_iobuf_val() {
    assert(getType() == Type::iobuf_val);
    return std::move(value_.iobuf_val);
  }

  /** Glean { "field": "iobuf_val" } */
  template <typename..., typename T = ::py3::simple::IOBuf>
  FOLLY_ERASE ::apache::thrift::union_field_ref<const T&> iobuf_val_ref() const& {
    return {value_.iobuf_val, type_, folly::to_underlying(Type::iobuf_val), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for<decltype(*this)>};
  }

  /** Glean { "field": "iobuf_val" } */
  template <typename..., typename T = ::py3::simple::IOBuf>
  FOLLY_ERASE ::apache::thrift::union_field_ref<const T&&> iobuf_val_ref() const&& {
    return {std::move(value_.iobuf_val), type_, folly::to_underlying(Type::iobuf_val), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for<decltype(*this)>};
  }

  /** Glean { "field": "iobuf_val" } */
  template <typename..., typename T = ::py3::simple::IOBuf>
  FOLLY_ERASE ::apache::thrift::union_field_ref<T&> iobuf_val_ref() & {
    return {value_.iobuf_val, type_, folly::to_underlying(Type::iobuf_val), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for<decltype(*this)>};
  }

  /** Glean { "field": "iobuf_val" } */
  template <typename..., typename T = ::py3::simple::IOBuf>
  FOLLY_ERASE ::apache::thrift::union_field_ref<T&&> iobuf_val_ref() && {
    return {std::move(value_.iobuf_val), type_, folly::to_underlying(Type::iobuf_val), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for<decltype(*this)>};
  }
  Type getType() const { return static_cast<Type>(type_); }

  template <class Protocol_>
  unsigned long read(Protocol_* iprot);
  template <class Protocol_>
  uint32_t serializedSize(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t serializedSizeZC(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t write(Protocol_* prot_) const;
 protected:
  storage_type value_;
  std::underlying_type_t<Type> type_;

 private:
  template <class Protocol_>
  void readNoXfer(Protocol_* iprot);

  friend class ::apache::thrift::Cpp2Ops<BinaryUnion>;
  friend void swap(BinaryUnion& a, BinaryUnion& b);
};

template <class Protocol_>
unsigned long BinaryUnion::read(Protocol_* iprot) {
  auto _xferStart = iprot->getCursorPosition();
  readNoXfer(iprot);
  return iprot->getCursorPosition() - _xferStart;
}


/** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "name": "BinaryUnionStruct", "kind": "struct" } */
class BinaryUnionStruct final  {
 private:
  friend struct ::apache::thrift::detail::st::struct_private_access;
  template<class> friend struct ::apache::thrift::detail::invoke_reffer;

  //  used by a static_assert in the corresponding source
  static constexpr bool __fbthrift_cpp2_gen_json = false;
  static constexpr bool __fbthrift_cpp2_is_runtime_annotation = false;
  static std::string_view __fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord);
  static std::string_view __fbthrift_get_class_name();
  using __fbthrift_reflection_ident_list = folly::tag_t<
    ::apache::thrift::ident::u
  >;

  static constexpr std::int16_t __fbthrift_reflection_field_id_list[] = {0,1};
  using __fbthrift_reflection_type_tags = folly::tag_t<
    ::apache::thrift::type::union_t<::py3::simple::BinaryUnion>
  >;

  static constexpr std::size_t __fbthrift_field_size_v = 1;

  template<class T>
  using __fbthrift_id = ::apache::thrift::type::field_id<__fbthrift_reflection_field_id_list[folly::to_underlying(T::value)]>;

  template<class T>
  using __fbthrift_type_tag = ::apache::thrift::detail::at<__fbthrift_reflection_type_tags, T::value>;

  template<class T>
  using __fbthrift_ident = ::apache::thrift::detail::at<__fbthrift_reflection_ident_list, T::value>;

  template<class T> using __fbthrift_ordinal = ::apache::thrift::type::ordinal_tag<
    ::apache::thrift::detail::getFieldOrdinal<T,
                                              __fbthrift_reflection_ident_list,
                                              __fbthrift_reflection_type_tags>(
      __fbthrift_reflection_field_id_list
    )
  >;
  void __fbthrift_clear();
  void __fbthrift_clear_terse_fields();
  bool __fbthrift_is_empty() const;

 public:
  using __fbthrift_cpp2_type = BinaryUnionStruct;
  static constexpr bool __fbthrift_cpp2_is_union =
    false;
  static constexpr bool __fbthrift_cpp2_uses_op_encode =
    false;


 public:

  BinaryUnionStruct() {
  }
  // FragileConstructor for use in initialization lists only.
  [[deprecated("This constructor is deprecated")]]
  BinaryUnionStruct(apache::thrift::FragileConstructor, ::py3::simple::BinaryUnion u__arg);

  BinaryUnionStruct(BinaryUnionStruct&&) noexcept;

  BinaryUnionStruct(const BinaryUnionStruct& src);


  BinaryUnionStruct& operator=(BinaryUnionStruct&&) noexcept;
  BinaryUnionStruct& operator=(const BinaryUnionStruct& src);
 private:
  ::py3::simple::BinaryUnion __fbthrift_field_u;
 private:
  apache::thrift::detail::isset_bitset<1, apache::thrift::detail::IssetBitsetOption::Unpacked> __isset;

 public:

  /** Glean { "field": "u" } */
  template <typename..., typename T = ::py3::simple::BinaryUnion>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> u_ref() const& {
    return {this->__fbthrift_field_u, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "u" } */
  template <typename..., typename T = ::py3::simple::BinaryUnion>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> u_ref() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_u), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "u" } */
  template <typename..., typename T = ::py3::simple::BinaryUnion>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> u_ref() & {
    return {this->__fbthrift_field_u, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "u" } */
  template <typename..., typename T = ::py3::simple::BinaryUnion>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> u_ref() && {
    return {static_cast<T&&>(this->__fbthrift_field_u), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "u" } */
  template <typename..., typename T = ::py3::simple::BinaryUnion>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&> u() const& {
    return {this->__fbthrift_field_u, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "u" } */
  template <typename..., typename T = ::py3::simple::BinaryUnion>
  FOLLY_ERASE ::apache::thrift::field_ref<const T&&> u() const&& {
    return {static_cast<const T&&>(this->__fbthrift_field_u), __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "u" } */
  template <typename..., typename T = ::py3::simple::BinaryUnion>
  FOLLY_ERASE ::apache::thrift::field_ref<T&> u() & {
    return {this->__fbthrift_field_u, __isset.at(0), __isset.bit(0)};
  }

  /** Glean { "field": "u" } */
  template <typename..., typename T = ::py3::simple::BinaryUnion>
  FOLLY_ERASE ::apache::thrift::field_ref<T&&> u() && {
    return {static_cast<T&&>(this->__fbthrift_field_u), __isset.at(0), __isset.bit(0)};
  }
  /** Glean { "field": "u" } */
  const ::py3::simple::BinaryUnion& get_u() const&;
  /** Glean { "field": "u" } */
  ::py3::simple::BinaryUnion get_u() &&;

  /** Glean { "field": "u" } */
  template <typename T_BinaryUnionStruct_u_struct_setter = ::py3::simple::BinaryUnion>
  [[deprecated("Use `FOO.u() = BAR;` instead of `FOO.set_u(BAR);`")]]
  ::py3::simple::BinaryUnion& set_u(T_BinaryUnionStruct_u_struct_setter&& u_) {
    u_ref() = std::forward<T_BinaryUnionStruct_u_struct_setter>(u_);
    return __fbthrift_field_u;
  }

  template <class Protocol_>
  unsigned long read(Protocol_* iprot);
  template <class Protocol_>
  uint32_t serializedSize(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t serializedSizeZC(Protocol_ const* prot_) const;
  template <class Protocol_>
  uint32_t write(Protocol_* prot_) const;

 private:
  template <class Protocol_>
  void readNoXfer(Protocol_* iprot);

  friend class ::apache::thrift::Cpp2Ops<BinaryUnionStruct>;
  friend void swap(BinaryUnionStruct& a, BinaryUnionStruct& b);
};

template <class Protocol_>
unsigned long BinaryUnionStruct::read(Protocol_* iprot) {
  auto _xferStart = iprot->getCursorPosition();
  readNoXfer(iprot);
  return iprot->getCursorPosition() - _xferStart;
}


} // namespace py3::simple

namespace apache { namespace thrift {

template <> struct TEnumDataStorage<::py3::simple::detail::AdaptedUnion::Type>;

template <> struct TEnumTraits<::py3::simple::detail::AdaptedUnion::Type> {
  using type = ::py3::simple::detail::AdaptedUnion::Type;

  static constexpr std::size_t const size = 1;
  static folly::Range<type const*> const values;
  static folly::Range<std::string_view const*> const names;

  static bool findName(type value, std::string_view* out) noexcept;
  static bool findValue(std::string_view name, type* out) noexcept;

  static char const* findName(type value) noexcept {
    std::string_view ret;
    (void)findName(value, &ret);
    return ret.data();
  }
};

template <> struct TEnumDataStorage<::py3::simple::BinaryUnion::Type>;

template <> struct TEnumTraits<::py3::simple::BinaryUnion::Type> {
  using type = ::py3::simple::BinaryUnion::Type;

  static constexpr std::size_t const size = 1;
  static folly::Range<type const*> const values;
  static folly::Range<std::string_view const*> const names;

  static bool findName(type value, std::string_view* out) noexcept;
  static bool findValue(std::string_view name, type* out) noexcept;

  static char const* findName(type value) noexcept {
    std::string_view ret;
    (void)findName(value, &ret);
    return ret.data();
  }
};
}} // apache::thrift
