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

//! Thrift type definitions for `module`.

#![allow(clippy::redundant_closure)]

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum MyUnion {
    anInteger(::std::primitive::i32),
    aString(::std::string::String),
    UnknownField(::std::primitive::i32),
}

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct MyField {
    pub opt_value: ::std::option::Option<::std::primitive::i64>,
    pub value: ::std::primitive::i64,
    pub req_value: ::std::primitive::i64,
    pub opt_enum_value: ::std::option::Option<crate::types::MyEnum>,
    pub enum_value: crate::types::MyEnum,
    pub req_enum_value: crate::types::MyEnum,
    pub opt_str_value: ::std::option::Option<::std::string::String>,
    pub str_value: ::std::string::String,
    pub req_str_value: ::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 opt_ref: ::std::option::Option<crate::types::MyField>,
    pub r#ref: crate::types::MyField,
    pub req_ref: crate::types::MyField,
    // 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 StructWithUnion {
    pub u: crate::types::MyUnion,
    pub aDouble: ::std::primitive::f64,
    pub f: crate::types::MyField,
    // 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 RecursiveStruct {
    pub mes: ::std::option::Option<::std::vec::Vec<crate::types::RecursiveStruct>>,
    // 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 StructWithContainers {
    pub list_ref: ::std::vec::Vec<::std::primitive::i32>,
    pub set_ref: ::std::collections::BTreeSet<::std::primitive::i32>,
    pub map_ref: ::std::collections::BTreeMap<::std::primitive::i32, ::std::primitive::i32>,
    pub list_ref_unique: ::std::vec::Vec<::std::primitive::i32>,
    pub set_ref_shared: ::std::collections::BTreeSet<::std::primitive::i32>,
    pub list_ref_shared_const: ::std::vec::Vec<::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 StructWithSharedConst {
    pub opt_shared_const: ::std::option::Option<crate::types::MyField>,
    pub shared_const: crate::types::MyField,
    pub req_shared_const: crate::types::MyField,
    // 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 Empty {
    // 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 StructWithRef {
    pub def_field: crate::types::Empty,
    pub opt_field: ::std::option::Option<crate::types::Empty>,
    pub req_field: crate::types::Empty,
    // 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 StructWithBox {
    pub a: ::std::option::Option<::std::boxed::Box<::std::string::String>>,
    pub b: ::std::option::Option<::std::boxed::Box<::std::vec::Vec<::std::primitive::i64>>>,
    pub c: ::std::option::Option<::std::boxed::Box<crate::types::StructWithRef>>,
    // 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 StructWithInternBox {
    pub field1: crate::types::Empty,
    pub field2: crate::types::MyField,
    pub field3: crate::types::Empty,
    pub field4: crate::types::MyField,
    // 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 AdaptedStructWithInternBox {
    pub field1: crate::types::Empty,
    pub field2: crate::types::MyField,
    pub field3: crate::types::Empty,
    pub field4: crate::types::MyField,
    // 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 StructWithRefTypeUnique {
    pub def_field: crate::types::Empty,
    pub opt_field: ::std::option::Option<crate::types::Empty>,
    pub req_field: crate::types::Empty,
    // 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 StructWithRefTypeShared {
    pub def_field: crate::types::Empty,
    pub opt_field: ::std::option::Option<crate::types::Empty>,
    pub req_field: crate::types::Empty,
    // 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 StructWithRefTypeSharedConst {
    pub def_field: crate::types::Empty,
    pub opt_field: ::std::option::Option<crate::types::Empty>,
    pub req_field: crate::types::Empty,
    // 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 StructWithRefAndAnnotCppNoexceptMoveCtor {
    pub def_field: crate::types::Empty,
    // 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 StructWithString {
    pub def_unique_string_ref: ::std::string::String,
    pub def_shared_string_ref: ::std::string::String,
    pub def_shared_string_const_ref: ::std::string::String,
    pub unique_string_ref: ::std::string::String,
    pub shared_string_ref: ::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 MyEnum(pub ::std::primitive::i32);

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

impl ::fbthrift::ThriftEnum for MyEnum {
    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 MyEnum {
    fn default() -> Self {
        Self(::fbthrift::__UNKNOWN_ID)
    }
}

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

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

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

impl ::std::fmt::Display for MyEnum {
    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 MyEnum {
    fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        write!(fmt, "MyEnum::{}", self)
    }
}

impl ::std::str::FromStr for MyEnum {
    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, "MyEnum").map(Self)
    }
}

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

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

impl<P> ::fbthrift::Deserialize<P> for MyEnum
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 TypedEnum(pub ::std::primitive::i32);

impl TypedEnum {
    pub const VAL1: Self = TypedEnum(0i32);
    pub const VAL2: Self = TypedEnum(1i32);
}

impl ::fbthrift::ThriftEnum for TypedEnum {
    fn enumerate() -> &'static [(Self, &'static str)] {
        &[
            (Self::VAL1, "VAL1"),
            (Self::VAL2, "VAL2"),
        ]
    }

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

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

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

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

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

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

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

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

