// @generated by Thrift for thrift/compiler/test/fixtures/adapter/src/module.thrift
// This file is probably not the place you want to edit!

//! Thrift type definitions for `module`.

#![allow(clippy::redundant_closure)]

pub type SetWithAdapter = <::my::Adapter2 as ::fbthrift::adapter::ThriftAdapter>::AdaptedType;

pub type StringWithAdapter = <::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::AdaptedType;

pub type ListWithElemAdapter = ::std::vec::Vec<crate::types::StringWithAdapter>;

pub type ListWithElemAdapter_withAdapter = <::fbthrift::adapter::LayeredThriftAdapter<::my::Adapter2, ::fbthrift::adapter::ListMapAdapter<crate::types::adapters::StringWithAdapter>> as ::fbthrift::adapter::ThriftAdapter>::AdaptedType;

pub type MyI64 = <::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::AdaptedType;

pub type DoubleTypedefI64 = crate::types::MyI64;

pub type MyI32 = <::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::AdaptedType;

pub type FooWithAdapter = <::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::AdaptedType;

pub type StructWithAdapter = crate::types::Bar;

pub type UnionWithAdapter = crate::types::Baz;

pub type AdaptedA = crate::types::A;

pub type DurationMs = ::std::primitive::i64;

pub type AdaptedBool = ::std::primitive::bool;

pub type AdaptedByte = ::std::primitive::i8;

pub type AdaptedShort = ::std::primitive::i16;

pub type AdaptedInteger = ::std::primitive::i32;

pub type AdaptedLong = ::std::primitive::i64;

pub type AdaptedDouble = ::std::primitive::f64;

pub type AdaptedString = ::std::string::String;

pub type DoubleTypedefBool = crate::types::AdaptedBool;

pub type CustomProtocolType = ::std::vec::Vec<::std::primitive::u8>;

pub type IndirectionString = ::std::string::String;

pub type AdaptedEnum = crate::types::ThriftAdaptedEnum;

pub type AdaptedTypedef = crate::types::AdaptedStruct;

pub type TypedefOfDirect = crate::types::DirectlyAdaptedStruct;

pub type AdaptedCircularAdaptee = crate::types::CircularAdaptee;

pub type CountingInt = ::std::primitive::i64;

pub type FooWithAdapter_9317 = crate::types::FooWithAdapter;

pub type ListWithElemAdapter_withAdapter_2312 = crate::types::ListWithElemAdapter_withAdapter;

pub type MyI32_4873 = crate::types::MyI32;

pub type StringWithAdapter_7208 = crate::types::StringWithAdapter;

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct MyAnnotation {
    pub signature: ::std::string::String,
    pub color: crate::types::Color,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq)]
pub struct Foo {
    pub intField: <::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::AdaptedType,
    pub optionalIntField: ::std::option::Option<<::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::AdaptedType>,
    pub intFieldWithDefault: <::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::AdaptedType,
    pub setField: <crate::types::adapters::SetWithAdapter as ::fbthrift::adapter::ThriftAdapter>::AdaptedType,
    pub optionalSetField: ::std::option::Option<<crate::types::adapters::SetWithAdapter as ::fbthrift::adapter::ThriftAdapter>::AdaptedType>,
    pub mapField: <::fbthrift::adapter::LayeredThriftAdapter<::my::Adapter3, ::fbthrift::adapter::MapMapAdapter<::fbthrift::adapter::IdentityAdapter<::std::string::String>, crate::types::adapters::ListWithElemAdapter_withAdapter>> as ::fbthrift::adapter::ThriftAdapter>::AdaptedType,
    pub optionalMapField: ::std::option::Option<<::fbthrift::adapter::LayeredThriftAdapter<::my::Adapter3, ::fbthrift::adapter::MapMapAdapter<::fbthrift::adapter::IdentityAdapter<::std::string::String>, crate::types::adapters::ListWithElemAdapter_withAdapter>> as ::fbthrift::adapter::ThriftAdapter>::AdaptedType>,
    pub binaryField: <::my::Adapter3 as ::fbthrift::adapter::ThriftAdapter>::AdaptedType,
    pub longField: <crate::types::adapters::MyI64 as ::fbthrift::adapter::ThriftAdapter>::AdaptedType,
    pub adaptedLongField: <::fbthrift::adapter::LayeredThriftAdapter<::my::Adapter2, crate::types::adapters::MyI64> as ::fbthrift::adapter::ThriftAdapter>::AdaptedType,
    pub doubleAdaptedField: <crate::types::adapters::MyI64 as ::fbthrift::adapter::ThriftAdapter>::AdaptedType,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq, Debug)]
pub enum Baz {
    intField(<::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::AdaptedType),
    setField(<crate::types::adapters::SetWithAdapter as ::fbthrift::adapter::ThriftAdapter>::AdaptedType),
    mapField(<::fbthrift::adapter::LayeredThriftAdapter<::my::Adapter3, ::fbthrift::adapter::MapMapAdapter<::fbthrift::adapter::IdentityAdapter<::std::string::String>, crate::types::adapters::ListWithElemAdapter_withAdapter>> as ::fbthrift::adapter::ThriftAdapter>::AdaptedType),
    binaryField(<::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::AdaptedType),
    longField(<crate::types::adapters::MyI64 as ::fbthrift::adapter::ThriftAdapter>::AdaptedType),
    UnknownField(::std::primitive::i32),
}

#[derive(Clone, PartialEq)]
pub struct Bar {
    pub structField: crate::types::Foo,
    pub optionalStructField: ::std::option::Option<crate::types::Foo>,
    pub structListField: <::fbthrift::adapter::ListMapAdapter<crate::types::adapters::FooWithAdapter> as ::fbthrift::adapter::ThriftAdapter>::AdaptedType,
    pub optionalStructListField: ::std::option::Option<<::fbthrift::adapter::ListMapAdapter<crate::types::adapters::FooWithAdapter> as ::fbthrift::adapter::ThriftAdapter>::AdaptedType>,
    pub unionField: crate::types::Baz,
    pub optionalUnionField: ::std::option::Option<crate::types::Baz>,
    pub adaptedStructField: crate::types::DirectlyAdapted,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct DirectlyAdapted {
    pub field: ::std::primitive::i32,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct IndependentDirectlyAdapted {
    pub field: ::std::primitive::i32,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq)]
pub struct StructWithFieldAdapter {
    pub field: <::my::Adapter1<::std::primitive::i32> as ::fbthrift::adapter::ThriftAdapter>::AdaptedType,
    pub shared_field: ::std::primitive::i32,
    pub opt_shared_field: ::std::option::Option<<::my::Adapter1<::std::primitive::i32> as ::fbthrift::adapter::ThriftAdapter>::AdaptedType>,
    pub opt_boxed_field: ::std::option::Option<::std::boxed::Box<::std::primitive::i32>>,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq)]
pub struct TerseAdaptedFields {
    pub int_field: ::std::primitive::i32,
    pub string_field: ::std::string::String,
    pub set_field: ::std::collections::BTreeSet<::std::primitive::i32>,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq)]
pub struct B {
    pub a: crate::types::AdaptedA,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct A {
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Config {
    pub path: ::std::string::String,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq)]
pub struct MyStruct {
    pub field: ::std::primitive::i32,
    pub set_string: <crate::types::adapters::SetWithAdapter as ::fbthrift::adapter::ThriftAdapter>::AdaptedType,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct AdaptTestStruct {
    pub delay: crate::types::DurationMs,
    pub custom: crate::types::CustomProtocolType,
    pub timeout: ::std::primitive::i64,
    pub data: ::std::primitive::i64,
    pub meta: ::std::string::String,
    pub indirectionString: crate::types::IndirectionString,
    pub string_data: ::std::string::String,
    pub double_wrapped_bool: crate::types::AdaptedBool,
    pub double_wrapped_integer: crate::types::AdaptedInteger,
    pub binary_data: ::std::vec::Vec<::std::primitive::u8>,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq)]
pub struct AdaptTemplatedTestStruct {
    pub adaptedBool: crate::types::AdaptedBool,
    pub adaptedByte: crate::types::AdaptedByte,
    pub adaptedShort: crate::types::AdaptedShort,
    pub adaptedInteger: crate::types::AdaptedInteger,
    pub adaptedLong: crate::types::AdaptedLong,
    pub adaptedDouble: crate::types::AdaptedDouble,
    pub adaptedString: crate::types::AdaptedString,
    pub adaptedList: ::std::vec::Vec<::std::primitive::i64>,
    pub adaptedSet: ::std::collections::BTreeSet<::std::primitive::i64>,
    pub adaptedMap: ::std::collections::BTreeMap<::std::primitive::i64, ::std::primitive::i64>,
    pub adaptedBoolDefault: crate::types::AdaptedBool,
    pub adaptedByteDefault: crate::types::AdaptedByte,
    pub adaptedShortDefault: crate::types::AdaptedShort,
    pub adaptedIntegerDefault: crate::types::AdaptedInteger,
    pub adaptedLongDefault: crate::types::AdaptedLong,
    pub adaptedDoubleDefault: crate::types::AdaptedDouble,
    pub adaptedStringDefault: crate::types::AdaptedString,
    pub adaptedEnum: crate::types::AdaptedEnum,
    pub adaptedListDefault: <::fbthrift_adapters::test::TestAdapter as ::fbthrift::adapter::ThriftAdapter>::AdaptedType,
    pub adaptedSetDefault: <::fbthrift_adapters::test::TestAdapter as ::fbthrift::adapter::ThriftAdapter>::AdaptedType,
    pub adaptedMapDefault: <::fbthrift_adapters::test::TestAdapter as ::fbthrift::adapter::ThriftAdapter>::AdaptedType,
    pub doubleTypedefBool: crate::types::DoubleTypedefBool,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq)]
pub struct AdaptTemplatedNestedTestStruct {
    pub adaptedStruct: crate::types::AdaptTemplatedTestStruct,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum AdaptTestUnion {
    delay(crate::types::DurationMs),
    custom(crate::types::CustomProtocolType),
    UnknownField(::std::primitive::i32),
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct AdaptedStruct {
    pub data: ::std::primitive::i64,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct DirectlyAdaptedStruct {
    pub data: ::std::primitive::i64,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq)]
pub struct StructFieldAdaptedStruct {
    pub adaptedStruct: crate::types::AdaptedStruct,
    pub adaptedTypedef: crate::types::AdaptedTypedef,
    pub directlyAdapted: crate::types::DirectlyAdaptedStruct,
    pub typedefOfAdapted: crate::types::TypedefOfDirect,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq)]
pub struct CircularAdaptee {
    pub field: crate::types::CircularStruct,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq)]
pub struct CircularStruct {
    pub field: ::std::option::Option<crate::types::AdaptedCircularAdaptee>,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq)]
pub struct ReorderedStruct {
    pub reordered_dependent_adapted: crate::types::DeclaredAfterStruct,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct DeclaredAfterStruct {
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct RenamedStruct {
    pub data: ::std::primitive::i64,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct SameNamespaceStruct {
    pub data: ::std::primitive::i64,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct HeapAllocated {
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq)]
pub struct MoveOnly {
    pub ptr: crate::types::HeapAllocated,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct AlsoMoveOnly {
    pub ptr: ::std::primitive::i64,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ApplyAdapter {
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct TransitiveAdapted {
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct CountingStruct {
    pub regularInt: ::std::option::Option<::std::primitive::i64>,
    pub countingInt: ::std::option::Option<crate::types::CountingInt>,
    pub regularString: ::std::option::Option<::std::string::String>,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Person {
    pub name: ::std::string::String,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Person2 {
    pub name: ::std::string::String,
    // This field forces `..Default::default()` when instantiating this
    // struct, to make code future-proof against new fields added later to
    // the definition in Thrift. If you don't want this, add the annotation
    // `(rust.exhaustive)` to the Thrift struct to eliminate this field.
    #[doc(hidden)]
    pub _dot_dot_Default_default: self::dot_dot::OtherFields,
}

#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct Color(pub ::std::primitive::i32);

impl Color {
    pub const UNKNOWN: Self = Color(0i32);
    pub const RED: Self = Color(1i32);
    pub const GREEN: Self = Color(2i32);
    pub const BLUE: Self = Color(3i32);
}

impl ::fbthrift::ThriftEnum for Color {
    fn enumerate() -> &'static [(Self, &'static str)] {
        &[
            (Self::UNKNOWN, "UNKNOWN"),
            (Self::RED, "RED"),
            (Self::GREEN, "GREEN"),
            (Self::BLUE, "BLUE"),
        ]
    }

    fn variants() -> &'static [&'static str] {
        &[
            "UNKNOWN",
            "RED",
            "GREEN",
            "BLUE",
        ]
    }

    fn variant_values() -> &'static [Self] {
        &[
            Self::UNKNOWN,
            Self::RED,
            Self::GREEN,
            Self::BLUE,
        ]
    }
}

impl ::std::default::Default for Color {
    fn default() -> Self {
        Self(::fbthrift::__UNKNOWN_ID)
    }
}

impl<'a> ::std::convert::From<&'a Color> for ::std::primitive::i32 {
    #[inline]
    fn from(x: &'a Color) -> Self {
        x.0
    }
}

impl ::std::convert::From<Color> for ::std::primitive::i32 {
    #[inline]
    fn from(x: Color) -> Self {
        x.0
    }
}

impl ::std::convert::From<::std::primitive::i32> for Color {
    #[inline]
    fn from(x: ::std::primitive::i32) -> Self {
        Self(x)
    }
}

impl ::std::fmt::Display for Color {
    fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        static VARIANTS_BY_NUMBER: &[(&::std::primitive::str, ::std::primitive::i32)] = &[
            ("UNKNOWN", 0),
            ("RED", 1),
            ("GREEN", 2),
            ("BLUE", 3),
        ];
        ::fbthrift::help::enum_display(VARIANTS_BY_NUMBER, fmt, self.0)
    }
}

impl ::std::fmt::Debug for Color {
    fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        write!(fmt, "Color::{}", self)
    }
}

impl ::std::str::FromStr for Color {
    type Err = ::anyhow::Error;

    fn from_str(string: &::std::primitive::str) -> ::std::result::Result<Self, Self::Err> {
        static VARIANTS_BY_NAME: &[(&::std::primitive::str, ::std::primitive::i32)] = &[
            ("BLUE", 3),
            ("GREEN", 2),
            ("RED", 1),
            ("UNKNOWN", 0),
        ];
        ::fbthrift::help::enum_from_str(VARIANTS_BY_NAME, string, "Color").map(Self)
    }
}

impl ::fbthrift::GetTType for Color {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::I32;
}

impl ::fbthrift::GetUri for self::Color {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/Color"
    }
}

impl<P> ::fbthrift::Serialize<P> for Color
where
    P: ::fbthrift::ProtocolWriter,
{
    #[inline]
    fn write(&self, p: &mut P) {
        p.write_i32(self.into())
    }
}

impl<P> ::fbthrift::Deserialize<P> for Color
where
    P: ::fbthrift::ProtocolReader,
{
    #[inline]
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        ::std::result::Result::Ok(Self::from(p.read_i32()?))
    }
}

#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ThriftAdaptedEnum(pub ::std::primitive::i32);

impl ThriftAdaptedEnum {
    pub const Zero: Self = ThriftAdaptedEnum(0i32);
    pub const One: Self = ThriftAdaptedEnum(1i32);
}

impl ::fbthrift::ThriftEnum for ThriftAdaptedEnum {
    fn enumerate() -> &'static [(Self, &'static str)] {
        &[
            (Self::Zero, "Zero"),
            (Self::One, "One"),
        ]
    }

    fn variants() -> &'static [&'static str] {
        &[
            "Zero",
            "One",
        ]
    }

    fn variant_values() -> &'static [Self] {
        &[
            Self::Zero,
            Self::One,
        ]
    }
}