impl ::std::str::FromStr for TypedEnum {
    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)] = &[
            ("VAL1", 0),
            ("VAL2", 1),
        ];
        ::fbthrift::help::enum_from_str(VARIANTS_BY_NAME, string, "TypedEnum").map(Self)
    }
}

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

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

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

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

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

impl<P> ::fbthrift::Serialize<P> for MyUnion
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("MyUnion");
        match self {
            Self::anInteger(inner) => {
                p.write_field_begin("anInteger", ::fbthrift::TType::I32, 1);
                ::fbthrift::Serialize::write(inner, p);
                p.write_field_end();
            }
            Self::aString(inner) => {
                p.write_field_begin("aString", ::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 MyUnion
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("aString", ::fbthrift::TType::String, 2),
            ::fbthrift::Field::new("anInteger", ::fbthrift::TType::I32, 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::I32, 1, false) => {
                    once = true;
                    alt = ::std::option::Option::Some(Self::anInteger(::fbthrift::Deserialize::read(p)?));
                }
                (::fbthrift::TType::String, 2, false) => {
                    once = true;
                    alt = ::std::option::Option::Some(Self::aString(::fbthrift::Deserialize::read(p)?));
                }
                (fty, _, false) => p.skip(fty)?,
                (badty, badid, true) => return ::std::result::Result::Err(::std::convert::From::from(::fbthrift::ProtocolError::UnwantedExtraUnionField(
                    "MyUnion".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 MyUnion {
    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::MyField {
    fn default() -> Self {
        Self {
            opt_value: ::std::option::Option::None,
            value: ::std::default::Default::default(),
            req_value: ::std::default::Default::default(),
            opt_enum_value: ::std::option::Option::None,
            enum_value: ::std::default::Default::default(),
            req_enum_value: ::std::default::Default::default(),
            opt_str_value: ::std::option::Option::None,
            str_value: ::std::default::Default::default(),
            req_str_value: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::MyField {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("MyField")
            .field("opt_value", &self.opt_value)
            .field("value", &self.value)
            .field("req_value", &self.req_value)
            .field("opt_enum_value", &self.opt_enum_value)
            .field("enum_value", &self.enum_value)
            .field("req_enum_value", &self.req_enum_value)
            .field("opt_str_value", &self.opt_str_value)
            .field("str_value", &self.str_value)
            .field("req_str_value", &self.req_str_value)
            .finish()
    }
}

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

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

impl<P> ::fbthrift::Serialize<P> for self::MyField
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("MyField");
        if let ::std::option::Option::Some(some) = &self.opt_value {
            p.write_field_begin("opt_value", ::fbthrift::TType::I64, 1);
            ::fbthrift::Serialize::write(some, p);
            p.write_field_end();
        }
        p.write_field_begin("value", ::fbthrift::TType::I64, 2);
        ::fbthrift::Serialize::write(&self.value, p);
        p.write_field_end();
        p.write_field_begin("req_value", ::fbthrift::TType::I64, 3);
        ::fbthrift::Serialize::write(&self.req_value, p);
        p.write_field_end();
        if let ::std::option::Option::Some(some) = &self.opt_enum_value {
            p.write_field_begin("opt_enum_value", ::fbthrift::TType::I32, 4);
            ::fbthrift::Serialize::write(some, p);
            p.write_field_end();
        }
        p.write_field_begin("enum_value", ::fbthrift::TType::I32, 5);
        ::fbthrift::Serialize::write(&self.enum_value, p);
        p.write_field_end();
        p.write_field_begin("req_enum_value", ::fbthrift::TType::I32, 6);
        ::fbthrift::Serialize::write(&self.req_enum_value, p);
        p.write_field_end();
        if let ::std::option::Option::Some(some) = &self.opt_str_value {
            p.write_field_begin("opt_str_value", ::fbthrift::TType::String, 7);
            ::fbthrift::Serialize::write(some, p);
            p.write_field_end();
        }
        p.write_field_begin("str_value", ::fbthrift::TType::String, 8);
        ::fbthrift::Serialize::write(&self.str_value, p);
        p.write_field_end();
        p.write_field_begin("req_str_value", ::fbthrift::TType::String, 9);
        ::fbthrift::Serialize::write(&self.req_str_value, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::MyField
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("enum_value", ::fbthrift::TType::I32, 5),
            ::fbthrift::Field::new("opt_enum_value", ::fbthrift::TType::I32, 4),
            ::fbthrift::Field::new("opt_str_value", ::fbthrift::TType::String, 7),
            ::fbthrift::Field::new("opt_value", ::fbthrift::TType::I64, 1),
            ::fbthrift::Field::new("req_enum_value", ::fbthrift::TType::I32, 6),
            ::fbthrift::Field::new("req_str_value", ::fbthrift::TType::String, 9),
            ::fbthrift::Field::new("req_value", ::fbthrift::TType::I64, 3),
            ::fbthrift::Field::new("str_value", ::fbthrift::TType::String, 8),
            ::fbthrift::Field::new("value", ::fbthrift::TType::I64, 2),
        ];
        let mut field_opt_value = ::std::option::Option::None;
        let mut field_value = ::std::option::Option::None;
        let mut field_req_value = ::std::option::Option::None;
        let mut field_opt_enum_value = ::std::option::Option::None;
        let mut field_enum_value = ::std::option::Option::None;
        let mut field_req_enum_value = ::std::option::Option::None;
        let mut field_opt_str_value = ::std::option::Option::None;
        let mut field_str_value = ::std::option::Option::None;
        let mut field_req_str_value = ::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_opt_value = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::I64, 2) => field_value = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::I64, 3) => field_req_value = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::I32, 4) => field_opt_enum_value = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::I32, 5) => field_enum_value = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::I32, 6) => field_req_enum_value = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::String, 7) => field_opt_str_value = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::String, 8) => field_str_value = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::String, 9) => field_req_str_value = ::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 {
            opt_value: field_opt_value,
            value: field_value.unwrap_or_default(),
            req_value: field_req_value.unwrap_or_default(),
            opt_enum_value: field_opt_enum_value,
            enum_value: field_enum_value.unwrap_or_default(),
            req_enum_value: field_req_enum_value.unwrap_or_default(),
            opt_str_value: field_opt_str_value,
            str_value: field_str_value.unwrap_or_default(),
            req_str_value: field_req_str_value.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for MyField {
    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 => {
            },
            9 => {
            },
            _ => {}
        }

        None
    }
}

#[allow(clippy::derivable_impls)]
impl ::std::default::Default for self::MyStruct {
    fn default() -> Self {
        Self {
            opt_ref: ::std::option::Option::None,
            r#ref: ::std::default::Default::default(),
            req_ref: ::std::default::Default::default(),
            _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("opt_ref", &self.opt_ref)
            .field("r#ref", &self.r#ref)
            .field("req_ref", &self.req_ref)
            .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<P> ::fbthrift::Serialize<P> for self::MyStruct
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("MyStruct");
        if let ::std::option::Option::Some(some) = &self.opt_ref {
            p.write_field_begin("opt_ref", ::fbthrift::TType::Struct, 1);
            ::fbthrift::Serialize::write(some, p);
            p.write_field_end();
        }
        p.write_field_begin("ref", ::fbthrift::TType::Struct, 2);
        ::fbthrift::Serialize::write(&self.r#ref, p);
        p.write_field_end();
        p.write_field_begin("req_ref", ::fbthrift::TType::Struct, 3);
        ::fbthrift::Serialize::write(&self.req_ref, 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("opt_ref", ::fbthrift::TType::Struct, 1),
            ::fbthrift::Field::new("ref", ::fbthrift::TType::Struct, 2),
            ::fbthrift::Field::new("req_ref", ::fbthrift::TType::Struct, 3),
        ];
        let mut field_opt_ref = ::std::option::Option::None;
        let mut field_ref = ::std::option::Option::None;
        let mut field_req_ref = ::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_opt_ref = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 2) => field_ref = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 3) => field_req_ref = ::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 {
            opt_ref: field_opt_ref,
            r#ref: field_ref.unwrap_or_default(),
            req_ref: field_req_ref.unwrap_or_default(),
            _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 => {
            },
            3 => {
            },
            _ => {}
        }

        None
    }
}

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

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

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

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

impl<P> ::fbthrift::Serialize<P> for self::StructWithUnion
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("StructWithUnion");
        p.write_field_begin("u", ::fbthrift::TType::Struct, 1);
        ::fbthrift::Serialize::write(&self.u, p);
        p.write_field_end();
        p.write_field_begin("aDouble", ::fbthrift::TType::Double, 2);
        ::fbthrift::Serialize::write(&self.aDouble, p);
        p.write_field_end();
        p.write_field_begin("f", ::fbthrift::TType::Struct, 3);
        ::fbthrift::Serialize::write(&self.f, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::StructWithUnion
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("aDouble", ::fbthrift::TType::Double, 2),
            ::fbthrift::Field::new("f", ::fbthrift::TType::Struct, 3),
            ::fbthrift::Field::new("u", ::fbthrift::TType::Struct, 1),
        ];
        let mut field_u = ::std::option::Option::None;
        let mut field_aDouble = ::std::option::Option::None;
        let mut field_f = ::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_u = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Double, 2) => field_aDouble = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 3) => field_f = ::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 {
            u: field_u.unwrap_or_default(),
            aDouble: field_aDouble.unwrap_or_default(),
            f: field_f.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for StructWithUnion {
    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 => {
            },
            _ => {}
        }

        None
    }
}

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

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

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

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