impl ::std::default::Default for ThriftAdaptedEnum {
    fn default() -> Self {
        Self(::fbthrift::__UNKNOWN_ID)
    }
}

impl<'a> ::std::convert::From<&'a ThriftAdaptedEnum> for ::std::primitive::i32 {
    #[inline]
    fn from(x: &'a ThriftAdaptedEnum) -> Self {
        x.0
    }
}

impl ::std::convert::From<ThriftAdaptedEnum> for ::std::primitive::i32 {
    #[inline]
    fn from(x: ThriftAdaptedEnum) -> Self {
        x.0
    }
}

impl ::std::convert::From<::std::primitive::i32> for ThriftAdaptedEnum {
    #[inline]
    fn from(x: ::std::primitive::i32) -> Self {
        Self(x)
    }
}

impl ::std::fmt::Display for ThriftAdaptedEnum {
    fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        static VARIANTS_BY_NUMBER: &[(&::std::primitive::str, ::std::primitive::i32)] = &[
            ("Zero", 0),
            ("One", 1),
        ];
        ::fbthrift::help::enum_display(VARIANTS_BY_NUMBER, fmt, self.0)
    }
}

impl ::std::fmt::Debug for ThriftAdaptedEnum {
    fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        write!(fmt, "ThriftAdaptedEnum::{}", self)
    }
}

impl ::std::str::FromStr for ThriftAdaptedEnum {
    type Err = ::anyhow::Error;

    fn from_str(string: &::std::primitive::str) -> ::std::result::Result<Self, Self::Err> {
        static VARIANTS_BY_NAME: &[(&::std::primitive::str, ::std::primitive::i32)] = &[
            ("One", 1),
            ("Zero", 0),
        ];
        ::fbthrift::help::enum_from_str(VARIANTS_BY_NAME, string, "ThriftAdaptedEnum").map(Self)
    }
}

impl ::fbthrift::GetTType for ThriftAdaptedEnum {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::I32;
}

impl ::fbthrift::GetUri for self::ThriftAdaptedEnum {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/ThriftAdaptedEnum"
    }
}

impl<P> ::fbthrift::Serialize<P> for ThriftAdaptedEnum
where
    P: ::fbthrift::ProtocolWriter,
{
    #[inline]
    fn write(&self, p: &mut P) {
        p.write_i32(self.into())
    }
}