impl<P> ::fbthrift::Serialize<P> for self::RecursiveStruct
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("RecursiveStruct");
        if let ::std::option::Option::Some(some) = &self.mes {
            p.write_field_begin("mes", ::fbthrift::TType::List, 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::RecursiveStruct
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("mes", ::fbthrift::TType::List, 1),
        ];
        let mut field_mes = ::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::List, 1) => field_mes = ::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 {
            mes: field_mes,
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for RecursiveStruct {
    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::StructWithContainers {
    fn default() -> Self {
        Self {
            list_ref: ::std::default::Default::default(),
            set_ref: ::std::default::Default::default(),
            map_ref: ::std::default::Default::default(),
            list_ref_unique: ::std::default::Default::default(),
            set_ref_shared: ::std::default::Default::default(),
            list_ref_shared_const: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::StructWithContainers {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("StructWithContainers")
            .field("list_ref", &self.list_ref)
            .field("set_ref", &self.set_ref)
            .field("map_ref", &self.map_ref)
            .field("list_ref_unique", &self.list_ref_unique)
            .field("set_ref_shared", &self.set_ref_shared)
            .field("list_ref_shared_const", &self.list_ref_shared_const)
            .finish()
    }
}

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

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

impl<P> ::fbthrift::Serialize<P> for self::StructWithContainers
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("StructWithContainers");
        p.write_field_begin("list_ref", ::fbthrift::TType::List, 1);
        ::fbthrift::Serialize::write(&self.list_ref, p);
        p.write_field_end();
        p.write_field_begin("set_ref", ::fbthrift::TType::Set, 2);
        ::fbthrift::Serialize::write(&self.set_ref, p);
        p.write_field_end();
        p.write_field_begin("map_ref", ::fbthrift::TType::Map, 3);
        ::fbthrift::Serialize::write(&self.map_ref, p);
        p.write_field_end();
        p.write_field_begin("list_ref_unique", ::fbthrift::TType::List, 4);
        ::fbthrift::Serialize::write(&self.list_ref_unique, p);
        p.write_field_end();
        p.write_field_begin("set_ref_shared", ::fbthrift::TType::Set, 5);
        ::fbthrift::Serialize::write(&self.set_ref_shared, p);
        p.write_field_end();
        p.write_field_begin("list_ref_shared_const", ::fbthrift::TType::List, 6);
        ::fbthrift::Serialize::write(&self.list_ref_shared_const, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::StructWithContainers
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("list_ref", ::fbthrift::TType::List, 1),
            ::fbthrift::Field::new("list_ref_shared_const", ::fbthrift::TType::List, 6),
            ::fbthrift::Field::new("list_ref_unique", ::fbthrift::TType::List, 4),
            ::fbthrift::Field::new("map_ref", ::fbthrift::TType::Map, 3),
            ::fbthrift::Field::new("set_ref", ::fbthrift::TType::Set, 2),
            ::fbthrift::Field::new("set_ref_shared", ::fbthrift::TType::Set, 5),
        ];
        let mut field_list_ref = ::std::option::Option::None;
        let mut field_set_ref = ::std::option::Option::None;
        let mut field_map_ref = ::std::option::Option::None;
        let mut field_list_ref_unique = ::std::option::Option::None;
        let mut field_set_ref_shared = ::std::option::Option::None;
        let mut field_list_ref_shared_const = ::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::List, 1) => field_list_ref = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Set, 2) => field_set_ref = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Map, 3) => field_map_ref = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::List, 4) => field_list_ref_unique = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Set, 5) => field_set_ref_shared = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::List, 6) => field_list_ref_shared_const = ::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 {
            list_ref: field_list_ref.unwrap_or_default(),
            set_ref: field_set_ref.unwrap_or_default(),
            map_ref: field_map_ref.unwrap_or_default(),
            list_ref_unique: field_list_ref_unique.unwrap_or_default(),
            set_ref_shared: field_set_ref_shared.unwrap_or_default(),
            list_ref_shared_const: field_list_ref_shared_const.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for StructWithContainers {
    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 => {
            },
            _ => {}
        }

        None
    }
}

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

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

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

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

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

impl<P> ::fbthrift::Deserialize<P> for self::StructWithSharedConst
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("opt_shared_const", ::fbthrift::TType::Struct, 1),
            ::fbthrift::Field::new("req_shared_const", ::fbthrift::TType::Struct, 3),
            ::fbthrift::Field::new("shared_const", ::fbthrift::TType::Struct, 2),
        ];
        let mut field_opt_shared_const = ::std::option::Option::None;
        let mut field_shared_const = ::std::option::Option::None;
        let mut field_req_shared_const = ::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_opt_shared_const = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 2) => field_shared_const = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 3) => field_req_shared_const = ::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 {
            opt_shared_const: field_opt_shared_const,
            shared_const: field_shared_const.unwrap_or_default(),
            req_shared_const: field_req_shared_const.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for StructWithSharedConst {
    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 => {
            },
            _ => {}
        }

        None
    }
}

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

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

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

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

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

impl<P> ::fbthrift::Deserialize<P> for self::Empty
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 Empty {
    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::StructWithRef {
    fn default() -> Self {
        Self {
            def_field: ::std::default::Default::default(),
            opt_field: ::std::option::Option::None,
            req_field: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

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

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

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

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

impl<P> ::fbthrift::Deserialize<P> for self::StructWithRef
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("def_field", ::fbthrift::TType::Struct, 1),
            ::fbthrift::Field::new("opt_field", ::fbthrift::TType::Struct, 2),
            ::fbthrift::Field::new("req_field", ::fbthrift::TType::Struct, 3),
        ];
        let mut field_def_field = ::std::option::Option::None;
        let mut field_opt_field = ::std::option::Option::None;
        let mut field_req_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_def_field = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 2) => field_opt_field = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 3) => field_req_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 {
            def_field: field_def_field.unwrap_or_default(),
            opt_field: field_opt_field,
            req_field: field_req_field.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for StructWithRef {
    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 => {
            },
            _ => {}
        }

        None
    }
}

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

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

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

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