impl<P> ::fbthrift::Deserialize<P> for ThriftAdaptedEnum
where
    P: ::fbthrift::ProtocolReader,
{
    #[inline]
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        ::std::result::Result::Ok(Self::from(p.read_i32()?))
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::MyAnnotation {
    fn default() -> Self {
        Self {
            signature: ::std::default::Default::default(),
            color: crate::types::Color::RED,
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::MyAnnotation {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("MyAnnotation")
            .field("signature", &self.signature)
            .field("color", &self.color)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::MyAnnotation {}
unsafe impl ::std::marker::Sync for self::MyAnnotation {}
impl ::std::marker::Unpin for self::MyAnnotation {}

impl ::fbthrift::GetTType for self::MyAnnotation {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::MyAnnotation {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/MyAnnotation"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::MyAnnotation
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("MyAnnotation");
        p.write_field_begin("signature", ::fbthrift::TType::String, 1);
        ::fbthrift::Serialize::write(&self.signature, p);
        p.write_field_end();
        p.write_field_begin("color", ::fbthrift::TType::I32, 2);
        ::fbthrift::Serialize::write(&self.color, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::MyAnnotation
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("color", ::fbthrift::TType::I32, 2),
            ::fbthrift::Field::new("signature", ::fbthrift::TType::String, 1),
        ];
        let mut field_signature = ::std::option::Option::None;
        let mut field_color = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::String, 1) => field_signature = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::I32, 2) => field_color = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            signature: field_signature.unwrap_or_default(),
            color: field_color.unwrap_or(crate::types::Color::RED),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for MyAnnotation {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        if type_id == ::std::any::TypeId::of::<python::types::Adapter>() {
            let mut tmp = Some(python::types::Adapter {
                name: "my.module.Adapter2".to_owned(),
                typeHint: "my.another.module.AdaptedType2[]".to_owned(),
                ..::std::default::Default::default()
            });
            let r: &mut dyn ::std::any::Any = &mut tmp;
            let r: &mut Option<T> = r.downcast_mut().unwrap();
            return r.take();
        }

        if let Some(r) = <python::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
            return Some(r);
        }

        if type_id == ::std::any::TypeId::of::<scope::types::Transitive>() {
            let mut tmp = Some(scope::types::Transitive {
                ..::std::default::Default::default()
            });
            let r: &mut dyn ::std::any::Any = &mut tmp;
            let r: &mut Option<T> = r.downcast_mut().unwrap();
            return r.take();
        }

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {
            },
            2 => {
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::Foo {
    fn default() -> Self {
        Self {
            intField: <::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<Foo>(::std::default::Default::default(), 1),
            optionalIntField: ::std::option::Option::None,
            intFieldWithDefault: <::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<Foo>(13, 3),
            setField: <crate::types::adapters::SetWithAdapter as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<Foo>(::std::default::Default::default(), 4),
            optionalSetField: ::std::option::Option::None,
            mapField: <::fbthrift::adapter::LayeredThriftAdapter<::my::Adapter3, ::fbthrift::adapter::MapMapAdapter<::fbthrift::adapter::IdentityAdapter<::std::string::String>, crate::types::adapters::ListWithElemAdapter_withAdapter>> as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<Foo>(::std::default::Default::default(), 6),
            optionalMapField: ::std::option::Option::None,
            binaryField: <::my::Adapter3 as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<Foo>(::std::default::Default::default(), 8),
            longField: <crate::types::adapters::MyI64 as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<Foo>(::std::default::Default::default(), 9),
            adaptedLongField: <::fbthrift::adapter::LayeredThriftAdapter<::my::Adapter2, crate::types::adapters::MyI64> as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<Foo>(::std::default::Default::default(), 10),
            doubleAdaptedField: <crate::types::adapters::MyI64 as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<Foo>(::std::default::Default::default(), 11),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::Foo {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("Foo")
            .field("intField", &self.intField)
            .field("optionalIntField", &self.optionalIntField)
            .field("intFieldWithDefault", &self.intFieldWithDefault)
            .field("setField", &self.setField)
            .field("optionalSetField", &self.optionalSetField)
            .field("mapField", &self.mapField)
            .field("optionalMapField", &self.optionalMapField)
            .field("binaryField", &self.binaryField)
            .field("longField", &self.longField)
            .field("adaptedLongField", &self.adaptedLongField)
            .field("doubleAdaptedField", &self.doubleAdaptedField)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::Foo {}
unsafe impl ::std::marker::Sync for self::Foo {}
impl ::std::marker::Unpin for self::Foo {}

impl ::fbthrift::GetTType for self::Foo {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::Foo {
    fn uri() -> &'static str {
        "facebook.com/thrift/compiler/test/fixtures/adapter/src/module/Foo"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::Foo
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("Foo");
        p.write_field_begin("intField", ::fbthrift::TType::I32, 1);
        ::fbthrift::Serialize::write(&<::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<Foo>(&self.intField, 1), p);
        p.write_field_end();
        if let ::std::option::Option::Some(some) = &self.optionalIntField {
            p.write_field_begin("optionalIntField", ::fbthrift::TType::I32, 2);
            ::fbthrift::Serialize::write(&<::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<Foo>(some, 2), p);
            p.write_field_end();
        }
        p.write_field_begin("intFieldWithDefault", ::fbthrift::TType::I32, 3);
        ::fbthrift::Serialize::write(&<::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<Foo>(&self.intFieldWithDefault, 3), p);
        p.write_field_end();
        p.write_field_begin("setField", ::fbthrift::TType::Set, 4);
        ::fbthrift::Serialize::write(&<crate::types::adapters::SetWithAdapter as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<Foo>(&self.setField, 4), p);
        p.write_field_end();
        if let ::std::option::Option::Some(some) = &self.optionalSetField {
            p.write_field_begin("optionalSetField", ::fbthrift::TType::Set, 5);
            ::fbthrift::Serialize::write(&<crate::types::adapters::SetWithAdapter as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<Foo>(some, 5), p);
            p.write_field_end();
        }
        p.write_field_begin("mapField", ::fbthrift::TType::Map, 6);
        ::fbthrift::Serialize::write(&<::fbthrift::adapter::LayeredThriftAdapter<::my::Adapter3, ::fbthrift::adapter::MapMapAdapter<::fbthrift::adapter::IdentityAdapter<::std::string::String>, crate::types::adapters::ListWithElemAdapter_withAdapter>> as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<Foo>(&self.mapField, 6), p);
        p.write_field_end();
        if let ::std::option::Option::Some(some) = &self.optionalMapField {
            p.write_field_begin("optionalMapField", ::fbthrift::TType::Map, 7);
            ::fbthrift::Serialize::write(&<::fbthrift::adapter::LayeredThriftAdapter<::my::Adapter3, ::fbthrift::adapter::MapMapAdapter<::fbthrift::adapter::IdentityAdapter<::std::string::String>, crate::types::adapters::ListWithElemAdapter_withAdapter>> as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<Foo>(some, 7), p);
            p.write_field_end();
        }
        p.write_field_begin("binaryField", ::fbthrift::TType::String, 8);
        ::fbthrift::Serialize::write(&<::my::Adapter3 as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<Foo>(&self.binaryField, 8), p);
        p.write_field_end();
        p.write_field_begin("longField", ::fbthrift::TType::I64, 9);
        ::fbthrift::Serialize::write(&<crate::types::adapters::MyI64 as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<Foo>(&self.longField, 9), p);
        p.write_field_end();
        p.write_field_begin("adaptedLongField", ::fbthrift::TType::I64, 10);
        ::fbthrift::Serialize::write(&<::fbthrift::adapter::LayeredThriftAdapter<::my::Adapter2, crate::types::adapters::MyI64> as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<Foo>(&self.adaptedLongField, 10), p);
        p.write_field_end();
        p.write_field_begin("doubleAdaptedField", ::fbthrift::TType::I64, 11);
        ::fbthrift::Serialize::write(&<crate::types::adapters::MyI64 as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<Foo>(&self.doubleAdaptedField, 11), p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::Foo
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("adaptedLongField", ::fbthrift::TType::I64, 10),
            ::fbthrift::Field::new("binaryField", ::fbthrift::TType::String, 8),
            ::fbthrift::Field::new("doubleAdaptedField", ::fbthrift::TType::I64, 11),
            ::fbthrift::Field::new("intField", ::fbthrift::TType::I32, 1),
            ::fbthrift::Field::new("intFieldWithDefault", ::fbthrift::TType::I32, 3),
            ::fbthrift::Field::new("longField", ::fbthrift::TType::I64, 9),
            ::fbthrift::Field::new("mapField", ::fbthrift::TType::Map, 6),
            ::fbthrift::Field::new("optionalIntField", ::fbthrift::TType::I32, 2),
            ::fbthrift::Field::new("optionalMapField", ::fbthrift::TType::Map, 7),
            ::fbthrift::Field::new("optionalSetField", ::fbthrift::TType::Set, 5),
            ::fbthrift::Field::new("setField", ::fbthrift::TType::Set, 4),
        ];
        let mut field_intField = ::std::option::Option::None;
        let mut field_optionalIntField = ::std::option::Option::None;
        let mut field_intFieldWithDefault = ::std::option::Option::None;
        let mut field_setField = ::std::option::Option::None;
        let mut field_optionalSetField = ::std::option::Option::None;
        let mut field_mapField = ::std::option::Option::None;
        let mut field_optionalMapField = ::std::option::Option::None;
        let mut field_binaryField = ::std::option::Option::None;
        let mut field_longField = ::std::option::Option::None;
        let mut field_adaptedLongField = ::std::option::Option::None;
        let mut field_doubleAdaptedField = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::I32, 1) => field_intField = ::std::option::Option::Some(<::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<Foo>(::fbthrift::Deserialize::read(p)?, 1)?),
                (::fbthrift::TType::I32, 2) => field_optionalIntField = ::std::option::Option::Some(<::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<Foo>(::fbthrift::Deserialize::read(p)?, 2)?),
                (::fbthrift::TType::I32, 3) => field_intFieldWithDefault = ::std::option::Option::Some(<::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<Foo>(::fbthrift::Deserialize::read(p)?, 3)?),
                (::fbthrift::TType::Set, 4) => field_setField = ::std::option::Option::Some(<crate::types::adapters::SetWithAdapter as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<Foo>(::fbthrift::Deserialize::read(p)?, 4)?),
                (::fbthrift::TType::Set, 5) => field_optionalSetField = ::std::option::Option::Some(<crate::types::adapters::SetWithAdapter as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<Foo>(::fbthrift::Deserialize::read(p)?, 5)?),
                (::fbthrift::TType::Map, 6) => field_mapField = ::std::option::Option::Some(<::fbthrift::adapter::LayeredThriftAdapter<::my::Adapter3, ::fbthrift::adapter::MapMapAdapter<::fbthrift::adapter::IdentityAdapter<::std::string::String>, crate::types::adapters::ListWithElemAdapter_withAdapter>> as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<Foo>(::fbthrift::Deserialize::read(p)?, 6)?),
                (::fbthrift::TType::Map, 7) => field_optionalMapField = ::std::option::Option::Some(<::fbthrift::adapter::LayeredThriftAdapter<::my::Adapter3, ::fbthrift::adapter::MapMapAdapter<::fbthrift::adapter::IdentityAdapter<::std::string::String>, crate::types::adapters::ListWithElemAdapter_withAdapter>> as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<Foo>(::fbthrift::Deserialize::read(p)?, 7)?),
                (::fbthrift::TType::String, 8) => field_binaryField = ::std::option::Option::Some(<::my::Adapter3 as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<Foo>(::fbthrift::Deserialize::read(p)?, 8)?),
                (::fbthrift::TType::I64, 9) => field_longField = ::std::option::Option::Some(<crate::types::adapters::MyI64 as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<Foo>(::fbthrift::Deserialize::read(p)?, 9)?),
                (::fbthrift::TType::I64, 10) => field_adaptedLongField = ::std::option::Option::Some(<::fbthrift::adapter::LayeredThriftAdapter<::my::Adapter2, crate::types::adapters::MyI64> as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<Foo>(::fbthrift::Deserialize::read(p)?, 10)?),
                (::fbthrift::TType::I64, 11) => field_doubleAdaptedField = ::std::option::Option::Some(<crate::types::adapters::MyI64 as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<Foo>(::fbthrift::Deserialize::read(p)?, 11)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            intField: field_intField.unwrap_or_else(|| <::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<Foo>(::std::default::Default::default(), 1)),
            optionalIntField: field_optionalIntField,
            intFieldWithDefault: field_intFieldWithDefault.unwrap_or_else(|| <::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<Foo>(13, 3)),
            setField: field_setField.unwrap_or_else(|| <crate::types::adapters::SetWithAdapter as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<Foo>(::std::default::Default::default(), 4)),
            optionalSetField: field_optionalSetField,
            mapField: field_mapField.unwrap_or_else(|| <::fbthrift::adapter::LayeredThriftAdapter<::my::Adapter3, ::fbthrift::adapter::MapMapAdapter<::fbthrift::adapter::IdentityAdapter<::std::string::String>, crate::types::adapters::ListWithElemAdapter_withAdapter>> as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<Foo>(::std::default::Default::default(), 6)),
            optionalMapField: field_optionalMapField,
            binaryField: field_binaryField.unwrap_or_else(|| <::my::Adapter3 as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<Foo>(::std::default::Default::default(), 8)),
            longField: field_longField.unwrap_or_else(|| <crate::types::adapters::MyI64 as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<Foo>(::std::default::Default::default(), 9)),
            adaptedLongField: field_adaptedLongField.unwrap_or_else(|| <::fbthrift::adapter::LayeredThriftAdapter<::my::Adapter2, crate::types::adapters::MyI64> as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<Foo>(::std::default::Default::default(), 10)),
            doubleAdaptedField: field_doubleAdaptedField.unwrap_or_else(|| <crate::types::adapters::MyI64 as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<Foo>(::std::default::Default::default(), 11)),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for Foo {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {

                if type_id == ::std::any::TypeId::of::<hack::types::Adapter>() {
                    let mut tmp = Some(hack::types::Adapter {
                        name: "\\Adapter1".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<rust::types::Adapter>() {
                    let mut tmp = Some(rust::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            2 => {

                if type_id == ::std::any::TypeId::of::<hack::types::Adapter>() {
                    let mut tmp = Some(hack::types::Adapter {
                        name: "\\Adapter1".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<rust::types::Adapter>() {
                    let mut tmp = Some(rust::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            3 => {

                if type_id == ::std::any::TypeId::of::<hack::types::Adapter>() {
                    let mut tmp = Some(hack::types::Adapter {
                        name: "\\Adapter1".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<rust::types::Adapter>() {
                    let mut tmp = Some(rust::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            4 => {
            },
            5 => {
            },
            6 => {

                if type_id == ::std::any::TypeId::of::<hack::types::Adapter>() {
                    let mut tmp = Some(hack::types::Adapter {
                        name: "\\Adapter3".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter3".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<rust::types::Adapter>() {
                    let mut tmp = Some(rust::types::Adapter {
                        name: "::my::Adapter3".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            7 => {

                if type_id == ::std::any::TypeId::of::<hack::types::Adapter>() {
                    let mut tmp = Some(hack::types::Adapter {
                        name: "\\Adapter3".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter3".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<rust::types::Adapter>() {
                    let mut tmp = Some(rust::types::Adapter {
                        name: "::my::Adapter3".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            8 => {

                if type_id == ::std::any::TypeId::of::<hack::types::Adapter>() {
                    let mut tmp = Some(hack::types::Adapter {
                        name: "\\Adapter1".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter3".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<rust::types::Adapter>() {
                    let mut tmp = Some(rust::types::Adapter {
                        name: "::my::Adapter3".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            9 => {
            },
            10 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter2".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<python::types::Adapter>() {
                    let mut tmp = Some(python::types::Adapter {
                        name: "my.Adapter3".to_owned(),
                        typeHint: "my.AdaptedType3[]".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <python::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<rust::types::Adapter>() {
                    let mut tmp = Some(rust::types::Adapter {
                        name: "::my::Adapter2".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            11 => {
            },
            _ => {}
        }

        None
    }
}

impl ::std::default::Default for Baz {
    fn default() -> Self {
        Self::UnknownField(-1)
    }
}

impl ::fbthrift::GetTType for Baz {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::Baz {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/Baz"
    }
}

impl<P> ::fbthrift::Serialize<P> for Baz
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("Baz");
        match self {
            Self::intField(inner) => {
                p.write_field_begin("intField", ::fbthrift::TType::I32, 1);
                ::fbthrift::Serialize::write(&<::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<Baz>(&inner, 1), p);
                p.write_field_end();
            }
            Self::setField(inner) => {
                p.write_field_begin("setField", ::fbthrift::TType::Set, 4);
                ::fbthrift::Serialize::write(&<crate::types::adapters::SetWithAdapter as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<Baz>(&inner, 4), p);
                p.write_field_end();
            }
            Self::mapField(inner) => {
                p.write_field_begin("mapField", ::fbthrift::TType::Map, 6);
                ::fbthrift::Serialize::write(&<::fbthrift::adapter::LayeredThriftAdapter<::my::Adapter3, ::fbthrift::adapter::MapMapAdapter<::fbthrift::adapter::IdentityAdapter<::std::string::String>, crate::types::adapters::ListWithElemAdapter_withAdapter>> as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<Baz>(&inner, 6), p);
                p.write_field_end();
            }
            Self::binaryField(inner) => {
                p.write_field_begin("binaryField", ::fbthrift::TType::String, 8);
                ::fbthrift::Serialize::write(&<::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<Baz>(&inner, 8), p);
                p.write_field_end();
            }
            Self::longField(inner) => {
                p.write_field_begin("longField", ::fbthrift::TType::I64, 9);
                ::fbthrift::Serialize::write(&<crate::types::adapters::MyI64 as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<Baz>(&inner, 9), p);
                p.write_field_end();
            }
            Self::UnknownField(_) => {}
        }
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for Baz
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("binaryField", ::fbthrift::TType::String, 8),
            ::fbthrift::Field::new("intField", ::fbthrift::TType::I32, 1),
            ::fbthrift::Field::new("longField", ::fbthrift::TType::I64, 9),
            ::fbthrift::Field::new("mapField", ::fbthrift::TType::Map, 6),
            ::fbthrift::Field::new("setField", ::fbthrift::TType::Set, 4),
        ];
        let _ = p.read_struct_begin(|_| ())?;
        let mut once = false;
        let mut alt = ::std::option::Option::None;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32, once) {
                (::fbthrift::TType::Stop, _, _) => break,
                (::fbthrift::TType::I32, 1, false) => {
                    once = true;
                    alt = ::std::option::Option::Some(Self::intField(<::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<Baz>(::fbthrift::Deserialize::read(p)?, 1)?));
                }
                (::fbthrift::TType::Set, 4, false) => {
                    once = true;
                    alt = ::std::option::Option::Some(Self::setField(<crate::types::adapters::SetWithAdapter as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<Baz>(::fbthrift::Deserialize::read(p)?, 4)?));
                }
                (::fbthrift::TType::Map, 6, false) => {
                    once = true;
                    alt = ::std::option::Option::Some(Self::mapField(<::fbthrift::adapter::LayeredThriftAdapter<::my::Adapter3, ::fbthrift::adapter::MapMapAdapter<::fbthrift::adapter::IdentityAdapter<::std::string::String>, crate::types::adapters::ListWithElemAdapter_withAdapter>> as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<Baz>(::fbthrift::Deserialize::read(p)?, 6)?));
                }
                (::fbthrift::TType::String, 8, false) => {
                    once = true;
                    alt = ::std::option::Option::Some(Self::binaryField(<::my::Adapter1 as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<Baz>(::fbthrift::Deserialize::read(p)?, 8)?));
                }
                (::fbthrift::TType::I64, 9, false) => {
                    once = true;
                    alt = ::std::option::Option::Some(Self::longField(<crate::types::adapters::MyI64 as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<Baz>(::fbthrift::Deserialize::read(p)?, 9)?));
                }
                (fty, _, false) => p.skip(fty)?,
                (badty, badid, true) => return ::std::result::Result::Err(::std::convert::From::from(::fbthrift::ProtocolError::UnwantedExtraUnionField(
                    "Baz".to_string(),
                    badty,
                    badid,
                ))),
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(alt.unwrap_or_default())
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for Baz {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {

                if type_id == ::std::any::TypeId::of::<hack::types::Adapter>() {
                    let mut tmp = Some(hack::types::Adapter {
                        name: "\\Adapter1".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<rust::types::Adapter>() {
                    let mut tmp = Some(rust::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            4 => {
            },
            6 => {

                if type_id == ::std::any::TypeId::of::<hack::types::Adapter>() {
                    let mut tmp = Some(hack::types::Adapter {
                        name: "\\Adapter3".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter3".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<rust::types::Adapter>() {
                    let mut tmp = Some(rust::types::Adapter {
                        name: "::my::Adapter3".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            8 => {

                if type_id == ::std::any::TypeId::of::<hack::types::Adapter>() {
                    let mut tmp = Some(hack::types::Adapter {
                        name: "\\Adapter1".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<rust::types::Adapter>() {
                    let mut tmp = Some(rust::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            9 => {
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::Bar {
    fn default() -> Self {
        Self {
            structField: ::std::default::Default::default(),
            optionalStructField: ::std::option::Option::None,
            structListField: <::fbthrift::adapter::ListMapAdapter<crate::types::adapters::FooWithAdapter> as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<Bar>(::std::default::Default::default(), 3),
            optionalStructListField: ::std::option::Option::None,
            unionField: ::std::default::Default::default(),
            optionalUnionField: ::std::option::Option::None,
            adaptedStructField: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::Bar {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("Bar")
            .field("structField", &self.structField)
            .field("optionalStructField", &self.optionalStructField)
            .field("structListField", &self.structListField)
            .field("optionalStructListField", &self.optionalStructListField)
            .field("unionField", &self.unionField)
            .field("optionalUnionField", &self.optionalUnionField)
            .field("adaptedStructField", &self.adaptedStructField)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::Bar {}
unsafe impl ::std::marker::Sync for self::Bar {}
impl ::std::marker::Unpin for self::Bar {}

impl ::fbthrift::GetTType for self::Bar {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::Bar {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/Bar"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::Bar
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("Bar");
        p.write_field_begin("structField", ::fbthrift::TType::Struct, 1);
        ::fbthrift::Serialize::write(&self.structField, p);
        p.write_field_end();
        if let ::std::option::Option::Some(some) = &self.optionalStructField {
            p.write_field_begin("optionalStructField", ::fbthrift::TType::Struct, 2);
            ::fbthrift::Serialize::write(some, p);
            p.write_field_end();
        }
        p.write_field_begin("structListField", ::fbthrift::TType::List, 3);
        ::fbthrift::Serialize::write(&<::fbthrift::adapter::ListMapAdapter<crate::types::adapters::FooWithAdapter> as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<Bar>(&self.structListField, 3), p);
        p.write_field_end();
        if let ::std::option::Option::Some(some) = &self.optionalStructListField {
            p.write_field_begin("optionalStructListField", ::fbthrift::TType::List, 4);
            ::fbthrift::Serialize::write(&<::fbthrift::adapter::ListMapAdapter<crate::types::adapters::FooWithAdapter> as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<Bar>(some, 4), p);
            p.write_field_end();
        }
        p.write_field_begin("unionField", ::fbthrift::TType::Struct, 5);
        ::fbthrift::Serialize::write(&self.unionField, p);
        p.write_field_end();
        if let ::std::option::Option::Some(some) = &self.optionalUnionField {
            p.write_field_begin("optionalUnionField", ::fbthrift::TType::Struct, 6);
            ::fbthrift::Serialize::write(some, p);
            p.write_field_end();
        }
        p.write_field_begin("adaptedStructField", ::fbthrift::TType::Struct, 7);
        ::fbthrift::Serialize::write(&self.adaptedStructField, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::Bar
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("adaptedStructField", ::fbthrift::TType::Struct, 7),
            ::fbthrift::Field::new("optionalStructField", ::fbthrift::TType::Struct, 2),
            ::fbthrift::Field::new("optionalStructListField", ::fbthrift::TType::List, 4),
            ::fbthrift::Field::new("optionalUnionField", ::fbthrift::TType::Struct, 6),
            ::fbthrift::Field::new("structField", ::fbthrift::TType::Struct, 1),
            ::fbthrift::Field::new("structListField", ::fbthrift::TType::List, 3),
            ::fbthrift::Field::new("unionField", ::fbthrift::TType::Struct, 5),
        ];
        let mut field_structField = ::std::option::Option::None;
        let mut field_optionalStructField = ::std::option::Option::None;
        let mut field_structListField = ::std::option::Option::None;
        let mut field_optionalStructListField = ::std::option::Option::None;
        let mut field_unionField = ::std::option::Option::None;
        let mut field_optionalUnionField = ::std::option::Option::None;
        let mut field_adaptedStructField = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::Struct, 1) => field_structField = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 2) => field_optionalStructField = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::List, 3) => field_structListField = ::std::option::Option::Some(<::fbthrift::adapter::ListMapAdapter<crate::types::adapters::FooWithAdapter> as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<Bar>(::fbthrift::Deserialize::read(p)?, 3)?),
                (::fbthrift::TType::List, 4) => field_optionalStructListField = ::std::option::Option::Some(<::fbthrift::adapter::ListMapAdapter<crate::types::adapters::FooWithAdapter> as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<Bar>(::fbthrift::Deserialize::read(p)?, 4)?),
                (::fbthrift::TType::Struct, 5) => field_unionField = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 6) => field_optionalUnionField = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 7) => field_adaptedStructField = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            structField: field_structField.unwrap_or_default(),
            optionalStructField: field_optionalStructField,
            structListField: field_structListField.unwrap_or_else(|| <::fbthrift::adapter::ListMapAdapter<crate::types::adapters::FooWithAdapter> as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<Bar>(::std::default::Default::default(), 3)),
            optionalStructListField: field_optionalStructListField,
            unionField: field_unionField.unwrap_or_default(),
            optionalUnionField: field_optionalUnionField,
            adaptedStructField: field_adaptedStructField.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for Bar {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {

                if type_id == ::std::any::TypeId::of::<hack::types::Adapter>() {
                    let mut tmp = Some(hack::types::Adapter {
                        name: "\\Adapter1".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        adaptedType: "::my::Cpp::Type1".to_owned(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }
            },
            2 => {

                if type_id == ::std::any::TypeId::of::<hack::types::Adapter>() {
                    let mut tmp = Some(hack::types::Adapter {
                        name: "\\Adapter1".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }
            },
            3 => {
            },
            4 => {
            },
            5 => {

                if type_id == ::std::any::TypeId::of::<hack::types::Adapter>() {
                    let mut tmp = Some(hack::types::Adapter {
                        name: "\\Adapter1".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }
            },
            6 => {

                if type_id == ::std::any::TypeId::of::<hack::types::Adapter>() {
                    let mut tmp = Some(hack::types::Adapter {
                        name: "\\Adapter1".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }
            },
            7 => {
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::DirectlyAdapted {
    fn default() -> Self {
        Self {
            field: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::DirectlyAdapted {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("DirectlyAdapted")
            .field("field", &self.field)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::DirectlyAdapted {}
unsafe impl ::std::marker::Sync for self::DirectlyAdapted {}
impl ::std::marker::Unpin for self::DirectlyAdapted {}

impl ::fbthrift::GetTType for self::DirectlyAdapted {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::DirectlyAdapted {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/DirectlyAdapted"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::DirectlyAdapted
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("DirectlyAdapted");
        p.write_field_begin("field", ::fbthrift::TType::I32, 1);
        ::fbthrift::Serialize::write(&self.field, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::DirectlyAdapted
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("field", ::fbthrift::TType::I32, 1),
        ];
        let mut field_field = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::I32, 1) => field_field = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            field: field_field.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for DirectlyAdapted {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
            let mut tmp = Some(cpp::types::Adapter {
                name: "::my::Adapter".to_owned(),
                adaptedType: ::std::default::Default::default(),
                underlyingName: ::std::default::Default::default(),
                extraNamespace: ::std::default::Default::default(),
                moveOnly: ::std::default::Default::default(),
                ..::std::default::Default::default()
            });
            let r: &mut dyn ::std::any::Any = &mut tmp;
            let r: &mut Option<T> = r.downcast_mut().unwrap();
            return r.take();
        }

        if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
            return Some(r);
        }

        if type_id == ::std::any::TypeId::of::<python::types::Adapter>() {
            let mut tmp = Some(python::types::Adapter {
                name: "my.module.Adapter".to_owned(),
                typeHint: "my.another.module.AdaptedType".to_owned(),
                ..::std::default::Default::default()
            });
            let r: &mut dyn ::std::any::Any = &mut tmp;
            let r: &mut Option<T> = r.downcast_mut().unwrap();
            return r.take();
        }

        if let Some(r) = <python::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
            return Some(r);
        }

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::IndependentDirectlyAdapted {
    fn default() -> Self {
        Self {
            field: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::IndependentDirectlyAdapted {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("IndependentDirectlyAdapted")
            .field("field", &self.field)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::IndependentDirectlyAdapted {}
unsafe impl ::std::marker::Sync for self::IndependentDirectlyAdapted {}
impl ::std::marker::Unpin for self::IndependentDirectlyAdapted {}

impl ::fbthrift::GetTType for self::IndependentDirectlyAdapted {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::IndependentDirectlyAdapted {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/IndependentDirectlyAdapted"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::IndependentDirectlyAdapted
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("IndependentDirectlyAdapted");
        p.write_field_begin("field", ::fbthrift::TType::I32, 1);
        ::fbthrift::Serialize::write(&self.field, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::IndependentDirectlyAdapted
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("field", ::fbthrift::TType::I32, 1),
        ];
        let mut field_field = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::I32, 1) => field_field = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            field: field_field.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for IndependentDirectlyAdapted {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
            let mut tmp = Some(cpp::types::Adapter {
                name: "::my::Adapter".to_owned(),
                adaptedType: "::my::Type".to_owned(),
                underlyingName: ::std::default::Default::default(),
                extraNamespace: ::std::default::Default::default(),
                moveOnly: ::std::default::Default::default(),
                ..::std::default::Default::default()
            });
            let r: &mut dyn ::std::any::Any = &mut tmp;
            let r: &mut Option<T> = r.downcast_mut().unwrap();
            return r.take();
        }

        if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
            return Some(r);
        }

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::StructWithFieldAdapter {
    fn default() -> Self {
        Self {
            field: <::my::Adapter1<::std::primitive::i32> as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<StructWithFieldAdapter>(::std::default::Default::default(), 1),
            shared_field: ::std::default::Default::default(),
            opt_shared_field: ::std::option::Option::None,
            opt_boxed_field: ::std::option::Option::None,
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::StructWithFieldAdapter {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("StructWithFieldAdapter")
            .field("field", &self.field)
            .field("shared_field", &self.shared_field)
            .field("opt_shared_field", &self.opt_shared_field)
            .field("opt_boxed_field", &self.opt_boxed_field)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::StructWithFieldAdapter {}
unsafe impl ::std::marker::Sync for self::StructWithFieldAdapter {}
impl ::std::marker::Unpin for self::StructWithFieldAdapter {}

impl ::fbthrift::GetTType for self::StructWithFieldAdapter {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::StructWithFieldAdapter {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/StructWithFieldAdapter"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::StructWithFieldAdapter
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("StructWithFieldAdapter");
        p.write_field_begin("field", ::fbthrift::TType::I32, 1);
        ::fbthrift::Serialize::write(&<::my::Adapter1<::std::primitive::i32> as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<StructWithFieldAdapter>(&self.field, 1), p);
        p.write_field_end();
        p.write_field_begin("shared_field", ::fbthrift::TType::I32, 2);
        ::fbthrift::Serialize::write(&self.shared_field, p);
        p.write_field_end();
        if let ::std::option::Option::Some(some) = &self.opt_shared_field {
            p.write_field_begin("opt_shared_field", ::fbthrift::TType::I32, 3);
            ::fbthrift::Serialize::write(&<::my::Adapter1<::std::primitive::i32> as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<StructWithFieldAdapter>(some, 3), p);
            p.write_field_end();
        }
        if let ::std::option::Option::Some(some) = &self.opt_boxed_field {
            p.write_field_begin("opt_boxed_field", ::fbthrift::TType::I32, 4);
            ::fbthrift::Serialize::write(some, p);
            p.write_field_end();
        }
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::StructWithFieldAdapter
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("field", ::fbthrift::TType::I32, 1),
            ::fbthrift::Field::new("opt_boxed_field", ::fbthrift::TType::I32, 4),
            ::fbthrift::Field::new("opt_shared_field", ::fbthrift::TType::I32, 3),
            ::fbthrift::Field::new("shared_field", ::fbthrift::TType::I32, 2),
        ];
        let mut field_field = ::std::option::Option::None;
        let mut field_shared_field = ::std::option::Option::None;
        let mut field_opt_shared_field = ::std::option::Option::None;
        let mut field_opt_boxed_field = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::I32, 1) => field_field = ::std::option::Option::Some(<::my::Adapter1<::std::primitive::i32> as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<StructWithFieldAdapter>(::fbthrift::Deserialize::read(p)?, 1)?),
                (::fbthrift::TType::I32, 2) => field_shared_field = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::I32, 3) => field_opt_shared_field = ::std::option::Option::Some(<::my::Adapter1<::std::primitive::i32> as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<StructWithFieldAdapter>(::fbthrift::Deserialize::read(p)?, 3)?),
                (::fbthrift::TType::I32, 4) => field_opt_boxed_field = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            field: field_field.unwrap_or_else(|| <::my::Adapter1<::std::primitive::i32> as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<StructWithFieldAdapter>(::std::default::Default::default(), 1)),
            shared_field: field_shared_field.unwrap_or_default(),
            opt_shared_field: field_opt_shared_field,
            opt_boxed_field: field_opt_boxed_field,
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for StructWithFieldAdapter {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<python::types::Adapter>() {
                    let mut tmp = Some(python::types::Adapter {
                        name: "my.Adapter1".to_owned(),
                        typeHint: "my.AdaptedType1".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <python::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<rust::types::Adapter>() {
                    let mut tmp = Some(rust::types::Adapter {
                        name: "::my::Adapter1<>".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            2 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<cpp::types::Ref>() {
                    let mut tmp = Some(cpp::types::Ref {
                        r#type: cpp::types::RefType(1),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            3 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<cpp::types::Ref>() {
                    let mut tmp = Some(cpp::types::Ref {
                        r#type: cpp::types::RefType(1),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if type_id == ::std::any::TypeId::of::<rust::types::Adapter>() {
                    let mut tmp = Some(rust::types::Adapter {
                        name: "::my::Adapter1<>".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            4 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<thrift::types::Box>() {
                    let mut tmp = Some(thrift::types::Box {
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::TerseAdaptedFields {
    fn default() -> Self {
        Self {
            int_field: ::std::default::Default::default(),
            string_field: ::std::default::Default::default(),
            set_field: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::TerseAdaptedFields {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("TerseAdaptedFields")
            .field("int_field", &self.int_field)
            .field("string_field", &self.string_field)
            .field("set_field", &self.set_field)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::TerseAdaptedFields {}
unsafe impl ::std::marker::Sync for self::TerseAdaptedFields {}
impl ::std::marker::Unpin for self::TerseAdaptedFields {}

impl ::fbthrift::GetTType for self::TerseAdaptedFields {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::TerseAdaptedFields {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/TerseAdaptedFields"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::TerseAdaptedFields
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("TerseAdaptedFields");
        p.write_field_begin("int_field", ::fbthrift::TType::I32, 1);
        ::fbthrift::Serialize::write(&self.int_field, p);
        p.write_field_end();
        p.write_field_begin("string_field", ::fbthrift::TType::String, 2);
        ::fbthrift::Serialize::write(&self.string_field, p);
        p.write_field_end();
        p.write_field_begin("set_field", ::fbthrift::TType::Set, 3);
        ::fbthrift::Serialize::write(&self.set_field, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::TerseAdaptedFields
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("int_field", ::fbthrift::TType::I32, 1),
            ::fbthrift::Field::new("set_field", ::fbthrift::TType::Set, 3),
            ::fbthrift::Field::new("string_field", ::fbthrift::TType::String, 2),
        ];
        let mut field_int_field = ::std::option::Option::None;
        let mut field_string_field = ::std::option::Option::None;
        let mut field_set_field = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::I32, 1) => field_int_field = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::String, 2) => field_string_field = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Set, 3) => field_set_field = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            int_field: field_int_field.unwrap_or_default(),
            string_field: field_string_field.unwrap_or_default(),
            set_field: field_set_field.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for TerseAdaptedFields {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<thrift::types::TerseWrite>() {
                    let mut tmp = Some(thrift::types::TerseWrite {
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            2 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<thrift::types::TerseWrite>() {
                    let mut tmp = Some(thrift::types::TerseWrite {
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            3 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::my::Adapter1".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<thrift::types::TerseWrite>() {
                    let mut tmp = Some(thrift::types::TerseWrite {
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::B {
    fn default() -> Self {
        Self {
            a: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::B {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("B")
            .field("a", &self.a)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::B {}
unsafe impl ::std::marker::Sync for self::B {}
impl ::std::marker::Unpin for self::B {}

impl ::fbthrift::GetTType for self::B {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::B {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/B"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::B
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("B");
        p.write_field_begin("a", ::fbthrift::TType::Struct, 1);
        ::fbthrift::Serialize::write(&self.a, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::B
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("a", ::fbthrift::TType::Struct, 1),
        ];
        let mut field_a = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::Struct, 1) => field_a = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            a: field_a.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for B {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::A {
    fn default() -> Self {
        Self {
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::A {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("A")
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::A {}
unsafe impl ::std::marker::Sync for self::A {}
impl ::std::marker::Unpin for self::A {}

impl ::fbthrift::GetTType for self::A {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::A {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/A"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::A
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("A");
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::A
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
        ];
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for A {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::Config {
    fn default() -> Self {
        Self {
            path: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::Config {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("Config")
            .field("path", &self.path)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::Config {}
unsafe impl ::std::marker::Sync for self::Config {}
impl ::std::marker::Unpin for self::Config {}

impl ::fbthrift::GetTType for self::Config {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::Config {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/Config"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::Config
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("Config");
        p.write_field_begin("path", ::fbthrift::TType::String, 1);
        ::fbthrift::Serialize::write(&self.path, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::Config
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("path", ::fbthrift::TType::String, 1),
        ];
        let mut field_path = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::String, 1) => field_path = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            path: field_path.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for Config {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
            let mut tmp = Some(cpp::types::Adapter {
                name: "MyVarAdapter".to_owned(),
                adaptedType: ::std::default::Default::default(),
                underlyingName: ::std::default::Default::default(),
                extraNamespace: ::std::default::Default::default(),
                moveOnly: ::std::default::Default::default(),
                ..::std::default::Default::default()
            });
            let r: &mut dyn ::std::any::Any = &mut tmp;
            let r: &mut Option<T> = r.downcast_mut().unwrap();
            return r.take();
        }

        if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
            return Some(r);
        }

        if type_id == ::std::any::TypeId::of::<python::types::Adapter>() {
            let mut tmp = Some(python::types::Adapter {
                name: "my.ConfigAdapter".to_owned(),
                typeHint: "my.ConfiguredVar[]".to_owned(),
                ..::std::default::Default::default()
            });
            let r: &mut dyn ::std::any::Any = &mut tmp;
            let r: &mut Option<T> = r.downcast_mut().unwrap();
            return r.take();
        }

        if let Some(r) = <python::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
            return Some(r);
        }

        if type_id == ::std::any::TypeId::of::<scope::types::Transitive>() {
            let mut tmp = Some(scope::types::Transitive {
                ..::std::default::Default::default()
            });
            let r: &mut dyn ::std::any::Any = &mut tmp;
            let r: &mut Option<T> = r.downcast_mut().unwrap();
            return r.take();
        }

        if type_id == ::std::any::TypeId::of::<thrift::types::Experimental>() {
            let mut tmp = Some(thrift::types::Experimental {
                ..::std::default::Default::default()
            });
            let r: &mut dyn ::std::any::Any = &mut tmp;
            let r: &mut Option<T> = r.downcast_mut().unwrap();
            return r.take();
        }

        if let Some(r) = <thrift::types::Experimental as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
            return Some(r);
        }

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::MyStruct {
    fn default() -> Self {
        Self {
            field: ::std::default::Default::default(),
            set_string: <crate::types::adapters::SetWithAdapter as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<MyStruct>(::std::default::Default::default(), 2),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::MyStruct {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("MyStruct")
            .field("field", &self.field)
            .field("set_string", &self.set_string)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::MyStruct {}
unsafe impl ::std::marker::Sync for self::MyStruct {}
impl ::std::marker::Unpin for self::MyStruct {}

impl ::fbthrift::GetTType for self::MyStruct {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::MyStruct {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/MyStruct"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::MyStruct
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("MyStruct");
        p.write_field_begin("field", ::fbthrift::TType::I32, 1);
        ::fbthrift::Serialize::write(&self.field, p);
        p.write_field_end();
        p.write_field_begin("set_string", ::fbthrift::TType::Set, 2);
        ::fbthrift::Serialize::write(&<crate::types::adapters::SetWithAdapter as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<MyStruct>(&self.set_string, 2), p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::MyStruct
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("field", ::fbthrift::TType::I32, 1),
            ::fbthrift::Field::new("set_string", ::fbthrift::TType::Set, 2),
        ];
        let mut field_field = ::std::option::Option::None;
        let mut field_set_string = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::I32, 1) => field_field = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Set, 2) => field_set_string = ::std::option::Option::Some(<crate::types::adapters::SetWithAdapter as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<MyStruct>(::fbthrift::Deserialize::read(p)?, 2)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            field: field_field.unwrap_or_default(),
            set_string: field_set_string.unwrap_or_else(|| <crate::types::adapters::SetWithAdapter as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<MyStruct>(::std::default::Default::default(), 2)),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for MyStruct {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {
            },
            2 => {
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::AdaptTestStruct {
    fn default() -> Self {
        Self {
            delay: ::std::default::Default::default(),
            custom: ::std::default::Default::default(),
            timeout: ::std::default::Default::default(),
            data: ::std::default::Default::default(),
            meta: ::std::default::Default::default(),
            indirectionString: ::std::default::Default::default(),
            string_data: ::std::default::Default::default(),
            double_wrapped_bool: ::std::default::Default::default(),
            double_wrapped_integer: ::std::default::Default::default(),
            binary_data: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::AdaptTestStruct {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("AdaptTestStruct")
            .field("delay", &self.delay)
            .field("custom", &self.custom)
            .field("timeout", &self.timeout)
            .field("data", &self.data)
            .field("meta", &self.meta)
            .field("indirectionString", &self.indirectionString)
            .field("string_data", &self.string_data)
            .field("double_wrapped_bool", &self.double_wrapped_bool)
            .field("double_wrapped_integer", &self.double_wrapped_integer)
            .field("binary_data", &self.binary_data)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::AdaptTestStruct {}
unsafe impl ::std::marker::Sync for self::AdaptTestStruct {}
impl ::std::marker::Unpin for self::AdaptTestStruct {}

impl ::fbthrift::GetTType for self::AdaptTestStruct {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::AdaptTestStruct {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/AdaptTestStruct"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::AdaptTestStruct
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("AdaptTestStruct");
        p.write_field_begin("delay", ::fbthrift::TType::I64, 1);
        ::fbthrift::Serialize::write(&self.delay, p);
        p.write_field_end();
        p.write_field_begin("custom", ::fbthrift::TType::String, 2);
        ::fbthrift::Serialize::write(&self.custom, p);
        p.write_field_end();
        p.write_field_begin("timeout", ::fbthrift::TType::I64, 3);
        ::fbthrift::Serialize::write(&self.timeout, p);
        p.write_field_end();
        p.write_field_begin("data", ::fbthrift::TType::I64, 4);
        ::fbthrift::Serialize::write(&self.data, p);
        p.write_field_end();
        p.write_field_begin("meta", ::fbthrift::TType::String, 5);
        ::fbthrift::Serialize::write(&self.meta, p);
        p.write_field_end();
        p.write_field_begin("indirectionString", ::fbthrift::TType::String, 6);
        ::fbthrift::Serialize::write(&self.indirectionString, p);
        p.write_field_end();
        p.write_field_begin("string_data", ::fbthrift::TType::String, 7);
        ::fbthrift::Serialize::write(&self.string_data, p);
        p.write_field_end();
        p.write_field_begin("double_wrapped_bool", ::fbthrift::TType::Bool, 8);
        ::fbthrift::Serialize::write(&self.double_wrapped_bool, p);
        p.write_field_end();
        p.write_field_begin("double_wrapped_integer", ::fbthrift::TType::I32, 9);
        ::fbthrift::Serialize::write(&self.double_wrapped_integer, p);
        p.write_field_end();
        p.write_field_begin("binary_data", ::fbthrift::TType::String, 10);
        ::fbthrift::Serialize::write(&self.binary_data, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::AdaptTestStruct
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("binary_data", ::fbthrift::TType::String, 10),
            ::fbthrift::Field::new("custom", ::fbthrift::TType::String, 2),
            ::fbthrift::Field::new("data", ::fbthrift::TType::I64, 4),
            ::fbthrift::Field::new("delay", ::fbthrift::TType::I64, 1),
            ::fbthrift::Field::new("double_wrapped_bool", ::fbthrift::TType::Bool, 8),
            ::fbthrift::Field::new("double_wrapped_integer", ::fbthrift::TType::I32, 9),
            ::fbthrift::Field::new("indirectionString", ::fbthrift::TType::String, 6),
            ::fbthrift::Field::new("meta", ::fbthrift::TType::String, 5),
            ::fbthrift::Field::new("string_data", ::fbthrift::TType::String, 7),
            ::fbthrift::Field::new("timeout", ::fbthrift::TType::I64, 3),
        ];
        let mut field_delay = ::std::option::Option::None;
        let mut field_custom = ::std::option::Option::None;
        let mut field_timeout = ::std::option::Option::None;
        let mut field_data = ::std::option::Option::None;
        let mut field_meta = ::std::option::Option::None;
        let mut field_indirectionString = ::std::option::Option::None;
        let mut field_string_data = ::std::option::Option::None;
        let mut field_double_wrapped_bool = ::std::option::Option::None;
        let mut field_double_wrapped_integer = ::std::option::Option::None;
        let mut field_binary_data = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::I64, 1) => field_delay = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::String, 2) => field_custom = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::I64, 3) => field_timeout = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::I64, 4) => field_data = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::String, 5) => field_meta = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::String, 6) => field_indirectionString = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::String, 7) => field_string_data = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Bool, 8) => field_double_wrapped_bool = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::I32, 9) => field_double_wrapped_integer = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::String, 10) => field_binary_data = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            delay: field_delay.unwrap_or_default(),
            custom: field_custom.unwrap_or_default(),
            timeout: field_timeout.unwrap_or_default(),
            data: field_data.unwrap_or_default(),
            meta: field_meta.unwrap_or_default(),
            indirectionString: field_indirectionString.unwrap_or_default(),
            string_data: field_string_data.unwrap_or_default(),
            double_wrapped_bool: field_double_wrapped_bool.unwrap_or_default(),
            double_wrapped_integer: field_double_wrapped_integer.unwrap_or_default(),
            binary_data: field_binary_data.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for AdaptTestStruct {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {
            },
            2 => {
            },
            3 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::apache::thrift::test::AdaptTestMsAdapter".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }
            },
            4 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::apache::thrift::test::AdapterWithContext".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }
            },
            5 => {
            },
            6 => {
            },
            7 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::apache::thrift::test::AdapterWithContext".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }
            },
            8 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::apache::thrift::test::TemplatedTestAdapter".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }
            },
            9 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::apache::thrift::test::AdapterWithContext".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }
            },
            10 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::apache::thrift::test::AdapterWithContext".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::AdaptTemplatedTestStruct {
    fn default() -> Self {
        Self {
            adaptedBool: ::std::default::Default::default(),
            adaptedByte: ::std::default::Default::default(),
            adaptedShort: ::std::default::Default::default(),
            adaptedInteger: ::std::default::Default::default(),
            adaptedLong: ::std::default::Default::default(),
            adaptedDouble: ::std::default::Default::default(),
            adaptedString: ::std::default::Default::default(),
            adaptedList: ::std::default::Default::default(),
            adaptedSet: ::std::default::Default::default(),
            adaptedMap: ::std::default::Default::default(),
            adaptedBoolDefault: true,
            adaptedByteDefault: 1,
            adaptedShortDefault: 2,
            adaptedIntegerDefault: 3,
            adaptedLongDefault: 4,
            adaptedDoubleDefault: 5.0,
            adaptedStringDefault: "6".to_owned(),
            adaptedEnum: crate::types::ThriftAdaptedEnum::One,
            adaptedListDefault: <::fbthrift_adapters::test::TestAdapter as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<AdaptTemplatedTestStruct>(vec![
                    1,
                ], 19),
            adaptedSetDefault: <::fbthrift_adapters::test::TestAdapter as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<AdaptTemplatedTestStruct>({
                    let mut set = ::std::collections::BTreeSet::new();
                    set.insert(1);
                    set
                }, 20),
            adaptedMapDefault: <::fbthrift_adapters::test::TestAdapter as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<AdaptTemplatedTestStruct>({
                    let mut map = ::std::collections::BTreeMap::new();
                    map.insert(1, 1);
                    map
                }, 21),
            doubleTypedefBool: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::AdaptTemplatedTestStruct {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("AdaptTemplatedTestStruct")
            .field("adaptedBool", &self.adaptedBool)
            .field("adaptedByte", &self.adaptedByte)
            .field("adaptedShort", &self.adaptedShort)
            .field("adaptedInteger", &self.adaptedInteger)
            .field("adaptedLong", &self.adaptedLong)
            .field("adaptedDouble", &self.adaptedDouble)
            .field("adaptedString", &self.adaptedString)
            .field("adaptedList", &self.adaptedList)
            .field("adaptedSet", &self.adaptedSet)
            .field("adaptedMap", &self.adaptedMap)
            .field("adaptedBoolDefault", &self.adaptedBoolDefault)
            .field("adaptedByteDefault", &self.adaptedByteDefault)
            .field("adaptedShortDefault", &self.adaptedShortDefault)
            .field("adaptedIntegerDefault", &self.adaptedIntegerDefault)
            .field("adaptedLongDefault", &self.adaptedLongDefault)
            .field("adaptedDoubleDefault", &self.adaptedDoubleDefault)
            .field("adaptedStringDefault", &self.adaptedStringDefault)
            .field("adaptedEnum", &self.adaptedEnum)
            .field("adaptedListDefault", &self.adaptedListDefault)
            .field("adaptedSetDefault", &self.adaptedSetDefault)
            .field("adaptedMapDefault", &self.adaptedMapDefault)
            .field("doubleTypedefBool", &self.doubleTypedefBool)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::AdaptTemplatedTestStruct {}
unsafe impl ::std::marker::Sync for self::AdaptTemplatedTestStruct {}
impl ::std::marker::Unpin for self::AdaptTemplatedTestStruct {}

impl ::fbthrift::GetTType for self::AdaptTemplatedTestStruct {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::AdaptTemplatedTestStruct {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/AdaptTemplatedTestStruct"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::AdaptTemplatedTestStruct
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("AdaptTemplatedTestStruct");
        p.write_field_begin("adaptedBool", ::fbthrift::TType::Bool, 1);
        ::fbthrift::Serialize::write(&self.adaptedBool, p);
        p.write_field_end();
        p.write_field_begin("adaptedByte", ::fbthrift::TType::Byte, 2);
        ::fbthrift::Serialize::write(&self.adaptedByte, p);
        p.write_field_end();
        p.write_field_begin("adaptedShort", ::fbthrift::TType::I16, 3);
        ::fbthrift::Serialize::write(&self.adaptedShort, p);
        p.write_field_end();
        p.write_field_begin("adaptedInteger", ::fbthrift::TType::I32, 4);
        ::fbthrift::Serialize::write(&self.adaptedInteger, p);
        p.write_field_end();
        p.write_field_begin("adaptedLong", ::fbthrift::TType::I64, 5);
        ::fbthrift::Serialize::write(&self.adaptedLong, p);
        p.write_field_end();
        p.write_field_begin("adaptedDouble", ::fbthrift::TType::Double, 6);
        ::fbthrift::Serialize::write(&self.adaptedDouble, p);
        p.write_field_end();
        p.write_field_begin("adaptedString", ::fbthrift::TType::String, 7);
        ::fbthrift::Serialize::write(&self.adaptedString, p);
        p.write_field_end();
        p.write_field_begin("adaptedList", ::fbthrift::TType::List, 8);
        ::fbthrift::Serialize::write(&self.adaptedList, p);
        p.write_field_end();
        p.write_field_begin("adaptedSet", ::fbthrift::TType::Set, 9);
        ::fbthrift::Serialize::write(&self.adaptedSet, p);
        p.write_field_end();
        p.write_field_begin("adaptedMap", ::fbthrift::TType::Map, 10);
        ::fbthrift::Serialize::write(&self.adaptedMap, p);
        p.write_field_end();
        p.write_field_begin("adaptedBoolDefault", ::fbthrift::TType::Bool, 11);
        ::fbthrift::Serialize::write(&self.adaptedBoolDefault, p);
        p.write_field_end();
        p.write_field_begin("adaptedByteDefault", ::fbthrift::TType::Byte, 12);
        ::fbthrift::Serialize::write(&self.adaptedByteDefault, p);
        p.write_field_end();
        p.write_field_begin("adaptedShortDefault", ::fbthrift::TType::I16, 13);
        ::fbthrift::Serialize::write(&self.adaptedShortDefault, p);
        p.write_field_end();
        p.write_field_begin("adaptedIntegerDefault", ::fbthrift::TType::I32, 14);
        ::fbthrift::Serialize::write(&self.adaptedIntegerDefault, p);
        p.write_field_end();
        p.write_field_begin("adaptedLongDefault", ::fbthrift::TType::I64, 15);
        ::fbthrift::Serialize::write(&self.adaptedLongDefault, p);
        p.write_field_end();
        p.write_field_begin("adaptedDoubleDefault", ::fbthrift::TType::Double, 16);
        ::fbthrift::Serialize::write(&self.adaptedDoubleDefault, p);
        p.write_field_end();
        p.write_field_begin("adaptedStringDefault", ::fbthrift::TType::String, 17);
        ::fbthrift::Serialize::write(&self.adaptedStringDefault, p);
        p.write_field_end();
        p.write_field_begin("adaptedEnum", ::fbthrift::TType::I32, 18);
        ::fbthrift::Serialize::write(&self.adaptedEnum, p);
        p.write_field_end();
        p.write_field_begin("adaptedListDefault", ::fbthrift::TType::List, 19);
        ::fbthrift::Serialize::write(&<::fbthrift_adapters::test::TestAdapter as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<AdaptTemplatedTestStruct>(&self.adaptedListDefault, 19), p);
        p.write_field_end();
        p.write_field_begin("adaptedSetDefault", ::fbthrift::TType::Set, 20);
        ::fbthrift::Serialize::write(&<::fbthrift_adapters::test::TestAdapter as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<AdaptTemplatedTestStruct>(&self.adaptedSetDefault, 20), p);
        p.write_field_end();
        p.write_field_begin("adaptedMapDefault", ::fbthrift::TType::Map, 21);
        ::fbthrift::Serialize::write(&<::fbthrift_adapters::test::TestAdapter as ::fbthrift::adapter::ThriftAdapter>::to_thrift_field::<AdaptTemplatedTestStruct>(&self.adaptedMapDefault, 21), p);
        p.write_field_end();
        p.write_field_begin("doubleTypedefBool", ::fbthrift::TType::Bool, 22);
        ::fbthrift::Serialize::write(&self.doubleTypedefBool, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::AdaptTemplatedTestStruct
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("adaptedBool", ::fbthrift::TType::Bool, 1),
            ::fbthrift::Field::new("adaptedBoolDefault", ::fbthrift::TType::Bool, 11),
            ::fbthrift::Field::new("adaptedByte", ::fbthrift::TType::Byte, 2),
            ::fbthrift::Field::new("adaptedByteDefault", ::fbthrift::TType::Byte, 12),
            ::fbthrift::Field::new("adaptedDouble", ::fbthrift::TType::Double, 6),
            ::fbthrift::Field::new("adaptedDoubleDefault", ::fbthrift::TType::Double, 16),
            ::fbthrift::Field::new("adaptedEnum", ::fbthrift::TType::I32, 18),
            ::fbthrift::Field::new("adaptedInteger", ::fbthrift::TType::I32, 4),
            ::fbthrift::Field::new("adaptedIntegerDefault", ::fbthrift::TType::I32, 14),
            ::fbthrift::Field::new("adaptedList", ::fbthrift::TType::List, 8),
            ::fbthrift::Field::new("adaptedListDefault", ::fbthrift::TType::List, 19),
            ::fbthrift::Field::new("adaptedLong", ::fbthrift::TType::I64, 5),
            ::fbthrift::Field::new("adaptedLongDefault", ::fbthrift::TType::I64, 15),
            ::fbthrift::Field::new("adaptedMap", ::fbthrift::TType::Map, 10),
            ::fbthrift::Field::new("adaptedMapDefault", ::fbthrift::TType::Map, 21),
            ::fbthrift::Field::new("adaptedSet", ::fbthrift::TType::Set, 9),
            ::fbthrift::Field::new("adaptedSetDefault", ::fbthrift::TType::Set, 20),
            ::fbthrift::Field::new("adaptedShort", ::fbthrift::TType::I16, 3),
            ::fbthrift::Field::new("adaptedShortDefault", ::fbthrift::TType::I16, 13),
            ::fbthrift::Field::new("adaptedString", ::fbthrift::TType::String, 7),
            ::fbthrift::Field::new("adaptedStringDefault", ::fbthrift::TType::String, 17),
            ::fbthrift::Field::new("doubleTypedefBool", ::fbthrift::TType::Bool, 22),
        ];
        let mut field_adaptedBool = ::std::option::Option::None;
        let mut field_adaptedByte = ::std::option::Option::None;
        let mut field_adaptedShort = ::std::option::Option::None;
        let mut field_adaptedInteger = ::std::option::Option::None;
        let mut field_adaptedLong = ::std::option::Option::None;
        let mut field_adaptedDouble = ::std::option::Option::None;
        let mut field_adaptedString = ::std::option::Option::None;
        let mut field_adaptedList = ::std::option::Option::None;
        let mut field_adaptedSet = ::std::option::Option::None;
        let mut field_adaptedMap = ::std::option::Option::None;
        let mut field_adaptedBoolDefault = ::std::option::Option::None;
        let mut field_adaptedByteDefault = ::std::option::Option::None;
        let mut field_adaptedShortDefault = ::std::option::Option::None;
        let mut field_adaptedIntegerDefault = ::std::option::Option::None;
        let mut field_adaptedLongDefault = ::std::option::Option::None;
        let mut field_adaptedDoubleDefault = ::std::option::Option::None;
        let mut field_adaptedStringDefault = ::std::option::Option::None;
        let mut field_adaptedEnum = ::std::option::Option::None;
        let mut field_adaptedListDefault = ::std::option::Option::None;
        let mut field_adaptedSetDefault = ::std::option::Option::None;
        let mut field_adaptedMapDefault = ::std::option::Option::None;
        let mut field_doubleTypedefBool = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::Bool, 1) => field_adaptedBool = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Byte, 2) => field_adaptedByte = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::I16, 3) => field_adaptedShort = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::I32, 4) => field_adaptedInteger = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::I64, 5) => field_adaptedLong = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Double, 6) => field_adaptedDouble = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::String, 7) => field_adaptedString = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::List, 8) => field_adaptedList = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Set, 9) => field_adaptedSet = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Map, 10) => field_adaptedMap = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Bool, 11) => field_adaptedBoolDefault = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Byte, 12) => field_adaptedByteDefault = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::I16, 13) => field_adaptedShortDefault = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::I32, 14) => field_adaptedIntegerDefault = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::I64, 15) => field_adaptedLongDefault = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Double, 16) => field_adaptedDoubleDefault = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::String, 17) => field_adaptedStringDefault = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::I32, 18) => field_adaptedEnum = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::List, 19) => field_adaptedListDefault = ::std::option::Option::Some(<::fbthrift_adapters::test::TestAdapter as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<AdaptTemplatedTestStruct>(::fbthrift::Deserialize::read(p)?, 19)?),
                (::fbthrift::TType::Set, 20) => field_adaptedSetDefault = ::std::option::Option::Some(<::fbthrift_adapters::test::TestAdapter as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<AdaptTemplatedTestStruct>(::fbthrift::Deserialize::read(p)?, 20)?),
                (::fbthrift::TType::Map, 21) => field_adaptedMapDefault = ::std::option::Option::Some(<::fbthrift_adapters::test::TestAdapter as ::fbthrift::adapter::ThriftAdapter>::from_thrift_field::<AdaptTemplatedTestStruct>(::fbthrift::Deserialize::read(p)?, 21)?),
                (::fbthrift::TType::Bool, 22) => field_doubleTypedefBool = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            adaptedBool: field_adaptedBool.unwrap_or_default(),
            adaptedByte: field_adaptedByte.unwrap_or_default(),
            adaptedShort: field_adaptedShort.unwrap_or_default(),
            adaptedInteger: field_adaptedInteger.unwrap_or_default(),
            adaptedLong: field_adaptedLong.unwrap_or_default(),
            adaptedDouble: field_adaptedDouble.unwrap_or_default(),
            adaptedString: field_adaptedString.unwrap_or_default(),
            adaptedList: field_adaptedList.unwrap_or_default(),
            adaptedSet: field_adaptedSet.unwrap_or_default(),
            adaptedMap: field_adaptedMap.unwrap_or_default(),
            adaptedBoolDefault: field_adaptedBoolDefault.unwrap_or(true),
            adaptedByteDefault: field_adaptedByteDefault.unwrap_or_else(|| 1),
            adaptedShortDefault: field_adaptedShortDefault.unwrap_or(2),
            adaptedIntegerDefault: field_adaptedIntegerDefault.unwrap_or(3),
            adaptedLongDefault: field_adaptedLongDefault.unwrap_or(4),
            adaptedDoubleDefault: field_adaptedDoubleDefault.unwrap_or(5.0),
            adaptedStringDefault: field_adaptedStringDefault.unwrap_or_else(|| "6".to_owned()),
            adaptedEnum: field_adaptedEnum.unwrap_or(crate::types::ThriftAdaptedEnum::One),
            adaptedListDefault: field_adaptedListDefault.unwrap_or_else(|| <::fbthrift_adapters::test::TestAdapter as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<AdaptTemplatedTestStruct>(vec![
                    1,
                ], 19)),
            adaptedSetDefault: field_adaptedSetDefault.unwrap_or_else(|| <::fbthrift_adapters::test::TestAdapter as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<AdaptTemplatedTestStruct>({
                    let mut set = ::std::collections::BTreeSet::new();
                    set.insert(1);
                    set
                }, 20)),
            adaptedMapDefault: field_adaptedMapDefault.unwrap_or_else(|| <::fbthrift_adapters::test::TestAdapter as ::fbthrift::adapter::ThriftAdapter>::from_thrift_default::<AdaptTemplatedTestStruct>({
                    let mut map = ::std::collections::BTreeMap::new();
                    map.insert(1, 1);
                    map
                }, 21)),
            doubleTypedefBool: field_doubleTypedefBool.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for AdaptTemplatedTestStruct {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {
            },
            2 => {
            },
            3 => {
            },
            4 => {
            },
            5 => {
            },
            6 => {
            },
            7 => {
            },
            8 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::apache::thrift::test::TemplatedTestAdapter".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }
            },
            9 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::apache::thrift::test::TemplatedTestAdapter".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }
            },
            10 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::apache::thrift::test::TemplatedTestAdapter".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }
            },
            11 => {
            },
            12 => {
            },
            13 => {
            },
            14 => {
            },
            15 => {
            },
            16 => {
            },
            17 => {
            },
            18 => {
            },
            19 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::apache::thrift::test::TemplatedTestAdapter".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<rust::types::Adapter>() {
                    let mut tmp = Some(rust::types::Adapter {
                        name: "::fbthrift_adapters::test::TestAdapter".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            20 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::apache::thrift::test::TemplatedTestAdapter".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<rust::types::Adapter>() {
                    let mut tmp = Some(rust::types::Adapter {
                        name: "::fbthrift_adapters::test::TestAdapter".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            21 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::apache::thrift::test::TemplatedTestAdapter".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }

                if type_id == ::std::any::TypeId::of::<rust::types::Adapter>() {
                    let mut tmp = Some(rust::types::Adapter {
                        name: "::fbthrift_adapters::test::TestAdapter".to_owned(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            22 => {
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::AdaptTemplatedNestedTestStruct {
    fn default() -> Self {
        Self {
            adaptedStruct: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::AdaptTemplatedNestedTestStruct {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("AdaptTemplatedNestedTestStruct")
            .field("adaptedStruct", &self.adaptedStruct)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::AdaptTemplatedNestedTestStruct {}
unsafe impl ::std::marker::Sync for self::AdaptTemplatedNestedTestStruct {}
impl ::std::marker::Unpin for self::AdaptTemplatedNestedTestStruct {}

impl ::fbthrift::GetTType for self::AdaptTemplatedNestedTestStruct {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::AdaptTemplatedNestedTestStruct {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/AdaptTemplatedNestedTestStruct"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::AdaptTemplatedNestedTestStruct
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("AdaptTemplatedNestedTestStruct");
        p.write_field_begin("adaptedStruct", ::fbthrift::TType::Struct, 1);
        ::fbthrift::Serialize::write(&self.adaptedStruct, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::AdaptTemplatedNestedTestStruct
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("adaptedStruct", ::fbthrift::TType::Struct, 1),
        ];
        let mut field_adaptedStruct = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::Struct, 1) => field_adaptedStruct = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            adaptedStruct: field_adaptedStruct.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for AdaptTemplatedNestedTestStruct {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {
            },
            _ => {}
        }

        None
    }
}

impl ::std::default::Default for AdaptTestUnion {
    fn default() -> Self {
        Self::UnknownField(-1)
    }
}

impl ::fbthrift::GetTType for AdaptTestUnion {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::AdaptTestUnion {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/AdaptTestUnion"
    }
}

impl<P> ::fbthrift::Serialize<P> for AdaptTestUnion
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("AdaptTestUnion");
        match self {
            Self::delay(inner) => {
                p.write_field_begin("delay", ::fbthrift::TType::I64, 1);
                ::fbthrift::Serialize::write(inner, p);
                p.write_field_end();
            }
            Self::custom(inner) => {
                p.write_field_begin("custom", ::fbthrift::TType::String, 2);
                ::fbthrift::Serialize::write(inner, p);
                p.write_field_end();
            }
            Self::UnknownField(_) => {}
        }
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for AdaptTestUnion
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("custom", ::fbthrift::TType::String, 2),
            ::fbthrift::Field::new("delay", ::fbthrift::TType::I64, 1),
        ];
        let _ = p.read_struct_begin(|_| ())?;
        let mut once = false;
        let mut alt = ::std::option::Option::None;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32, once) {
                (::fbthrift::TType::Stop, _, _) => break,
                (::fbthrift::TType::I64, 1, false) => {
                    once = true;
                    alt = ::std::option::Option::Some(Self::delay(::fbthrift::Deserialize::read(p)?));
                }
                (::fbthrift::TType::String, 2, false) => {
                    once = true;
                    alt = ::std::option::Option::Some(Self::custom(::fbthrift::Deserialize::read(p)?));
                }
                (fty, _, false) => p.skip(fty)?,
                (badty, badid, true) => return ::std::result::Result::Err(::std::convert::From::from(::fbthrift::ProtocolError::UnwantedExtraUnionField(
                    "AdaptTestUnion".to_string(),
                    badty,
                    badid,
                ))),
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(alt.unwrap_or_default())
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for AdaptTestUnion {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {
            },
            2 => {
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::AdaptedStruct {
    fn default() -> Self {
        Self {
            data: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::AdaptedStruct {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("AdaptedStruct")
            .field("data", &self.data)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::AdaptedStruct {}
unsafe impl ::std::marker::Sync for self::AdaptedStruct {}
impl ::std::marker::Unpin for self::AdaptedStruct {}

impl ::fbthrift::GetTType for self::AdaptedStruct {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::AdaptedStruct {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/AdaptedStruct"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::AdaptedStruct
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("AdaptedStruct");
        p.write_field_begin("data", ::fbthrift::TType::I64, 1);
        ::fbthrift::Serialize::write(&self.data, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::AdaptedStruct
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("data", ::fbthrift::TType::I64, 1),
        ];
        let mut field_data = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::I64, 1) => field_data = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            data: field_data.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for AdaptedStruct {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::DirectlyAdaptedStruct {
    fn default() -> Self {
        Self {
            data: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::DirectlyAdaptedStruct {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("DirectlyAdaptedStruct")
            .field("data", &self.data)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::DirectlyAdaptedStruct {}
unsafe impl ::std::marker::Sync for self::DirectlyAdaptedStruct {}
impl ::std::marker::Unpin for self::DirectlyAdaptedStruct {}

impl ::fbthrift::GetTType for self::DirectlyAdaptedStruct {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::DirectlyAdaptedStruct {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/DirectlyAdaptedStruct"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::DirectlyAdaptedStruct
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("DirectlyAdaptedStruct");
        p.write_field_begin("data", ::fbthrift::TType::I64, 1);
        ::fbthrift::Serialize::write(&self.data, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::DirectlyAdaptedStruct
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("data", ::fbthrift::TType::I64, 1),
        ];
        let mut field_data = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::I64, 1) => field_data = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            data: field_data.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for DirectlyAdaptedStruct {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
            let mut tmp = Some(cpp::types::Adapter {
                name: "::apache::thrift::test::TemplatedTestAdapter".to_owned(),
                adaptedType: ::std::default::Default::default(),
                underlyingName: ::std::default::Default::default(),
                extraNamespace: ::std::default::Default::default(),
                moveOnly: ::std::default::Default::default(),
                ..::std::default::Default::default()
            });
            let r: &mut dyn ::std::any::Any = &mut tmp;
            let r: &mut Option<T> = r.downcast_mut().unwrap();
            return r.take();
        }

        if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
            return Some(r);
        }

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::StructFieldAdaptedStruct {
    fn default() -> Self {
        Self {
            adaptedStruct: ::std::default::Default::default(),
            adaptedTypedef: ::std::default::Default::default(),
            directlyAdapted: ::std::default::Default::default(),
            typedefOfAdapted: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::StructFieldAdaptedStruct {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("StructFieldAdaptedStruct")
            .field("adaptedStruct", &self.adaptedStruct)
            .field("adaptedTypedef", &self.adaptedTypedef)
            .field("directlyAdapted", &self.directlyAdapted)
            .field("typedefOfAdapted", &self.typedefOfAdapted)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::StructFieldAdaptedStruct {}
unsafe impl ::std::marker::Sync for self::StructFieldAdaptedStruct {}
impl ::std::marker::Unpin for self::StructFieldAdaptedStruct {}

impl ::fbthrift::GetTType for self::StructFieldAdaptedStruct {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::StructFieldAdaptedStruct {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/StructFieldAdaptedStruct"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::StructFieldAdaptedStruct
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("StructFieldAdaptedStruct");
        p.write_field_begin("adaptedStruct", ::fbthrift::TType::Struct, 1);
        ::fbthrift::Serialize::write(&self.adaptedStruct, p);
        p.write_field_end();
        p.write_field_begin("adaptedTypedef", ::fbthrift::TType::Struct, 2);
        ::fbthrift::Serialize::write(&self.adaptedTypedef, p);
        p.write_field_end();
        p.write_field_begin("directlyAdapted", ::fbthrift::TType::Struct, 3);
        ::fbthrift::Serialize::write(&self.directlyAdapted, p);
        p.write_field_end();
        p.write_field_begin("typedefOfAdapted", ::fbthrift::TType::Struct, 4);
        ::fbthrift::Serialize::write(&self.typedefOfAdapted, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::StructFieldAdaptedStruct
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("adaptedStruct", ::fbthrift::TType::Struct, 1),
            ::fbthrift::Field::new("adaptedTypedef", ::fbthrift::TType::Struct, 2),
            ::fbthrift::Field::new("directlyAdapted", ::fbthrift::TType::Struct, 3),
            ::fbthrift::Field::new("typedefOfAdapted", ::fbthrift::TType::Struct, 4),
        ];
        let mut field_adaptedStruct = ::std::option::Option::None;
        let mut field_adaptedTypedef = ::std::option::Option::None;
        let mut field_directlyAdapted = ::std::option::Option::None;
        let mut field_typedefOfAdapted = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::Struct, 1) => field_adaptedStruct = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 2) => field_adaptedTypedef = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 3) => field_directlyAdapted = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 4) => field_typedefOfAdapted = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            adaptedStruct: field_adaptedStruct.unwrap_or_default(),
            adaptedTypedef: field_adaptedTypedef.unwrap_or_default(),
            directlyAdapted: field_directlyAdapted.unwrap_or_default(),
            typedefOfAdapted: field_typedefOfAdapted.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for StructFieldAdaptedStruct {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::apache::thrift::test::TemplatedTestAdapter".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }
            },
            2 => {
            },
            3 => {
            },
            4 => {
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::CircularAdaptee {
    fn default() -> Self {
        Self {
            field: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::CircularAdaptee {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("CircularAdaptee")
            .field("field", &self.field)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::CircularAdaptee {}
unsafe impl ::std::marker::Sync for self::CircularAdaptee {}
impl ::std::marker::Unpin for self::CircularAdaptee {}

impl ::fbthrift::GetTType for self::CircularAdaptee {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::CircularAdaptee {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/CircularAdaptee"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::CircularAdaptee
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("CircularAdaptee");
        p.write_field_begin("field", ::fbthrift::TType::Struct, 1);
        ::fbthrift::Serialize::write(&self.field, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::CircularAdaptee
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("field", ::fbthrift::TType::Struct, 1),
        ];
        let mut field_field = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::Struct, 1) => field_field = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            field: field_field.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for CircularAdaptee {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::CircularStruct {
    fn default() -> Self {
        Self {
            field: ::std::option::Option::None,
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::CircularStruct {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("CircularStruct")
            .field("field", &self.field)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::CircularStruct {}
unsafe impl ::std::marker::Sync for self::CircularStruct {}
impl ::std::marker::Unpin for self::CircularStruct {}

impl ::fbthrift::GetTType for self::CircularStruct {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::CircularStruct {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/CircularStruct"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::CircularStruct
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("CircularStruct");
        if let ::std::option::Option::Some(some) = &self.field {
            p.write_field_begin("field", ::fbthrift::TType::Struct, 1);
            ::fbthrift::Serialize::write(some, p);
            p.write_field_end();
        }
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::CircularStruct
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("field", ::fbthrift::TType::Struct, 1),
        ];
        let mut field_field = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::Struct, 1) => field_field = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            field: field_field,
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for CircularStruct {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Ref>() {
                    let mut tmp = Some(cpp::types::Ref {
                        r#type: cpp::types::RefType(0),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::ReorderedStruct {
    fn default() -> Self {
        Self {
            reordered_dependent_adapted: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::ReorderedStruct {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("ReorderedStruct")
            .field("reordered_dependent_adapted", &self.reordered_dependent_adapted)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::ReorderedStruct {}
unsafe impl ::std::marker::Sync for self::ReorderedStruct {}
impl ::std::marker::Unpin for self::ReorderedStruct {}

impl ::fbthrift::GetTType for self::ReorderedStruct {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::ReorderedStruct {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/ReorderedStruct"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::ReorderedStruct
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("ReorderedStruct");
        p.write_field_begin("reordered_dependent_adapted", ::fbthrift::TType::Struct, 1);
        ::fbthrift::Serialize::write(&self.reordered_dependent_adapted, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::ReorderedStruct
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("reordered_dependent_adapted", ::fbthrift::TType::Struct, 1),
        ];
        let mut field_reordered_dependent_adapted = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::Struct, 1) => field_reordered_dependent_adapted = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            reordered_dependent_adapted: field_reordered_dependent_adapted.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for ReorderedStruct {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Ref>() {
                    let mut tmp = Some(cpp::types::Ref {
                        r#type: cpp::types::RefType(0),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::DeclaredAfterStruct {
    fn default() -> Self {
        Self {
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::DeclaredAfterStruct {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("DeclaredAfterStruct")
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::DeclaredAfterStruct {}
unsafe impl ::std::marker::Sync for self::DeclaredAfterStruct {}
impl ::std::marker::Unpin for self::DeclaredAfterStruct {}

impl ::fbthrift::GetTType for self::DeclaredAfterStruct {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::DeclaredAfterStruct {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/DeclaredAfterStruct"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::DeclaredAfterStruct
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("DeclaredAfterStruct");
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::DeclaredAfterStruct
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
        ];
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for DeclaredAfterStruct {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
            let mut tmp = Some(cpp::types::Adapter {
                name: "::apache::thrift::test::IdentityAdapter<detail::DeclaredAfterStruct>".to_owned(),
                adaptedType: ::std::default::Default::default(),
                underlyingName: ::std::default::Default::default(),
                extraNamespace: ::std::default::Default::default(),
                moveOnly: ::std::default::Default::default(),
                ..::std::default::Default::default()
            });
            let r: &mut dyn ::std::any::Any = &mut tmp;
            let r: &mut Option<T> = r.downcast_mut().unwrap();
            return r.take();
        }

        if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
            return Some(r);
        }

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::RenamedStruct {
    fn default() -> Self {
        Self {
            data: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::RenamedStruct {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("RenamedStruct")
            .field("data", &self.data)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::RenamedStruct {}
unsafe impl ::std::marker::Sync for self::RenamedStruct {}
impl ::std::marker::Unpin for self::RenamedStruct {}

impl ::fbthrift::GetTType for self::RenamedStruct {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::RenamedStruct {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/RenamedStruct"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::RenamedStruct
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("RenamedStruct");
        p.write_field_begin("data", ::fbthrift::TType::I64, 1);
        ::fbthrift::Serialize::write(&self.data, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::RenamedStruct
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("data", ::fbthrift::TType::I64, 1),
        ];
        let mut field_data = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::I64, 1) => field_data = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            data: field_data.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for RenamedStruct {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
            let mut tmp = Some(cpp::types::Adapter {
                name: "::apache::thrift::test::TemplatedTestAdapter".to_owned(),
                adaptedType: ::std::default::Default::default(),
                underlyingName: "UnderlyingRenamedStruct".to_owned(),
                extraNamespace: ::std::default::Default::default(),
                moveOnly: ::std::default::Default::default(),
                ..::std::default::Default::default()
            });
            let r: &mut dyn ::std::any::Any = &mut tmp;
            let r: &mut Option<T> = r.downcast_mut().unwrap();
            return r.take();
        }

        if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
            return Some(r);
        }

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::SameNamespaceStruct {
    fn default() -> Self {
        Self {
            data: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::SameNamespaceStruct {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("SameNamespaceStruct")
            .field("data", &self.data)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::SameNamespaceStruct {}
unsafe impl ::std::marker::Sync for self::SameNamespaceStruct {}
impl ::std::marker::Unpin for self::SameNamespaceStruct {}

impl ::fbthrift::GetTType for self::SameNamespaceStruct {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::SameNamespaceStruct {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/SameNamespaceStruct"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::SameNamespaceStruct
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("SameNamespaceStruct");
        p.write_field_begin("data", ::fbthrift::TType::I64, 1);
        ::fbthrift::Serialize::write(&self.data, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::SameNamespaceStruct
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("data", ::fbthrift::TType::I64, 1),
        ];
        let mut field_data = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::I64, 1) => field_data = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            data: field_data.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for SameNamespaceStruct {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
            let mut tmp = Some(cpp::types::Adapter {
                name: "::apache::thrift::test::TemplatedTestAdapter".to_owned(),
                adaptedType: ::std::default::Default::default(),
                underlyingName: "UnderlyingSameNamespaceStruct".to_owned(),
                extraNamespace: ::std::string::String::new(),
                moveOnly: ::std::default::Default::default(),
                ..::std::default::Default::default()
            });
            let r: &mut dyn ::std::any::Any = &mut tmp;
            let r: &mut Option<T> = r.downcast_mut().unwrap();
            return r.take();
        }

        if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
            return Some(r);
        }

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::HeapAllocated {
    fn default() -> Self {
        Self {
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::HeapAllocated {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("HeapAllocated")
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::HeapAllocated {}
unsafe impl ::std::marker::Sync for self::HeapAllocated {}
impl ::std::marker::Unpin for self::HeapAllocated {}

impl ::fbthrift::GetTType for self::HeapAllocated {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::HeapAllocated {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/HeapAllocated"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::HeapAllocated
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("HeapAllocated");
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::HeapAllocated
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
        ];
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for HeapAllocated {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
            let mut tmp = Some(cpp::types::Adapter {
                name: "::apache::thrift::test::MoveOnlyAdapter".to_owned(),
                adaptedType: ::std::default::Default::default(),
                underlyingName: ::std::default::Default::default(),
                extraNamespace: ::std::default::Default::default(),
                moveOnly: true,
                ..::std::default::Default::default()
            });
            let r: &mut dyn ::std::any::Any = &mut tmp;
            let r: &mut Option<T> = r.downcast_mut().unwrap();
            return r.take();
        }

        if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
            return Some(r);
        }

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::MoveOnly {
    fn default() -> Self {
        Self {
            ptr: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::MoveOnly {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("MoveOnly")
            .field("ptr", &self.ptr)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::MoveOnly {}
unsafe impl ::std::marker::Sync for self::MoveOnly {}
impl ::std::marker::Unpin for self::MoveOnly {}

impl ::fbthrift::GetTType for self::MoveOnly {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::MoveOnly {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/MoveOnly"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::MoveOnly
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("MoveOnly");
        p.write_field_begin("ptr", ::fbthrift::TType::Struct, 1);
        ::fbthrift::Serialize::write(&self.ptr, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::MoveOnly
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("ptr", ::fbthrift::TType::Struct, 1),
        ];
        let mut field_ptr = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::Struct, 1) => field_ptr = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            ptr: field_ptr.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for MoveOnly {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::AlsoMoveOnly {
    fn default() -> Self {
        Self {
            ptr: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::AlsoMoveOnly {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("AlsoMoveOnly")
            .field("ptr", &self.ptr)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::AlsoMoveOnly {}
unsafe impl ::std::marker::Sync for self::AlsoMoveOnly {}
impl ::std::marker::Unpin for self::AlsoMoveOnly {}

impl ::fbthrift::GetTType for self::AlsoMoveOnly {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::AlsoMoveOnly {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/AlsoMoveOnly"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::AlsoMoveOnly
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("AlsoMoveOnly");
        p.write_field_begin("ptr", ::fbthrift::TType::I64, 1);
        ::fbthrift::Serialize::write(&self.ptr, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::AlsoMoveOnly
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("ptr", ::fbthrift::TType::I64, 1),
        ];
        let mut field_ptr = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::I64, 1) => field_ptr = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            ptr: field_ptr.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for AlsoMoveOnly {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::apache::thrift::test::MoveOnlyAdapter".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: true,
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::ApplyAdapter {
    fn default() -> Self {
        Self {
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::ApplyAdapter {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("ApplyAdapter")
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::ApplyAdapter {}
unsafe impl ::std::marker::Sync for self::ApplyAdapter {}
impl ::std::marker::Unpin for self::ApplyAdapter {}

impl ::fbthrift::GetTType for self::ApplyAdapter {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::ApplyAdapter {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/ApplyAdapter"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::ApplyAdapter
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("ApplyAdapter");
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::ApplyAdapter
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
        ];
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for ApplyAdapter {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
            let mut tmp = Some(cpp::types::Adapter {
                name: "::apache::thrift::test::TemplatedTestAdapter".to_owned(),
                adaptedType: ::std::default::Default::default(),
                underlyingName: ::std::default::Default::default(),
                extraNamespace: ::std::default::Default::default(),
                moveOnly: ::std::default::Default::default(),
                ..::std::default::Default::default()
            });
            let r: &mut dyn ::std::any::Any = &mut tmp;
            let r: &mut Option<T> = r.downcast_mut().unwrap();
            return r.take();
        }

        if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
            return Some(r);
        }

        if type_id == ::std::any::TypeId::of::<scope::types::Transitive>() {
            let mut tmp = Some(scope::types::Transitive {
                ..::std::default::Default::default()
            });
            let r: &mut dyn ::std::any::Any = &mut tmp;
            let r: &mut Option<T> = r.downcast_mut().unwrap();
            return r.take();
        }

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::TransitiveAdapted {
    fn default() -> Self {
        Self {
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::TransitiveAdapted {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("TransitiveAdapted")
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::TransitiveAdapted {}
unsafe impl ::std::marker::Sync for self::TransitiveAdapted {}
impl ::std::marker::Unpin for self::TransitiveAdapted {}

impl ::fbthrift::GetTType for self::TransitiveAdapted {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::TransitiveAdapted {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/TransitiveAdapted"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::TransitiveAdapted
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("TransitiveAdapted");
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::TransitiveAdapted
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
        ];
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for TransitiveAdapted {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        if type_id == ::std::any::TypeId::of::<crate::types::ApplyAdapter>() {
            let mut tmp = Some(crate::types::ApplyAdapter {
                ..::std::default::Default::default()
            });
            let r: &mut dyn ::std::any::Any = &mut tmp;
            let r: &mut Option<T> = r.downcast_mut().unwrap();
            return r.take();
        }

        if let Some(r) = <crate::types::ApplyAdapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
            return Some(r);
        }

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::CountingStruct {
    fn default() -> Self {
        Self {
            regularInt: ::std::option::Option::None,
            countingInt: ::std::option::Option::None,
            regularString: ::std::option::Option::None,
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::CountingStruct {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("CountingStruct")
            .field("regularInt", &self.regularInt)
            .field("countingInt", &self.countingInt)
            .field("regularString", &self.regularString)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::CountingStruct {}
unsafe impl ::std::marker::Sync for self::CountingStruct {}
impl ::std::marker::Unpin for self::CountingStruct {}

impl ::fbthrift::GetTType for self::CountingStruct {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::CountingStruct {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/CountingStruct"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::CountingStruct
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("CountingStruct");
        if let ::std::option::Option::Some(some) = &self.regularInt {
            p.write_field_begin("regularInt", ::fbthrift::TType::I64, 1);
            ::fbthrift::Serialize::write(some, p);
            p.write_field_end();
        }
        if let ::std::option::Option::Some(some) = &self.countingInt {
            p.write_field_begin("countingInt", ::fbthrift::TType::I64, 2);
            ::fbthrift::Serialize::write(some, p);
            p.write_field_end();
        }
        if let ::std::option::Option::Some(some) = &self.regularString {
            p.write_field_begin("regularString", ::fbthrift::TType::String, 3);
            ::fbthrift::Serialize::write(some, p);
            p.write_field_end();
        }
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::CountingStruct
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("countingInt", ::fbthrift::TType::I64, 2),
            ::fbthrift::Field::new("regularInt", ::fbthrift::TType::I64, 1),
            ::fbthrift::Field::new("regularString", ::fbthrift::TType::String, 3),
        ];
        let mut field_regularInt = ::std::option::Option::None;
        let mut field_countingInt = ::std::option::Option::None;
        let mut field_regularString = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::I64, 1) => field_regularInt = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::I64, 2) => field_countingInt = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::String, 3) => field_regularString = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            regularInt: field_regularInt,
            countingInt: field_countingInt,
            regularString: field_regularString,
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for CountingStruct {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::apache::thrift::test::CountingAdapter<false, int>".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }
            },
            2 => {
            },
            3 => {

                if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
                    let mut tmp = Some(cpp::types::Adapter {
                        name: "::apache::thrift::test::CountingAdapter<false, std::string>".to_owned(),
                        adaptedType: ::std::default::Default::default(),
                        underlyingName: ::std::default::Default::default(),
                        extraNamespace: ::std::default::Default::default(),
                        moveOnly: ::std::default::Default::default(),
                        ..::std::default::Default::default()
                    });
                    let r: &mut dyn ::std::any::Any = &mut tmp;
                    let r: &mut Option<T> = r.downcast_mut().unwrap();
                    return r.take();
                }

                if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
                    return Some(r);
                }
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::Person {
    fn default() -> Self {
        Self {
            name: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::Person {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("Person")
            .field("name", &self.name)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::Person {}
unsafe impl ::std::marker::Sync for self::Person {}
impl ::std::marker::Unpin for self::Person {}

impl ::fbthrift::GetTType for self::Person {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::Person {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/Person"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::Person
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("Person");
        p.write_field_begin("name", ::fbthrift::TType::String, 1);
        ::fbthrift::Serialize::write(&self.name, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::Person
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("name", ::fbthrift::TType::String, 1),
        ];
        let mut field_name = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::String, 1) => field_name = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            name: field_name.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for Person {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        if type_id == ::std::any::TypeId::of::<cpp::types::Adapter>() {
            let mut tmp = Some(cpp::types::Adapter {
                name: "::apache::thrift::test::VariableAdapter".to_owned(),
                adaptedType: ::std::default::Default::default(),
                underlyingName: ::std::default::Default::default(),
                extraNamespace: ::std::default::Default::default(),
                moveOnly: ::std::default::Default::default(),
                ..::std::default::Default::default()
            });
            let r: &mut dyn ::std::any::Any = &mut tmp;
            let r: &mut Option<T> = r.downcast_mut().unwrap();
            return r.take();
        }

        if let Some(r) = <cpp::types::Adapter as ::fbthrift::metadata::ThriftAnnotations>::get_structured_annotation::<T>() {
            return Some(r);
        }

        if type_id == ::std::any::TypeId::of::<scope::types::Transitive>() {
            let mut tmp = Some(scope::types::Transitive {
                ..::std::default::Default::default()
            });
            let r: &mut dyn ::std::any::Any = &mut tmp;
            let r: &mut Option<T> = r.downcast_mut().unwrap();
            return r.take();
        }

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::Person2 {
    fn default() -> Self {
        Self {
            name: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::Person2 {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("Person2")
            .field("name", &self.name)
            .finish()
    }
}

unsafe impl ::std::marker::Send for self::Person2 {}
unsafe impl ::std::marker::Sync for self::Person2 {}
impl ::std::marker::Unpin for self::Person2 {}

impl ::fbthrift::GetTType for self::Person2 {
    const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}

impl ::fbthrift::GetUri for self::Person2 {
    fn uri() -> &'static str {
        "facebook.com/thrift/test/Person2"
    }
}

impl<P> ::fbthrift::Serialize<P> for self::Person2
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("Person2");
        p.write_field_begin("name", ::fbthrift::TType::String, 1);
        ::fbthrift::Serialize::write(&self.name, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::Person2
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("name", ::fbthrift::TType::String, 1),
        ];
        let mut field_name = ::std::option::Option::None;
        let _ = p.read_struct_begin(|_| ())?;
        loop {
            let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
            match (fty, fid as ::std::primitive::i32) {
                (::fbthrift::TType::Stop, _) => break,
                (::fbthrift::TType::String, 1) => field_name = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (fty, _) => p.skip(fty)?,
            }
            p.read_field_end()?;
        }
        p.read_struct_end()?;
        ::std::result::Result::Ok(Self {
            name: field_name.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for Person2 {
    fn get_structured_annotation<T: Sized + 'static>() -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        None
    }

    fn get_field_structured_annotation<T: Sized + 'static>(field_id: i16) -> ::std::option::Option<T> {
        #[allow(unused_variables)]
        let type_id = ::std::any::TypeId::of::<T>();

        match field_id {
            1 => {
            },
            _ => {}
        }

        None
    }
}

/// Type aliases for the adapter used on an adapted typedef or struct.
pub mod adapters {
  pub type SetWithAdapter = ::my::Adapter2;
  pub type StringWithAdapter = ::my::Adapter1;
  pub type ListWithElemAdapter_withAdapter = ::fbthrift::adapter::LayeredThriftAdapter<::my::Adapter2, ::fbthrift::adapter::ListMapAdapter<crate::types::adapters::StringWithAdapter>>;
  pub type MyI64 = ::my::Adapter1;
  pub type MyI32 = ::my::Adapter1;
  pub type FooWithAdapter = ::my::Adapter1;
}

/// These are here to ensure the `from_thrift_default` methods on adapters don't panic.
#[cfg(test)]
mod tests {
    #[test]
    fn test_struct_Foo_default_does_not_panic() {
        let _ = super::Foo::default();
    }
    #[test]
    fn test_struct_Baz_default_does_not_panic() {
        let _ = super::Baz::default();
    }
    #[test]
    fn test_struct_Bar_default_does_not_panic() {
        let _ = super::Bar::default();
    }
    #[test]
    fn test_struct_StructWithFieldAdapter_default_does_not_panic() {
        let _ = super::StructWithFieldAdapter::default();
    }
    #[test]
    fn test_struct_MyStruct_default_does_not_panic() {
        let _ = super::MyStruct::default();
    }
    #[test]
    fn test_struct_AdaptTemplatedTestStruct_default_does_not_panic() {
        let _ = super::AdaptTemplatedTestStruct::default();
    }
}

// This is here to ensure you enable unittests on your Thrift library.
#[cfg(feature = "thrift_library_unittests_disabled")]
compile_error!("You are using Rust adapters in a Thrift library that does not have unittests enabled. For safety reasons, this is forbidden. Please enable Rust unittests for this Thrift library.");

mod dot_dot {
    #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct OtherFields(pub(crate) ());

    #[allow(dead_code)] // if serde isn't being used
    pub(super) fn default_for_serde_deserialize() -> OtherFields {
        OtherFields(())
    }
}