impl<P> ::fbthrift::Serialize<P> for self::StructWithBox
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("StructWithBox");
        if let ::std::option::Option::Some(some) = &self.a {
            p.write_field_begin("a", ::fbthrift::TType::String, 1);
            ::fbthrift::Serialize::write(some, p);
            p.write_field_end();
        }
        if let ::std::option::Option::Some(some) = &self.b {
            p.write_field_begin("b", ::fbthrift::TType::List, 2);
            ::fbthrift::Serialize::write(some, p);
            p.write_field_end();
        }
        if let ::std::option::Option::Some(some) = &self.c {
            p.write_field_begin("c", ::fbthrift::TType::Struct, 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::StructWithBox
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("a", ::fbthrift::TType::String, 1),
            ::fbthrift::Field::new("b", ::fbthrift::TType::List, 2),
            ::fbthrift::Field::new("c", ::fbthrift::TType::Struct, 3),
        ];
        let mut field_a = ::std::option::Option::None;
        let mut field_b = ::std::option::Option::None;
        let mut field_c = ::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_a = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::List, 2) => field_b = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 3) => field_c = ::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,
            b: field_b,
            c: field_c,
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for StructWithBox {
    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 => {
            },
            _ => {}
        }

        None
    }
}

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

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

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

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

impl<P> ::fbthrift::Serialize<P> for self::StructWithInternBox
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("StructWithInternBox");
        p.write_field_begin("field1", ::fbthrift::TType::Struct, 1);
        ::fbthrift::Serialize::write(&self.field1, p);
        p.write_field_end();
        p.write_field_begin("field2", ::fbthrift::TType::Struct, 2);
        ::fbthrift::Serialize::write(&self.field2, p);
        p.write_field_end();
        p.write_field_begin("field3", ::fbthrift::TType::Struct, 3);
        ::fbthrift::Serialize::write(&self.field3, p);
        p.write_field_end();
        p.write_field_begin("field4", ::fbthrift::TType::Struct, 4);
        ::fbthrift::Serialize::write(&self.field4, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::StructWithInternBox
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("field1", ::fbthrift::TType::Struct, 1),
            ::fbthrift::Field::new("field2", ::fbthrift::TType::Struct, 2),
            ::fbthrift::Field::new("field3", ::fbthrift::TType::Struct, 3),
            ::fbthrift::Field::new("field4", ::fbthrift::TType::Struct, 4),
        ];
        let mut field_field1 = ::std::option::Option::None;
        let mut field_field2 = ::std::option::Option::None;
        let mut field_field3 = ::std::option::Option::None;
        let mut field_field4 = ::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_field1 = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 2) => field_field2 = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 3) => field_field3 = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 4) => field_field4 = ::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 {
            field1: field_field1.unwrap_or_default(),
            field2: field_field2.unwrap_or_default(),
            field3: field_field3.unwrap_or_default(),
            field4: field_field4.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for StructWithInternBox {
    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::<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 => {

                if type_id == ::std::any::TypeId::of::<thrift::types::InternBox>() {
                    let mut tmp = Some(thrift::types::InternBox {
                        ..::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::<thrift::types::InternBox>() {
                    let mut tmp = Some(thrift::types::InternBox {
                        ..::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::<thrift::types::InternBox>() {
                    let mut tmp = Some(thrift::types::InternBox {
                        ..::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::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();
                }
            },
            4 => {

                if type_id == ::std::any::TypeId::of::<thrift::types::InternBox>() {
                    let mut tmp = Some(thrift::types::InternBox {
                        ..::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::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::AdaptedStructWithInternBox {
    fn default() -> Self {
        Self {
            field1: ::std::default::Default::default(),
            field2: ::std::default::Default::default(),
            field3: ::std::default::Default::default(),
            field4: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

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

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

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

impl<P> ::fbthrift::Serialize<P> for self::AdaptedStructWithInternBox
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("AdaptedStructWithInternBox");
        p.write_field_begin("field1", ::fbthrift::TType::Struct, 1);
        ::fbthrift::Serialize::write(&self.field1, p);
        p.write_field_end();
        p.write_field_begin("field2", ::fbthrift::TType::Struct, 2);
        ::fbthrift::Serialize::write(&self.field2, p);
        p.write_field_end();
        p.write_field_begin("field3", ::fbthrift::TType::Struct, 3);
        ::fbthrift::Serialize::write(&self.field3, p);
        p.write_field_end();
        p.write_field_begin("field4", ::fbthrift::TType::Struct, 4);
        ::fbthrift::Serialize::write(&self.field4, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::AdaptedStructWithInternBox
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("field1", ::fbthrift::TType::Struct, 1),
            ::fbthrift::Field::new("field2", ::fbthrift::TType::Struct, 2),
            ::fbthrift::Field::new("field3", ::fbthrift::TType::Struct, 3),
            ::fbthrift::Field::new("field4", ::fbthrift::TType::Struct, 4),
        ];
        let mut field_field1 = ::std::option::Option::None;
        let mut field_field2 = ::std::option::Option::None;
        let mut field_field3 = ::std::option::Option::None;
        let mut field_field4 = ::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_field1 = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 2) => field_field2 = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 3) => field_field3 = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 4) => field_field4 = ::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 {
            field1: field_field1.unwrap_or_default(),
            field2: field_field2.unwrap_or_default(),
            field3: field_field3.unwrap_or_default(),
            field4: field_field4.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for AdaptedStructWithInternBox {
    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::<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 => {

                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::InternBox>() {
                    let mut tmp = Some(thrift::types::InternBox {
                        ..::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::InternBox>() {
                    let mut tmp = Some(thrift::types::InternBox {
                        ..::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::InternBox>() {
                    let mut tmp = Some(thrift::types::InternBox {
                        ..::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::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();
                }
            },
            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::InternBox>() {
                    let mut tmp = Some(thrift::types::InternBox {
                        ..::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::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::StructWithRefTypeUnique {
    fn default() -> Self {
        Self {
            def_field: ::std::default::Default::default(),
            opt_field: ::std::option::Option::None,
            req_field: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

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

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

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

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

impl<P> ::fbthrift::Deserialize<P> for self::StructWithRefTypeUnique
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("def_field", ::fbthrift::TType::Struct, 1),
            ::fbthrift::Field::new("opt_field", ::fbthrift::TType::Struct, 2),
            ::fbthrift::Field::new("req_field", ::fbthrift::TType::Struct, 3),
        ];
        let mut field_def_field = ::std::option::Option::None;
        let mut field_opt_field = ::std::option::Option::None;
        let mut field_req_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_def_field = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 2) => field_opt_field = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 3) => field_req_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 {
            def_field: field_def_field.unwrap_or_default(),
            opt_field: field_opt_field,
            req_field: field_req_field.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for StructWithRefTypeUnique {
    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 => {
            },
            _ => {}
        }

        None
    }
}

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

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

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

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

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

impl<P> ::fbthrift::Deserialize<P> for self::StructWithRefTypeShared
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("def_field", ::fbthrift::TType::Struct, 1),
            ::fbthrift::Field::new("opt_field", ::fbthrift::TType::Struct, 2),
            ::fbthrift::Field::new("req_field", ::fbthrift::TType::Struct, 3),
        ];
        let mut field_def_field = ::std::option::Option::None;
        let mut field_opt_field = ::std::option::Option::None;
        let mut field_req_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_def_field = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 2) => field_opt_field = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 3) => field_req_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 {
            def_field: field_def_field.unwrap_or_default(),
            opt_field: field_opt_field,
            req_field: field_req_field.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for StructWithRefTypeShared {
    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 => {
            },
            _ => {}
        }

        None
    }
}

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

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

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

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

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

impl<P> ::fbthrift::Deserialize<P> for self::StructWithRefTypeSharedConst
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("def_field", ::fbthrift::TType::Struct, 1),
            ::fbthrift::Field::new("opt_field", ::fbthrift::TType::Struct, 2),
            ::fbthrift::Field::new("req_field", ::fbthrift::TType::Struct, 3),
        ];
        let mut field_def_field = ::std::option::Option::None;
        let mut field_opt_field = ::std::option::Option::None;
        let mut field_req_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_def_field = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 2) => field_opt_field = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::Struct, 3) => field_req_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 {
            def_field: field_def_field.unwrap_or_default(),
            opt_field: field_opt_field,
            req_field: field_req_field.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for StructWithRefTypeSharedConst {
    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 => {
            },
            _ => {}
        }

        None
    }
}

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

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

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

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

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

impl<P> ::fbthrift::Deserialize<P> for self::StructWithRefAndAnnotCppNoexceptMoveCtor
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("def_field", ::fbthrift::TType::Struct, 1),
        ];
        let mut field_def_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_def_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 {
            def_field: field_def_field.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for StructWithRefAndAnnotCppNoexceptMoveCtor {
    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::StructWithString {
    fn default() -> Self {
        Self {
            def_unique_string_ref: "...".to_owned(),
            def_shared_string_ref: "...".to_owned(),
            def_shared_string_const_ref: "...".to_owned(),
            unique_string_ref: ::std::default::Default::default(),
            shared_string_ref: ::std::default::Default::default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        }
    }
}

impl ::std::fmt::Debug for self::StructWithString {
    fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        formatter
            .debug_struct("StructWithString")
            .field("def_unique_string_ref", &self.def_unique_string_ref)
            .field("def_shared_string_ref", &self.def_shared_string_ref)
            .field("def_shared_string_const_ref", &self.def_shared_string_const_ref)
            .field("unique_string_ref", &self.unique_string_ref)
            .field("shared_string_ref", &self.shared_string_ref)
            .finish()
    }
}

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

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

impl<P> ::fbthrift::Serialize<P> for self::StructWithString
where
    P: ::fbthrift::ProtocolWriter,
{
    fn write(&self, p: &mut P) {
        p.write_struct_begin("StructWithString");
        p.write_field_begin("def_unique_string_ref", ::fbthrift::TType::String, 1);
        ::fbthrift::Serialize::write(&self.def_unique_string_ref, p);
        p.write_field_end();
        p.write_field_begin("def_shared_string_ref", ::fbthrift::TType::String, 2);
        ::fbthrift::Serialize::write(&self.def_shared_string_ref, p);
        p.write_field_end();
        p.write_field_begin("def_shared_string_const_ref", ::fbthrift::TType::String, 3);
        ::fbthrift::Serialize::write(&self.def_shared_string_const_ref, p);
        p.write_field_end();
        p.write_field_begin("unique_string_ref", ::fbthrift::TType::String, 4);
        ::fbthrift::Serialize::write(&self.unique_string_ref, p);
        p.write_field_end();
        p.write_field_begin("shared_string_ref", ::fbthrift::TType::String, 5);
        ::fbthrift::Serialize::write(&self.shared_string_ref, p);
        p.write_field_end();
        p.write_field_stop();
        p.write_struct_end();
    }
}

impl<P> ::fbthrift::Deserialize<P> for self::StructWithString
where
    P: ::fbthrift::ProtocolReader,
{
    fn read(p: &mut P) -> ::anyhow::Result<Self> {
        static FIELDS: &[::fbthrift::Field] = &[
            ::fbthrift::Field::new("def_shared_string_const_ref", ::fbthrift::TType::String, 3),
            ::fbthrift::Field::new("def_shared_string_ref", ::fbthrift::TType::String, 2),
            ::fbthrift::Field::new("def_unique_string_ref", ::fbthrift::TType::String, 1),
            ::fbthrift::Field::new("shared_string_ref", ::fbthrift::TType::String, 5),
            ::fbthrift::Field::new("unique_string_ref", ::fbthrift::TType::String, 4),
        ];
        let mut field_def_unique_string_ref = ::std::option::Option::None;
        let mut field_def_shared_string_ref = ::std::option::Option::None;
        let mut field_def_shared_string_const_ref = ::std::option::Option::None;
        let mut field_unique_string_ref = ::std::option::Option::None;
        let mut field_shared_string_ref = ::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_def_unique_string_ref = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::String, 2) => field_def_shared_string_ref = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::String, 3) => field_def_shared_string_const_ref = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::String, 4) => field_unique_string_ref = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
                (::fbthrift::TType::String, 5) => field_shared_string_ref = ::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 {
            def_unique_string_ref: field_def_unique_string_ref.unwrap_or_else(|| "...".to_owned()),
            def_shared_string_ref: field_def_shared_string_ref.unwrap_or_else(|| "...".to_owned()),
            def_shared_string_const_ref: field_def_shared_string_const_ref.unwrap_or_else(|| "...".to_owned()),
            unique_string_ref: field_unique_string_ref.unwrap_or_default(),
            shared_string_ref: field_shared_string_ref.unwrap_or_default(),
            _dot_dot_Default_default: self::dot_dot::OtherFields(()),
        })
    }
}

impl ::fbthrift::metadata::ThriftAnnotations for StructWithString {
    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 => {
            },
            _ => {}
        }

        None
    }
}

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(())
    }
}