From 895716405fed381e70d26c5e81dc747ba0abc319 Mon Sep 17 00:00:00 2001 From: Millione Date: Mon, 20 May 2024 15:52:56 +0800 Subject: [PATCH] feat: support default value for set --- pilota-build/src/middle/context.rs | 14 + pilota-build/test_data/thrift/apache.rs | 22252 ++++++++++++++++++ pilota-build/test_data/thrift/apache.thrift | 426 + 3 files changed, 22692 insertions(+) create mode 100644 pilota-build/test_data/thrift/apache.rs create mode 100644 pilota-build/test_data/thrift/apache.thrift diff --git a/pilota-build/src/middle/context.rs b/pilota-build/src/middle/context.rs index d97edb00..740d8fb9 100644 --- a/pilota-build/src/middle/context.rs +++ b/pilota-build/src/middle/context.rs @@ -725,6 +725,20 @@ impl Context { (format! { "::std::vec![{stream}]" }.into(), false) } + (Literal::List(els), CodegenTy::Set(inner)) => { + let stream = els + .iter() + .map(|el| self.lit_into_ty(el, inner)) + .try_collect::<_, Vec<_>, _>()? + .into_iter() + .map(|(s, _)| s) + .join(","); + + ( + format! { "::pilota::AHashSet::from([{stream}])" }.into(), + false, + ) + } (Literal::Bool(b), CodegenTy::Bool) => (format! { "{b}" }.into(), true), (Literal::String(s), CodegenTy::Bytes) => { let s = &**s; diff --git a/pilota-build/test_data/thrift/apache.rs b/pilota-build/test_data/thrift/apache.rs new file mode 100644 index 00000000..bf428922 --- /dev/null +++ b/pilota-build/test_data/thrift/apache.rs @@ -0,0 +1,22252 @@ +pub mod apache { + #![allow(warnings, clippy::all)] + + pub mod apache { + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq, Copy)] + #[repr(transparent)] + pub struct Numberz(i32); + + impl Numberz { + pub const ONE: Self = Self(1); + pub const TWO: Self = Self(2); + pub const THREE: Self = Self(3); + pub const FIVE: Self = Self(5); + pub const SIX: Self = Self(6); + pub const EIGHT: Self = Self(8); + + pub fn inner(&self) -> i32 { + self.0 + } + + pub fn to_string(&self) -> ::std::string::String { + match self { + Self(1) => ::std::string::String::from("ONE"), + Self(2) => ::std::string::String::from("TWO"), + Self(3) => ::std::string::String::from("THREE"), + Self(5) => ::std::string::String::from("FIVE"), + Self(6) => ::std::string::String::from("SIX"), + Self(8) => ::std::string::String::from("EIGHT"), + Self(val) => val.to_string(), + } + } + } + + impl ::std::convert::From for Numberz { + fn from(value: i32) -> Self { + Self(value) + } + } + + impl ::std::convert::From for i32 { + fn from(value: Numberz) -> i32 { + value.0 + } + } + + impl ::pilota::thrift::Message for Numberz { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_i32(self.inner())?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let value = protocol.read_i32()?; + ::std::result::Result::Ok(::std::convert::TryFrom::try_from(value).map_err( + |err| { + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + format!("invalid enum value for Numberz, value: {}", value), + ) + }, + )?) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let value = protocol.read_i32().await?; + ::std::result::Result::Ok(::std::convert::TryFrom::try_from(value).map_err( + |err| { + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + format!("invalid enum value for Numberz, value: {}", value), + ) + }, + )?) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.i32_len(self.inner()) + } + } + #[derive(Debug, Default, Clone, PartialEq)] + pub struct LargeDeltas { + pub b1: ::std::option::Option, + + pub b10: ::std::option::Option, + + pub b100: ::std::option::Option, + + pub check_true: ::std::option::Option, + + pub b1000: ::std::option::Option, + + pub check_false: ::std::option::Option, + + pub vertwo2000: ::std::option::Option, + + pub a_set2500: ::std::option::Option<::pilota::AHashSet<::pilota::FastStr>>, + + pub vertwo3000: ::std::option::Option, + + pub big_numbers: ::std::option::Option<::std::vec::Vec>, + } + impl ::pilota::thrift::Message for LargeDeltas { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "LargeDeltas", + }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.b1.as_ref() { + protocol.write_struct_field(1, value, ::pilota::thrift::TType::Struct)?; + } + if let Some(value) = self.b10.as_ref() { + protocol.write_struct_field(10, value, ::pilota::thrift::TType::Struct)?; + } + if let Some(value) = self.b100.as_ref() { + protocol.write_struct_field(100, value, ::pilota::thrift::TType::Struct)?; + } + if let Some(value) = self.check_true.as_ref() { + protocol.write_bool_field(500, *value)?; + } + if let Some(value) = self.b1000.as_ref() { + protocol.write_struct_field(1000, value, ::pilota::thrift::TType::Struct)?; + } + if let Some(value) = self.check_false.as_ref() { + protocol.write_bool_field(1500, *value)?; + } + if let Some(value) = self.vertwo2000.as_ref() { + protocol.write_struct_field(2000, value, ::pilota::thrift::TType::Struct)?; + } + if let Some(value) = self.a_set2500.as_ref() { + protocol.write_set_field( + 2500, + ::pilota::thrift::TType::Binary, + &value, + |protocol, val| { + protocol.write_faststr((val).clone())?; + ::std::result::Result::Ok(()) + }, + )?; + } + if let Some(value) = self.vertwo3000.as_ref() { + protocol.write_struct_field(3000, value, ::pilota::thrift::TType::Struct)?; + } + if let Some(value) = self.big_numbers.as_ref() { + protocol.write_list_field( + 4000, + ::pilota::thrift::TType::I32, + &value, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut b1 = None; + let mut b10 = None; + let mut b100 = None; + let mut check_true = None; + let mut b1000 = None; + let mut check_false = None; + let mut vertwo2000 = None; + let mut a_set2500 = None; + let mut vertwo3000 = None; + let mut big_numbers = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + b1 = Some(::pilota::thrift::Message::decode(protocol)?); + } + Some(10) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + b10 = Some(::pilota::thrift::Message::decode(protocol)?); + } + Some(100) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + b100 = Some(::pilota::thrift::Message::decode(protocol)?); + } + Some(500) + if field_ident.field_type == ::pilota::thrift::TType::Bool => + { + check_true = Some(protocol.read_bool()?); + } + Some(1000) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + b1000 = Some(::pilota::thrift::Message::decode(protocol)?); + } + Some(1500) + if field_ident.field_type == ::pilota::thrift::TType::Bool => + { + check_false = Some(protocol.read_bool()?); + } + Some(2000) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + vertwo2000 = Some(::pilota::thrift::Message::decode(protocol)?); + } + Some(2500) + if field_ident.field_type == ::pilota::thrift::TType::Set => + { + a_set2500 = Some({ + let list_ident = protocol.read_set_begin()?; + let mut val = + ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(protocol.read_faststr()?); + } + protocol.read_set_end()?; + val + }); + } + Some(3000) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + vertwo3000 = Some(::pilota::thrift::Message::decode(protocol)?); + } + Some(4000) + if field_ident.field_type == ::pilota::thrift::TType::List => + { + big_numbers = Some(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec = Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr() + .offset(i as isize) + .write(protocol.read_i32()?); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `LargeDeltas` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { + b1, + b10, + b100, + check_true, + b1000, + check_false, + vertwo2000, + a_set2500, + vertwo3000, + big_numbers, + }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut b1 = None; + let mut b10 = None; + let mut b100 = None; + let mut check_true = None; + let mut b1000 = None; + let mut check_false = None; + let mut vertwo2000 = None; + let mut a_set2500 = None; + let mut vertwo3000 = None; + let mut big_numbers = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + + + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + + break; + } else { + + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::Struct => { + b1 = Some(::decode_async(protocol).await?); + + },Some(10) if field_ident.field_type == ::pilota::thrift::TType::Struct => { + b10 = Some(::decode_async(protocol).await?); + + },Some(100) if field_ident.field_type == ::pilota::thrift::TType::Struct => { + b100 = Some(::decode_async(protocol).await?); + + },Some(500) if field_ident.field_type == ::pilota::thrift::TType::Bool => { + check_true = Some(protocol.read_bool().await?); + + },Some(1000) if field_ident.field_type == ::pilota::thrift::TType::Struct => { + b1000 = Some(::decode_async(protocol).await?); + + },Some(1500) if field_ident.field_type == ::pilota::thrift::TType::Bool => { + check_false = Some(protocol.read_bool().await?); + + },Some(2000) if field_ident.field_type == ::pilota::thrift::TType::Struct => { + vertwo2000 = Some(::decode_async(protocol).await?); + + },Some(2500) if field_ident.field_type == ::pilota::thrift::TType::Set => { + a_set2500 = Some({let list_ident = protocol.read_set_begin().await?; + let mut val = ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(protocol.read_faststr().await?); + }; + protocol.read_set_end().await?; + val}); + + },Some(3000) if field_ident.field_type == ::pilota::thrift::TType::Struct => { + vertwo3000 = Some(::decode_async(protocol).await?); + + },Some(4000) if field_ident.field_type == ::pilota::thrift::TType::List => { + big_numbers = Some({ + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push(protocol.read_i32().await?); + }; + protocol.read_list_end().await?; + val + }); + + }, + _ => { + protocol.skip(field_ident.field_type).await?; + + }, + } + + protocol.read_field_end().await?; + + + }; + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + }.await { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `LargeDeltas` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { + b1, + b10, + b100, + check_true, + b1000, + check_false, + vertwo2000, + a_set2500, + vertwo3000, + big_numbers, + }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "LargeDeltas", + }) + self + .b1 + .as_ref() + .map_or(0, |value| protocol.struct_field_len(Some(1), value)) + + self + .b10 + .as_ref() + .map_or(0, |value| protocol.struct_field_len(Some(10), value)) + + self + .b100 + .as_ref() + .map_or(0, |value| protocol.struct_field_len(Some(100), value)) + + self + .check_true + .as_ref() + .map_or(0, |value| protocol.bool_field_len(Some(500), *value)) + + self + .b1000 + .as_ref() + .map_or(0, |value| protocol.struct_field_len(Some(1000), value)) + + self + .check_false + .as_ref() + .map_or(0, |value| protocol.bool_field_len(Some(1500), *value)) + + self + .vertwo2000 + .as_ref() + .map_or(0, |value| protocol.struct_field_len(Some(2000), value)) + + self.a_set2500.as_ref().map_or(0, |value| { + protocol.set_field_len( + Some(2500), + ::pilota::thrift::TType::Binary, + value, + |protocol, el| protocol.faststr_len(el), + ) + }) + + self + .vertwo3000 + .as_ref() + .map_or(0, |value| protocol.struct_field_len(Some(3000), value)) + + self.big_numbers.as_ref().map_or(0, |value| { + protocol.list_field_len( + Some(4000), + ::pilota::thrift::TType::I32, + value, + |protocol, el| protocol.i32_len(*el), + ) + }) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestI32ArgsSend { + pub thing: i32, + } + impl ::pilota::thrift::Message for ThriftTestTestI32ArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestI32ArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_i32_field(1, *&self.thing)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + thing = Some(protocol.read_i32()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestI32ArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + thing = Some(protocol.read_i32().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestI32ArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestI32ArgsSend", + }) + protocol.i32_field_len(Some(1), *&self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestSetArgsRecv { + pub thing: ::pilota::AHashSet, + } + impl ::pilota::thrift::Message for ThriftTestTestSetArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestSetArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_set_field( + 1, + ::pilota::thrift::TType::I32, + &&self.thing, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::Set => { + thing = Some({ + let list_ident = protocol.read_set_begin()?; + let mut val = + ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(protocol.read_i32()?); + } + protocol.read_set_end()?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestSetArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Set => + { + thing = Some({ + let list_ident = protocol.read_set_begin().await?; + let mut val = + ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(protocol.read_i32().await?); + } + protocol.read_set_end().await?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestSetArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestSetArgsRecv", + }) + protocol.set_field_len( + Some(1), + ::pilota::thrift::TType::I32, + &self.thing, + |protocol, el| protocol.i32_len(*el), + ) + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestMultiExceptionException { + #[derivative(Default)] + Err1(Xception), + + Err2(Xception2), + } + + impl ::pilota::thrift::Message for ThriftTestTestMultiExceptionException { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMultiExceptionException", + })?; + match self { + ThriftTestTestMultiExceptionException::Err1(ref value) => { + protocol.write_struct_field(1, value, ::pilota::thrift::TType::Struct)?; + } + ThriftTestTestMultiExceptionException::Err2(ref value) => { + protocol.write_struct_field(2, value, ::pilota::thrift::TType::Struct)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(1) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = + Some(ThriftTestTestMultiExceptionException::Err1(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + Some(2) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = + Some(ThriftTestTestMultiExceptionException::Err2(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(1) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(ThriftTestTestMultiExceptionException::Err1( + field_ident, + )); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + Some(2) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(ThriftTestTestMultiExceptionException::Err2( + field_ident, + )); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMultiExceptionException", + }) + match self { + ThriftTestTestMultiExceptionException::Err1(ref value) => { + protocol.struct_field_len(Some(1), value) + } + ThriftTestTestMultiExceptionException::Err2(ref value) => { + protocol.struct_field_len(Some(2), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestVoidArgsSend {} + impl ::pilota::thrift::Message for ThriftTestTestVoidArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestVoidArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestVoidArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self {}; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestVoidArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self {}; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestVoidArgsSend", + }) + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestStructArgsRecv { + pub thing: Xtruct, + } + impl ::pilota::thrift::Message for ThriftTestTestStructArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStructArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_struct_field(1, &self.thing, ::pilota::thrift::TType::Struct)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + thing = Some(::pilota::thrift::Message::decode(protocol)?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestStructArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Struct => + { + thing = Some( + ::decode_async( + protocol, + ) + .await?, + ); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestStructArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStructArgsRecv", + }) + protocol.struct_field_len(Some(1), &self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestMultiResultRecv { + #[derivative(Default)] + Ok(Xtruct), + } + + impl ::pilota::thrift::Message for ThriftTestTestMultiResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMultiResultRecv", + })?; + match self { + ThriftTestTestMultiResultRecv::Ok(ref value) => { + protocol.write_struct_field(0, value, ::pilota::thrift::TType::Struct)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = Some(ThriftTestTestMultiResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(ThriftTestTestMultiResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMultiResultRecv", + }) + match self { + ThriftTestTestMultiResultRecv::Ok(ref value) => { + protocol.struct_field_len(Some(0), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + pub const MY_NUMBERZ: Numberz = Numberz::ONE; + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct StructA { + pub s: ::pilota::FastStr, + } + impl ::pilota::thrift::Message for StructA { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { name: "StructA" }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_faststr_field(1, (&self.s).clone())?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut s = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + s = Some(protocol.read_faststr()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `StructA` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(s) = s else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field s is required".to_string(), + )); + }; + + let data = Self { s }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut s = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + s = Some(protocol.read_faststr().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `StructA` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(s) = s else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field s is required".to_string(), + ), + ); + }; + + let data = Self { s }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { name: "StructA" }) + + protocol.faststr_field_len(Some(1), &self.s) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestI64ArgsRecv { + pub thing: i64, + } + impl ::pilota::thrift::Message for ThriftTestTestI64ArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestI64ArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_i64_field(1, *&self.thing)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I64 => { + thing = Some(protocol.read_i64()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestI64ArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I64 => + { + thing = Some(protocol.read_i64().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestI64ArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestI64ArgsRecv", + }) + protocol.i64_field_len(Some(1), *&self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestEnumResultRecv { + #[derivative(Default)] + Ok(Numberz), + } + + impl ::pilota::thrift::Message for ThriftTestTestEnumResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestEnumResultRecv", + })?; + match self { + ThriftTestTestEnumResultRecv::Ok(ref value) => { + protocol.write_i32_field(0, (value).inner())?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = Some(ThriftTestTestEnumResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(ThriftTestTestEnumResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestEnumResultRecv", + }) + match self { + ThriftTestTestEnumResultRecv::Ok(ref value) => { + protocol.i32_field_len(Some(0), (value).inner()) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestOnewayResultSend { + #[derivative(Default)] + Ok(()), + } + + impl ::pilota::thrift::Message for ThriftTestTestOnewayResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestOnewayResultSend", + })?; + match self { + ThriftTestTestOnewayResultSend::Ok(ref value) => {} + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Ok(ThriftTestTestOnewayResultSend::Ok(())) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Ok(ThriftTestTestOnewayResultSend::Ok(())) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestOnewayResultSend", + }) + match self { + ThriftTestTestOnewayResultSend::Ok(ref value) => 0, + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestStringArgsRecv { + pub thing: ::pilota::FastStr, + } + impl ::pilota::thrift::Message for ThriftTestTestStringArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStringArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_faststr_field(1, (&self.thing).clone())?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + thing = Some(protocol.read_faststr()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestStringArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + thing = Some(protocol.read_faststr().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestStringArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStringArgsRecv", + }) + protocol.faststr_field_len(Some(1), &self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestMapResultRecv { + #[derivative(Default)] + Ok(::pilota::AHashMap), + } + + impl ::pilota::thrift::Message for ThriftTestTestMapResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMapResultRecv", + })?; + match self { + ThriftTestTestMapResultRecv::Ok(ref value) => { + protocol.write_map_field( + 0, + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I32, + &value, + |protocol, key| { + protocol.write_i32(*key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(protocol.read_i32()?, protocol.read_i32()?); + } + protocol.read_map_end()?; + val + }; + protocol.map_len( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I32, + &field_ident, + |protocol, key| protocol.i32_len(*key), + |protocol, val| protocol.i32_len(*val), + ); + ret = Some(ThriftTestTestMapResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let map_ident = protocol.read_map_begin().await?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_i32().await?, + protocol.read_i32().await?, + ); + } + protocol.read_map_end().await?; + val + }; + + ret = Some(ThriftTestTestMapResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMapResultRecv", + }) + match self { + ThriftTestTestMapResultRecv::Ok(ref value) => protocol.map_field_len( + Some(0), + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I32, + value, + |protocol, key| protocol.i32_len(*key), + |protocol, val| protocol.i32_len(*val), + ), + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct Xtruct3 { + pub string_thing: ::std::option::Option<::pilota::FastStr>, + + pub changed: ::std::option::Option, + + pub i32_thing: ::std::option::Option, + + pub i64_thing: ::std::option::Option, + } + impl ::pilota::thrift::Message for Xtruct3 { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { name: "Xtruct3" }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.string_thing.as_ref() { + protocol.write_faststr_field(1, (value).clone())?; + } + if let Some(value) = self.changed.as_ref() { + protocol.write_i32_field(4, *value)?; + } + if let Some(value) = self.i32_thing.as_ref() { + protocol.write_i32_field(9, *value)?; + } + if let Some(value) = self.i64_thing.as_ref() { + protocol.write_i64_field(11, *value)?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut string_thing = None; + let mut changed = None; + let mut i32_thing = None; + let mut i64_thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + string_thing = Some(protocol.read_faststr()?); + } + Some(4) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + changed = Some(protocol.read_i32()?); + } + Some(9) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + i32_thing = Some(protocol.read_i32()?); + } + Some(11) if field_ident.field_type == ::pilota::thrift::TType::I64 => { + i64_thing = Some(protocol.read_i64()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `Xtruct3` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { + string_thing, + changed, + i32_thing, + i64_thing, + }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut string_thing = None; + let mut changed = None; + let mut i32_thing = None; + let mut i64_thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + string_thing = Some(protocol.read_faststr().await?); + } + Some(4) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + changed = Some(protocol.read_i32().await?); + } + Some(9) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + i32_thing = Some(protocol.read_i32().await?); + } + Some(11) + if field_ident.field_type == ::pilota::thrift::TType::I64 => + { + i64_thing = Some(protocol.read_i64().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `Xtruct3` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { + string_thing, + changed, + i32_thing, + i64_thing, + }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { name: "Xtruct3" }) + + self + .string_thing + .as_ref() + .map_or(0, |value| protocol.faststr_field_len(Some(1), value)) + + self + .changed + .as_ref() + .map_or(0, |value| protocol.i32_field_len(Some(4), *value)) + + self + .i32_thing + .as_ref() + .map_or(0, |value| protocol.i32_field_len(Some(9), *value)) + + self + .i64_thing + .as_ref() + .map_or(0, |value| protocol.i64_field_len(Some(11), *value)) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestBinaryResultRecv { + #[derivative(Default)] + Ok(::pilota::Bytes), + } + + impl ::pilota::thrift::Message for ThriftTestTestBinaryResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestBinaryResultRecv", + })?; + match self { + ThriftTestTestBinaryResultRecv::Ok(ref value) => { + protocol.write_bytes_field(0, (value).clone())?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_bytes()?; + protocol.bytes_len(&field_ident); + ret = Some(ThriftTestTestBinaryResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_bytes().await?; + + ret = Some(ThriftTestTestBinaryResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestBinaryResultRecv", + }) + match self { + ThriftTestTestBinaryResultRecv::Ok(ref value) => { + protocol.bytes_field_len(Some(0), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum SecondServiceSecondtestStringResultSend { + #[derivative(Default)] + Ok(::pilota::FastStr), + } + + impl ::pilota::thrift::Message for SecondServiceSecondtestStringResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "SecondServiceSecondtestStringResultSend", + })?; + match self { + SecondServiceSecondtestStringResultSend::Ok(ref value) => { + protocol.write_faststr_field(0, (value).clone())?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_faststr()?; + protocol.faststr_len(&field_ident); + ret = + Some(SecondServiceSecondtestStringResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_faststr().await?; + + ret = Some(SecondServiceSecondtestStringResultSend::Ok( + field_ident, + )); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "SecondServiceSecondtestStringResultSend", + }) + match self { + SecondServiceSecondtestStringResultSend::Ok(ref value) => { + protocol.faststr_field_len(Some(0), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestByteResultRecv { + #[derivative(Default)] + Ok(i8), + } + + impl ::pilota::thrift::Message for ThriftTestTestByteResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestByteResultRecv", + })?; + match self { + ThriftTestTestByteResultRecv::Ok(ref value) => { + protocol.write_i8_field(0, *value)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_i8()?; + protocol.i8_len(*&field_ident); + ret = Some(ThriftTestTestByteResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_i8().await?; + + ret = Some(ThriftTestTestByteResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestByteResultRecv", + }) + match self { + ThriftTestTestByteResultRecv::Ok(ref value) => { + protocol.i8_field_len(Some(0), *value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestExceptionArgsSend { + pub arg: ::pilota::FastStr, + } + impl ::pilota::thrift::Message for ThriftTestTestExceptionArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestExceptionArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_faststr_field(1, (&self.arg).clone())?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut arg = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + arg = Some(protocol.read_faststr()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestExceptionArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(arg) = arg else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg is required".to_string(), + )); + }; + + let data = Self { arg }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut arg = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + arg = Some(protocol.read_faststr().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestExceptionArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(arg) = arg else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg is required".to_string(), + ), + ); + }; + + let data = Self { arg }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestExceptionArgsSend", + }) + protocol.faststr_field_len(Some(1), &self.arg) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestMapMapResultSend { + #[derivative(Default)] + Ok(::pilota::AHashMap>), + } + + impl ::pilota::thrift::Message for ThriftTestTestMapMapResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMapMapResultSend", + })?; + match self { + ThriftTestTestMapMapResultSend::Ok(ref value) => { + protocol.write_map_field( + 0, + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::Map, + &value, + |protocol, key| { + protocol.write_i32(*key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_map( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I32, + &val, + |protocol, key| { + protocol.write_i32(*key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + }, + )?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(protocol.read_i32()?, { + let map_ident = protocol.read_map_begin()?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_i32()?, + protocol.read_i32()?, + ); + } + protocol.read_map_end()?; + val + }); + } + protocol.read_map_end()?; + val + }; + protocol.map_len( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::Map, + &field_ident, + |protocol, key| protocol.i32_len(*key), + |protocol, val| { + protocol.map_len( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I32, + val, + |protocol, key| protocol.i32_len(*key), + |protocol, val| protocol.i32_len(*val), + ) + }, + ); + ret = Some(ThriftTestTestMapMapResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let map_ident = protocol.read_map_begin().await?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(protocol.read_i32().await?, { + let map_ident = protocol.read_map_begin().await?; + let mut val = ::pilota::AHashMap::with_capacity( + map_ident.size, + ); + for _ in 0..map_ident.size { + val.insert( + protocol.read_i32().await?, + protocol.read_i32().await?, + ); + } + protocol.read_map_end().await?; + val + }); + } + protocol.read_map_end().await?; + val + }; + + ret = Some(ThriftTestTestMapMapResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMapMapResultSend", + }) + match self { + ThriftTestTestMapMapResultSend::Ok(ref value) => protocol.map_field_len( + Some(0), + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::Map, + value, + |protocol, key| protocol.i32_len(*key), + |protocol, val| { + protocol.map_len( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I32, + val, + |protocol, key| protocol.i32_len(*key), + |protocol, val| protocol.i32_len(*val), + ) + }, + ), + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ListTypeVersioningV1 { + pub myints: ::std::option::Option<::std::vec::Vec>, + + pub hello: ::std::option::Option<::pilota::FastStr>, + } + impl ::pilota::thrift::Message for ListTypeVersioningV1 { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ListTypeVersioningV1", + }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.myints.as_ref() { + protocol.write_list_field( + 1, + ::pilota::thrift::TType::I32, + &value, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + } + if let Some(value) = self.hello.as_ref() { + protocol.write_faststr_field(2, (value).clone())?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut myints = None; + let mut hello = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::List => { + myints = Some(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec = Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr() + .offset(i as isize) + .write(protocol.read_i32()?); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + } + Some(2) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + hello = Some(protocol.read_faststr()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `ListTypeVersioningV1` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { myints, hello }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut myints = None; + let mut hello = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::List => + { + myints = Some({ + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push(protocol.read_i32().await?); + } + protocol.read_list_end().await?; + val + }); + } + Some(2) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + hello = Some(protocol.read_faststr().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ListTypeVersioningV1` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { myints, hello }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ListTypeVersioningV1", + }) + self.myints.as_ref().map_or(0, |value| { + protocol.list_field_len( + Some(1), + ::pilota::thrift::TType::I32, + value, + |protocol, el| protocol.i32_len(*el), + ) + }) + self + .hello + .as_ref() + .map_or(0, |value| protocol.faststr_field_len(Some(2), value)) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestSetResultSend { + #[derivative(Default)] + Ok(::pilota::AHashSet), + } + + impl ::pilota::thrift::Message for ThriftTestTestSetResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestSetResultSend", + })?; + match self { + ThriftTestTestSetResultSend::Ok(ref value) => { + protocol.write_set_field( + 0, + ::pilota::thrift::TType::I32, + &value, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let list_ident = protocol.read_set_begin()?; + let mut val = + ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(protocol.read_i32()?); + } + protocol.read_set_end()?; + val + }; + protocol.set_len( + ::pilota::thrift::TType::I32, + &field_ident, + |protocol, el| protocol.i32_len(*el), + ); + ret = Some(ThriftTestTestSetResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let list_ident = protocol.read_set_begin().await?; + let mut val = + ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(protocol.read_i32().await?); + } + protocol.read_set_end().await?; + val + }; + + ret = Some(ThriftTestTestSetResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestSetResultSend", + }) + match self { + ThriftTestTestSetResultSend::Ok(ref value) => protocol.set_field_len( + Some(0), + ::pilota::thrift::TType::I32, + value, + |protocol, el| protocol.i32_len(*el), + ), + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestStructResultSend { + #[derivative(Default)] + Ok(Xtruct), + } + + impl ::pilota::thrift::Message for ThriftTestTestStructResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStructResultSend", + })?; + match self { + ThriftTestTestStructResultSend::Ok(ref value) => { + protocol.write_struct_field(0, value, ::pilota::thrift::TType::Struct)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = Some(ThriftTestTestStructResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(ThriftTestTestStructResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStructResultSend", + }) + match self { + ThriftTestTestStructResultSend::Ok(ref value) => { + protocol.struct_field_len(Some(0), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ListBonks { + pub bonk: ::std::option::Option<::std::vec::Vec>, + } + impl ::pilota::thrift::Message for ListBonks { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { name: "ListBonks" }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.bonk.as_ref() { + protocol.write_list_field( + 1, + ::pilota::thrift::TType::Struct, + &value, + |protocol, val| { + protocol.write_struct(val)?; + ::std::result::Result::Ok(()) + }, + )?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut bonk = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::List => { + bonk = Some(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec = Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr() + .offset(i as isize) + .write(::pilota::thrift::Message::decode(protocol)?); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `ListBonks` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { bonk }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut bonk = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::List => + { + bonk = Some({ + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push( + ::decode_async( + protocol, + ) + .await?, + ); + } + protocol.read_list_end().await?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `ListBonks` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { bonk }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol + .struct_begin_len(&::pilota::thrift::TStructIdentifier { name: "ListBonks" }) + + self.bonk.as_ref().map_or(0, |value| { + protocol.list_field_len( + Some(1), + ::pilota::thrift::TType::Struct, + value, + |protocol, el| protocol.struct_len(el), + ) + }) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestI64ResultSend { + #[derivative(Default)] + Ok(i64), + } + + impl ::pilota::thrift::Message for ThriftTestTestI64ResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestI64ResultSend", + })?; + match self { + ThriftTestTestI64ResultSend::Ok(ref value) => { + protocol.write_i64_field(0, *value)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_i64()?; + protocol.i64_len(*&field_ident); + ret = Some(ThriftTestTestI64ResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_i64().await?; + + ret = Some(ThriftTestTestI64ResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestI64ResultSend", + }) + match self { + ThriftTestTestI64ResultSend::Ok(ref value) => { + protocol.i64_field_len(Some(0), *value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestMultiExceptionArgsRecv { + pub arg0: ::pilota::FastStr, + + pub arg1: ::pilota::FastStr, + } + impl ::pilota::thrift::Message for ThriftTestTestMultiExceptionArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMultiExceptionArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_faststr_field(1, (&self.arg0).clone())?; + protocol.write_faststr_field(2, (&self.arg1).clone())?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut arg0 = None; + let mut arg1 = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + arg0 = Some(protocol.read_faststr()?); + } + Some(2) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + arg1 = Some(protocol.read_faststr()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestMultiExceptionArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(arg0) = arg0 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg0 is required".to_string(), + )); + }; + let Some(arg1) = arg1 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg1 is required".to_string(), + )); + }; + + let data = Self { arg0, arg1 }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut arg0 = None; + let mut arg1 = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + arg0 = Some(protocol.read_faststr().await?); + } + Some(2) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + arg1 = Some(protocol.read_faststr().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestMultiExceptionArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(arg0) = arg0 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg0 is required".to_string(), + ), + ); + }; + let Some(arg1) = arg1 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg1 is required".to_string(), + ), + ); + }; + + let data = Self { arg0, arg1 }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMultiExceptionArgsRecv", + }) + protocol.faststr_field_len(Some(1), &self.arg0) + + protocol.faststr_field_len(Some(2), &self.arg1) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestStringResultSend { + #[derivative(Default)] + Ok(::pilota::FastStr), + } + + impl ::pilota::thrift::Message for ThriftTestTestStringResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStringResultSend", + })?; + match self { + ThriftTestTestStringResultSend::Ok(ref value) => { + protocol.write_faststr_field(0, (value).clone())?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_faststr()?; + protocol.faststr_len(&field_ident); + ret = Some(ThriftTestTestStringResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_faststr().await?; + + ret = Some(ThriftTestTestStringResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStringResultSend", + }) + match self { + ThriftTestTestStringResultSend::Ok(ref value) => { + protocol.faststr_field_len(Some(0), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestMultiArgsSend { + pub arg0: i8, + + pub arg1: i32, + + pub arg2: i64, + + pub arg3: ::pilota::AHashMap, + + pub arg4: Numberz, + + pub arg5: UserId, + } + impl ::pilota::thrift::Message for ThriftTestTestMultiArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMultiArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_i8_field(1, *&self.arg0)?; + protocol.write_i32_field(2, *&self.arg1)?; + protocol.write_i64_field(3, *&self.arg2)?; + protocol.write_map_field( + 4, + ::pilota::thrift::TType::I16, + ::pilota::thrift::TType::Binary, + &&self.arg3, + |protocol, key| { + protocol.write_i16(*key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_faststr((val).clone())?; + ::std::result::Result::Ok(()) + }, + )?; + protocol.write_i32_field(5, (&self.arg4).inner())?; + protocol.write_struct_field(6, &self.arg5, ::pilota::thrift::TType::I64)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut arg0 = None; + let mut arg1 = None; + let mut arg2 = None; + let mut arg3 = None; + let mut arg4 = None; + let mut arg5 = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I8 => { + arg0 = Some(protocol.read_i8()?); + } + Some(2) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + arg1 = Some(protocol.read_i32()?); + } + Some(3) if field_ident.field_type == ::pilota::thrift::TType::I64 => { + arg2 = Some(protocol.read_i64()?); + } + Some(4) if field_ident.field_type == ::pilota::thrift::TType::Map => { + arg3 = Some({ + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(protocol.read_i16()?, protocol.read_faststr()?); + } + protocol.read_map_end()?; + val + }); + } + Some(5) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + arg4 = Some(::pilota::thrift::Message::decode(protocol)?); + } + Some(6) if field_ident.field_type == ::pilota::thrift::TType::I64 => { + arg5 = Some(::pilota::thrift::Message::decode(protocol)?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestMultiArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(arg0) = arg0 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg0 is required".to_string(), + )); + }; + let Some(arg1) = arg1 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg1 is required".to_string(), + )); + }; + let Some(arg2) = arg2 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg2 is required".to_string(), + )); + }; + let Some(arg3) = arg3 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg3 is required".to_string(), + )); + }; + let Some(arg4) = arg4 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg4 is required".to_string(), + )); + }; + let Some(arg5) = arg5 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg5 is required".to_string(), + )); + }; + + let data = Self { + arg0, + arg1, + arg2, + arg3, + arg4, + arg5, + }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut arg0 = None; + let mut arg1 = None; + let mut arg2 = None; + let mut arg3 = None; + let mut arg4 = None; + let mut arg5 = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I8 => + { + arg0 = Some(protocol.read_i8().await?); + } + Some(2) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + arg1 = Some(protocol.read_i32().await?); + } + Some(3) + if field_ident.field_type == ::pilota::thrift::TType::I64 => + { + arg2 = Some(protocol.read_i64().await?); + } + Some(4) + if field_ident.field_type == ::pilota::thrift::TType::Map => + { + arg3 = Some({ + let map_ident = protocol.read_map_begin().await?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_i16().await?, + protocol.read_faststr().await?, + ); + } + protocol.read_map_end().await?; + val + }); + } + Some(5) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + arg4 = Some( + ::decode_async( + protocol, + ) + .await?, + ); + } + Some(6) + if field_ident.field_type == ::pilota::thrift::TType::I64 => + { + arg5 = Some( + ::decode_async( + protocol, + ) + .await?, + ); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestMultiArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(arg0) = arg0 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg0 is required".to_string(), + ), + ); + }; + let Some(arg1) = arg1 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg1 is required".to_string(), + ), + ); + }; + let Some(arg2) = arg2 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg2 is required".to_string(), + ), + ); + }; + let Some(arg3) = arg3 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg3 is required".to_string(), + ), + ); + }; + let Some(arg4) = arg4 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg4 is required".to_string(), + ), + ); + }; + let Some(arg5) = arg5 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg5 is required".to_string(), + ), + ); + }; + + let data = Self { + arg0, + arg1, + arg2, + arg3, + arg4, + arg5, + }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMultiArgsSend", + }) + protocol.i8_field_len(Some(1), *&self.arg0) + + protocol.i32_field_len(Some(2), *&self.arg1) + + protocol.i64_field_len(Some(3), *&self.arg2) + + protocol.map_field_len( + Some(4), + ::pilota::thrift::TType::I16, + ::pilota::thrift::TType::Binary, + &self.arg3, + |protocol, key| protocol.i16_len(*key), + |protocol, val| protocol.faststr_len(val), + ) + + protocol.i32_field_len(Some(5), (&self.arg4).inner()) + + protocol.struct_field_len(Some(6), &self.arg5) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct Bools { + pub im_true: ::std::option::Option, + + pub im_false: ::std::option::Option, + } + impl ::pilota::thrift::Message for Bools { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { name: "Bools" }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.im_true.as_ref() { + protocol.write_bool_field(1, *value)?; + } + if let Some(value) = self.im_false.as_ref() { + protocol.write_bool_field(2, *value)?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut im_true = None; + let mut im_false = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::Bool => { + im_true = Some(protocol.read_bool()?); + } + Some(2) if field_ident.field_type == ::pilota::thrift::TType::Bool => { + im_false = Some(protocol.read_bool()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `Bools` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { im_true, im_false }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut im_true = None; + let mut im_false = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Bool => + { + im_true = Some(protocol.read_bool().await?); + } + Some(2) + if field_ident.field_type == ::pilota::thrift::TType::Bool => + { + im_false = Some(protocol.read_bool().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `Bools` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { im_true, im_false }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { name: "Bools" }) + + self + .im_true + .as_ref() + .map_or(0, |value| protocol.bool_field_len(Some(1), *value)) + + self + .im_false + .as_ref() + .map_or(0, |value| protocol.bool_field_len(Some(2), *value)) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestEnumArgsSend { + pub thing: Numberz, + } + impl ::pilota::thrift::Message for ThriftTestTestEnumArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestEnumArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_i32_field(1, (&self.thing).inner())?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + thing = Some(::pilota::thrift::Message::decode(protocol)?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestEnumArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + thing = Some( + ::decode_async( + protocol, + ) + .await?, + ); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestEnumArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestEnumArgsSend", + }) + protocol.i32_field_len(Some(1), (&self.thing).inner()) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + pub trait ThriftTest {} + #[derive(Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestMapArgsSend { + pub thing: ::pilota::AHashMap, + } + impl ::pilota::thrift::Message for ThriftTestTestMapArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMapArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_map_field( + 1, + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I32, + &&self.thing, + |protocol, key| { + protocol.write_i32(*key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::Map => { + thing = Some({ + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(protocol.read_i32()?, protocol.read_i32()?); + } + protocol.read_map_end()?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestMapArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Map => + { + thing = Some({ + let map_ident = protocol.read_map_begin().await?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_i32().await?, + protocol.read_i32().await?, + ); + } + protocol.read_map_end().await?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestMapArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMapArgsSend", + }) + protocol.map_field_len( + Some(1), + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I32, + &self.thing, + |protocol, key| protocol.i32_len(*key), + |protocol, val| protocol.i32_len(*val), + ) + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestBinaryArgsSend { + pub thing: ::pilota::Bytes, + } + impl ::pilota::thrift::Message for ThriftTestTestBinaryArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestBinaryArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_bytes_field(1, (&self.thing).clone())?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + thing = Some(protocol.read_bytes()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestBinaryArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + thing = Some(protocol.read_bytes().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestBinaryArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestBinaryArgsSend", + }) + protocol.bytes_field_len(Some(1), &self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestTypedefArgsRecv { + pub thing: UserId, + } + impl ::pilota::thrift::Message for ThriftTestTestTypedefArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestTypedefArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_struct_field(1, &self.thing, ::pilota::thrift::TType::I64)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I64 => { + thing = Some(::pilota::thrift::Message::decode(protocol)?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestTypedefArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I64 => + { + thing = Some( + ::decode_async( + protocol, + ) + .await?, + ); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestTypedefArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestTypedefArgsRecv", + }) + protocol.struct_field_len(Some(1), &self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + pub trait SecondService {} + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestByteArgsSend { + pub thing: i8, + } + impl ::pilota::thrift::Message for ThriftTestTestByteArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestByteArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_i8_field(1, *&self.thing)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I8 => { + thing = Some(protocol.read_i8()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestByteArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I8 => + { + thing = Some(protocol.read_i8().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestByteArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestByteArgsSend", + }) + protocol.i8_field_len(Some(1), *&self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestStringMapArgsRecv { + pub thing: ::pilota::AHashMap<::pilota::FastStr, ::pilota::FastStr>, + } + impl ::pilota::thrift::Message for ThriftTestTestStringMapArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStringMapArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_map_field( + 1, + ::pilota::thrift::TType::Binary, + ::pilota::thrift::TType::Binary, + &&self.thing, + |protocol, key| { + protocol.write_faststr((key).clone())?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_faststr((val).clone())?; + ::std::result::Result::Ok(()) + }, + )?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::Map => { + thing = Some({ + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_faststr()?, + protocol.read_faststr()?, + ); + } + protocol.read_map_end()?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestStringMapArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Map => + { + thing = Some({ + let map_ident = protocol.read_map_begin().await?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_faststr().await?, + protocol.read_faststr().await?, + ); + } + protocol.read_map_end().await?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestStringMapArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStringMapArgsRecv", + }) + protocol.map_field_len( + Some(1), + ::pilota::thrift::TType::Binary, + ::pilota::thrift::TType::Binary, + &self.thing, + |protocol, key| protocol.faststr_len(key), + |protocol, val| protocol.faststr_len(val), + ) + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct EmptyStruct {} + impl ::pilota::thrift::Message for EmptyStruct { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "EmptyStruct", + }; + + protocol.write_struct_begin(&struct_ident)?; + + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `EmptyStruct` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self {}; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `EmptyStruct` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self {}; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "EmptyStruct", + }) + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestUuidArgsRecv { + pub thing: [u8; 16], + } + impl ::pilota::thrift::Message for ThriftTestTestUuidArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestUuidArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_uuid_field(1, *&self.thing)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::Uuid => { + thing = Some(protocol.read_uuid()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestUuidArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Uuid => + { + thing = Some(protocol.read_uuid().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestUuidArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestUuidArgsRecv", + }) + protocol.uuid_field_len(Some(1), *&self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestInsanityResultRecv { + #[derivative(Default)] + Ok(::pilota::AHashMap>), + } + + impl ::pilota::thrift::Message for ThriftTestTestInsanityResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestInsanityResultRecv", + })?; + match self { + ThriftTestTestInsanityResultRecv::Ok(ref value) => { + protocol.write_map_field( + 0, + ::pilota::thrift::TType::I64, + ::pilota::thrift::TType::Map, + &value, + |protocol, key| { + protocol.write_struct(key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_map( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::Struct, + &val, + |protocol, key| { + protocol.write_struct(key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_struct(val)?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + }, + )?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(::pilota::thrift::Message::decode(protocol)?, { + let map_ident = protocol.read_map_begin()?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + ::pilota::thrift::Message::decode(protocol)?, + ::pilota::thrift::Message::decode(protocol)?, + ); + } + protocol.read_map_end()?; + val + }); + } + protocol.read_map_end()?; + val + }; + protocol.map_len( + ::pilota::thrift::TType::I64, + ::pilota::thrift::TType::Map, + &field_ident, + |protocol, key| protocol.struct_len(key), + |protocol, val| { + protocol.map_len( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::Struct, + val, + |protocol, key| protocol.struct_len(key), + |protocol, val| protocol.struct_len(val), + ) + }, + ); + ret = Some(ThriftTestTestInsanityResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let map_ident = protocol.read_map_begin().await?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(::decode_async(protocol).await?, { + let map_ident = protocol.read_map_begin().await?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(::decode_async(protocol).await?, ::decode_async(protocol).await?); + } + protocol.read_map_end().await?; + val + }); + } + protocol.read_map_end().await?; + val + }; + + ret = Some(ThriftTestTestInsanityResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestInsanityResultRecv", + }) + match self { + ThriftTestTestInsanityResultRecv::Ok(ref value) => protocol.map_field_len( + Some(0), + ::pilota::thrift::TType::I64, + ::pilota::thrift::TType::Map, + value, + |protocol, key| protocol.struct_len(key), + |protocol, val| { + protocol.map_len( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::Struct, + val, + |protocol, key| protocol.struct_len(key), + |protocol, val| protocol.struct_len(val), + ) + }, + ), + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct NestedListsI32x2 { + pub integerlist: ::std::option::Option<::std::vec::Vec<::std::vec::Vec>>, + } + impl ::pilota::thrift::Message for NestedListsI32x2 { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "NestedListsI32x2", + }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.integerlist.as_ref() { + protocol.write_list_field( + 1, + ::pilota::thrift::TType::List, + &value, + |protocol, val| { + protocol.write_list( + ::pilota::thrift::TType::I32, + &val, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + }, + )?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut integerlist = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::List => { + integerlist = Some(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec<::std::vec::Vec> = + Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr().offset(i as isize).write(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec = + Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr() + .offset(i as isize) + .write(protocol.read_i32()?); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `NestedListsI32x2` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { integerlist }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut integerlist = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::List => + { + integerlist = Some({ + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push({ + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push(protocol.read_i32().await?); + } + protocol.read_list_end().await?; + val + }); + } + protocol.read_list_end().await?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `NestedListsI32x2` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { integerlist }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "NestedListsI32x2", + }) + self.integerlist.as_ref().map_or(0, |value| { + protocol.list_field_len( + Some(1), + ::pilota::thrift::TType::List, + value, + |protocol, el| { + protocol.list_len(::pilota::thrift::TType::I32, el, |protocol, el| { + protocol.i32_len(*el) + }) + }, + ) + }) + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestI32ArgsRecv { + pub thing: i32, + } + impl ::pilota::thrift::Message for ThriftTestTestI32ArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestI32ArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_i32_field(1, *&self.thing)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + thing = Some(protocol.read_i32()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestI32ArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + thing = Some(protocol.read_i32().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestI32ArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestI32ArgsRecv", + }) + protocol.i32_field_len(Some(1), *&self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestListResultRecv { + #[derivative(Default)] + Ok(::std::vec::Vec), + } + + impl ::pilota::thrift::Message for ThriftTestTestListResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestListResultRecv", + })?; + match self { + ThriftTestTestListResultRecv::Ok(ref value) => { + protocol.write_list_field( + 0, + ::pilota::thrift::TType::I32, + &value, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec = Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr() + .offset(i as isize) + .write(protocol.read_i32()?); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }; + protocol.list_len( + ::pilota::thrift::TType::I32, + &field_ident, + |protocol, el| protocol.i32_len(*el), + ); + ret = Some(ThriftTestTestListResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push(protocol.read_i32().await?); + } + protocol.read_list_end().await?; + val + }; + + ret = Some(ThriftTestTestListResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestListResultRecv", + }) + match self { + ThriftTestTestListResultRecv::Ok(ref value) => protocol.list_field_len( + Some(0), + ::pilota::thrift::TType::I32, + value, + |protocol, el| protocol.i32_len(*el), + ), + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestVoidArgsRecv {} + impl ::pilota::thrift::Message for ThriftTestTestVoidArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestVoidArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestVoidArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self {}; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestVoidArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self {}; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestVoidArgsRecv", + }) + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestNestResultRecv { + #[derivative(Default)] + Ok(Xtruct2), + } + + impl ::pilota::thrift::Message for ThriftTestTestNestResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestNestResultRecv", + })?; + match self { + ThriftTestTestNestResultRecv::Ok(ref value) => { + protocol.write_struct_field(0, value, ::pilota::thrift::TType::Struct)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = Some(ThriftTestTestNestResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(ThriftTestTestNestResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestNestResultRecv", + }) + match self { + ThriftTestTestNestResultRecv::Ok(ref value) => { + protocol.struct_field_len(Some(0), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct UserId(pub i64); + + impl ::std::ops::Deref for UserId { + type Target = i64; + + fn deref(&self) -> &Self::Target { + &self.0 + } + } + + impl From for UserId { + fn from(v: i64) -> Self { + Self(v) + } + } + + impl ::pilota::thrift::Message for UserId { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_i64(*(&**self))?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + ::std::result::Result::Ok(UserId(protocol.read_i64()?)) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + ::std::result::Result::Ok(UserId(protocol.read_i64().await?)) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.i64_len(*&**self) + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct StructB { + pub aa: ::std::option::Option, + + pub ab: StructA, + } + impl ::pilota::thrift::Message for StructB { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { name: "StructB" }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.aa.as_ref() { + protocol.write_struct_field(1, value, ::pilota::thrift::TType::Struct)?; + } + protocol.write_struct_field(2, &self.ab, ::pilota::thrift::TType::Struct)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut aa = None; + let mut ab = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + aa = Some(::pilota::thrift::Message::decode(protocol)?); + } + Some(2) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + ab = Some(::pilota::thrift::Message::decode(protocol)?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `StructB` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(ab) = ab else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field ab is required".to_string(), + )); + }; + + let data = Self { aa, ab }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut aa = None; + let mut ab = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Struct => + { + aa = Some( + ::decode_async( + protocol, + ) + .await?, + ); + } + Some(2) + if field_ident.field_type + == ::pilota::thrift::TType::Struct => + { + ab = Some( + ::decode_async( + protocol, + ) + .await?, + ); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `StructB` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(ab) = ab else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field ab is required".to_string(), + ), + ); + }; + + let data = Self { aa, ab }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { name: "StructB" }) + + self + .aa + .as_ref() + .map_or(0, |value| protocol.struct_field_len(Some(1), value)) + + protocol.struct_field_len(Some(2), &self.ab) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestDoubleResultRecv { + #[derivative(Default)] + Ok(f64), + } + + impl ::pilota::thrift::Message for ThriftTestTestDoubleResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestDoubleResultRecv", + })?; + match self { + ThriftTestTestDoubleResultRecv::Ok(ref value) => { + protocol.write_double_field(0, *value)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_double()?; + protocol.double_len(*&field_ident); + ret = Some(ThriftTestTestDoubleResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_double().await?; + + ret = Some(ThriftTestTestDoubleResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestDoubleResultRecv", + }) + match self { + ThriftTestTestDoubleResultRecv::Ok(ref value) => { + protocol.double_field_len(Some(0), *value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestBoolResultRecv { + #[derivative(Default)] + Ok(bool), + } + + impl ::pilota::thrift::Message for ThriftTestTestBoolResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestBoolResultRecv", + })?; + match self { + ThriftTestTestBoolResultRecv::Ok(ref value) => { + protocol.write_bool_field(0, *value)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_bool()?; + protocol.bool_len(*&field_ident); + ret = Some(ThriftTestTestBoolResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_bool().await?; + + ret = Some(ThriftTestTestBoolResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestBoolResultRecv", + }) + match self { + ThriftTestTestBoolResultRecv::Ok(ref value) => { + protocol.bool_field_len(Some(0), *value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, Default, Clone, PartialEq)] + pub struct Insanity { + pub user_map: ::std::option::Option<::pilota::AHashMap>, + + pub xtructs: ::std::option::Option<::std::vec::Vec>, + } + impl ::pilota::thrift::Message for Insanity { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { name: "Insanity" }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.user_map.as_ref() { + protocol.write_map_field( + 1, + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I64, + &value, + |protocol, key| { + protocol.write_struct(key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_struct(val)?; + ::std::result::Result::Ok(()) + }, + )?; + } + if let Some(value) = self.xtructs.as_ref() { + protocol.write_list_field( + 2, + ::pilota::thrift::TType::Struct, + &value, + |protocol, val| { + protocol.write_struct(val)?; + ::std::result::Result::Ok(()) + }, + )?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut user_map = None; + let mut xtructs = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::Map => { + user_map = Some({ + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + ::pilota::thrift::Message::decode(protocol)?, + ::pilota::thrift::Message::decode(protocol)?, + ); + } + protocol.read_map_end()?; + val + }); + } + Some(2) if field_ident.field_type == ::pilota::thrift::TType::List => { + xtructs = Some(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec = Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr() + .offset(i as isize) + .write(::pilota::thrift::Message::decode(protocol)?); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `Insanity` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { user_map, xtructs }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut user_map = None; + let mut xtructs = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + + + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + + break; + } else { + + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::Map => { + user_map = Some({ + let map_ident = protocol.read_map_begin().await?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(::decode_async(protocol).await?, ::decode_async(protocol).await?); + } + protocol.read_map_end().await?; + val + }); + + },Some(2) if field_ident.field_type == ::pilota::thrift::TType::List => { + xtructs = Some({ + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push(::decode_async(protocol).await?); + }; + protocol.read_list_end().await?; + val + }); + + }, + _ => { + protocol.skip(field_ident.field_type).await?; + + }, + } + + protocol.read_field_end().await?; + + + }; + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + }.await { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `Insanity` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { user_map, xtructs }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { name: "Insanity" }) + + self.user_map.as_ref().map_or(0, |value| { + protocol.map_field_len( + Some(1), + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I64, + value, + |protocol, key| protocol.struct_len(key), + |protocol, val| protocol.struct_len(val), + ) + }) + + self.xtructs.as_ref().map_or(0, |value| { + protocol.list_field_len( + Some(2), + ::pilota::thrift::TType::Struct, + value, + |protocol, el| protocol.struct_len(el), + ) + }) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestTypedefResultSend { + #[derivative(Default)] + Ok(UserId), + } + + impl ::pilota::thrift::Message for ThriftTestTestTypedefResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestTypedefResultSend", + })?; + match self { + ThriftTestTestTypedefResultSend::Ok(ref value) => { + protocol.write_struct_field(0, value, ::pilota::thrift::TType::I64)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = Some(ThriftTestTestTypedefResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(ThriftTestTestTypedefResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestTypedefResultSend", + }) + match self { + ThriftTestTestTypedefResultSend::Ok(ref value) => { + protocol.struct_field_len(Some(0), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestStringMapResultSend { + #[derivative(Default)] + Ok(::pilota::AHashMap<::pilota::FastStr, ::pilota::FastStr>), + } + + impl ::pilota::thrift::Message for ThriftTestTestStringMapResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStringMapResultSend", + })?; + match self { + ThriftTestTestStringMapResultSend::Ok(ref value) => { + protocol.write_map_field( + 0, + ::pilota::thrift::TType::Binary, + ::pilota::thrift::TType::Binary, + &value, + |protocol, key| { + protocol.write_faststr((key).clone())?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_faststr((val).clone())?; + ::std::result::Result::Ok(()) + }, + )?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_faststr()?, + protocol.read_faststr()?, + ); + } + protocol.read_map_end()?; + val + }; + protocol.map_len( + ::pilota::thrift::TType::Binary, + ::pilota::thrift::TType::Binary, + &field_ident, + |protocol, key| protocol.faststr_len(key), + |protocol, val| protocol.faststr_len(val), + ); + ret = Some(ThriftTestTestStringMapResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let map_ident = protocol.read_map_begin().await?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_faststr().await?, + protocol.read_faststr().await?, + ); + } + protocol.read_map_end().await?; + val + }; + + ret = Some(ThriftTestTestStringMapResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStringMapResultSend", + }) + match self { + ThriftTestTestStringMapResultSend::Ok(ref value) => protocol.map_field_len( + Some(0), + ::pilota::thrift::TType::Binary, + ::pilota::thrift::TType::Binary, + value, + |protocol, key| protocol.faststr_len(key), + |protocol, val| protocol.faststr_len(val), + ), + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestExceptionArgsRecv { + pub arg: ::pilota::FastStr, + } + impl ::pilota::thrift::Message for ThriftTestTestExceptionArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestExceptionArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_faststr_field(1, (&self.arg).clone())?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut arg = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + arg = Some(protocol.read_faststr()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestExceptionArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(arg) = arg else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg is required".to_string(), + )); + }; + + let data = Self { arg }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut arg = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + arg = Some(protocol.read_faststr().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestExceptionArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(arg) = arg else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg is required".to_string(), + ), + ); + }; + + let data = Self { arg }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestExceptionArgsRecv", + }) + protocol.faststr_field_len(Some(1), &self.arg) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestUuidResultSend { + #[derivative(Default)] + Ok([u8; 16]), + } + + impl ::pilota::thrift::Message for ThriftTestTestUuidResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestUuidResultSend", + })?; + match self { + ThriftTestTestUuidResultSend::Ok(ref value) => { + protocol.write_uuid_field(0, *value)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_uuid()?; + protocol.uuid_len(*&field_ident); + ret = Some(ThriftTestTestUuidResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_uuid().await?; + + ret = Some(ThriftTestTestUuidResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestUuidResultSend", + }) + match self { + ThriftTestTestUuidResultSend::Ok(ref value) => { + protocol.uuid_field_len(Some(0), *value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ListTypeVersioningV2 { + pub strings: ::std::option::Option<::std::vec::Vec<::pilota::FastStr>>, + + pub hello: ::std::option::Option<::pilota::FastStr>, + } + impl ::pilota::thrift::Message for ListTypeVersioningV2 { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ListTypeVersioningV2", + }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.strings.as_ref() { + protocol.write_list_field( + 1, + ::pilota::thrift::TType::Binary, + &value, + |protocol, val| { + protocol.write_faststr((val).clone())?; + ::std::result::Result::Ok(()) + }, + )?; + } + if let Some(value) = self.hello.as_ref() { + protocol.write_faststr_field(2, (value).clone())?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut strings = None; + let mut hello = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::List => { + strings = Some(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec<::pilota::FastStr> = + Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr() + .offset(i as isize) + .write(protocol.read_faststr()?); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + } + Some(2) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + hello = Some(protocol.read_faststr()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `ListTypeVersioningV2` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { strings, hello }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut strings = None; + let mut hello = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::List => + { + strings = Some({ + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push(protocol.read_faststr().await?); + } + protocol.read_list_end().await?; + val + }); + } + Some(2) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + hello = Some(protocol.read_faststr().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ListTypeVersioningV2` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { strings, hello }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ListTypeVersioningV2", + }) + self.strings.as_ref().map_or(0, |value| { + protocol.list_field_len( + Some(1), + ::pilota::thrift::TType::Binary, + value, + |protocol, el| protocol.faststr_len(el), + ) + }) + self + .hello + .as_ref() + .map_or(0, |value| protocol.faststr_field_len(Some(2), value)) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestI32ResultSend { + #[derivative(Default)] + Ok(i32), + } + + impl ::pilota::thrift::Message for ThriftTestTestI32ResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestI32ResultSend", + })?; + match self { + ThriftTestTestI32ResultSend::Ok(ref value) => { + protocol.write_i32_field(0, *value)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_i32()?; + protocol.i32_len(*&field_ident); + ret = Some(ThriftTestTestI32ResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_i32().await?; + + ret = Some(ThriftTestTestI32ResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestI32ResultSend", + }) + match self { + ThriftTestTestI32ResultSend::Ok(ref value) => { + protocol.i32_field_len(Some(0), *value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestVoidResultSend { + #[derivative(Default)] + Ok(()), + } + + impl ::pilota::thrift::Message for ThriftTestTestVoidResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestVoidResultSend", + })?; + match self { + ThriftTestTestVoidResultSend::Ok(ref value) => {} + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Ok(ThriftTestTestVoidResultSend::Ok(())) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Ok(ThriftTestTestVoidResultSend::Ok(())) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestVoidResultSend", + }) + match self { + ThriftTestTestVoidResultSend::Ok(ref value) => 0, + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestInsanityArgsSend { + pub argument: Insanity, + } + impl ::pilota::thrift::Message for ThriftTestTestInsanityArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestInsanityArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_struct_field(1, &self.argument, ::pilota::thrift::TType::Struct)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut argument = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + argument = Some(::pilota::thrift::Message::decode(protocol)?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestInsanityArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(argument) = argument else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field argument is required".to_string(), + )); + }; + + let data = Self { argument }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut argument = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Struct => + { + argument = Some( + ::decode_async( + protocol, + ) + .await?, + ); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestInsanityArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(argument) = argument else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field argument is required".to_string(), + ), + ); + }; + + let data = Self { argument }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestInsanityArgsSend", + }) + protocol.struct_field_len(Some(1), &self.argument) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct NestedListsBonk { + pub bonk: + ::std::option::Option<::std::vec::Vec<::std::vec::Vec<::std::vec::Vec>>>, + } + impl ::pilota::thrift::Message for NestedListsBonk { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "NestedListsBonk", + }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.bonk.as_ref() { + protocol.write_list_field( + 1, + ::pilota::thrift::TType::List, + &value, + |protocol, val| { + protocol.write_list( + ::pilota::thrift::TType::List, + &val, + |protocol, val| { + protocol.write_list( + ::pilota::thrift::TType::Struct, + &val, + |protocol, val| { + protocol.write_struct(val)?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + }, + )?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut bonk = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::List => { + bonk = Some(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec<::std::vec::Vec<::std::vec::Vec>> = + Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr().offset(i as isize).write(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec<::std::vec::Vec> = + Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr().offset(i as isize).write(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec = + Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr().offset(i as isize).write( + ::pilota::thrift::Message::decode( + protocol, + )?, + ); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `NestedListsBonk` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { bonk }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut bonk = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + + + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + + break; + } else { + + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::List => { + bonk = Some({ + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push({ + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push({ + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push(::decode_async(protocol).await?); + }; + protocol.read_list_end().await?; + val + }); + }; + protocol.read_list_end().await?; + val + }); + }; + protocol.read_list_end().await?; + val + }); + + }, + _ => { + protocol.skip(field_ident.field_type).await?; + + }, + } + + protocol.read_field_end().await?; + + + }; + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + }.await { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `NestedListsBonk` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { bonk }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "NestedListsBonk", + }) + self.bonk.as_ref().map_or(0, |value| { + protocol.list_field_len( + Some(1), + ::pilota::thrift::TType::List, + value, + |protocol, el| { + protocol.list_len(::pilota::thrift::TType::List, el, |protocol, el| { + protocol.list_len( + ::pilota::thrift::TType::Struct, + el, + |protocol, el| protocol.struct_len(el), + ) + }) + }, + ) + }) + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestListArgsSend { + pub thing: ::std::vec::Vec, + } + impl ::pilota::thrift::Message for ThriftTestTestListArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestListArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_list_field( + 1, + ::pilota::thrift::TType::I32, + &&self.thing, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::List => { + thing = Some(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec = Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr() + .offset(i as isize) + .write(protocol.read_i32()?); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestListArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::List => + { + thing = Some({ + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push(protocol.read_i32().await?); + } + protocol.read_list_end().await?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestListArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestListArgsSend", + }) + protocol.list_field_len( + Some(1), + ::pilota::thrift::TType::I32, + &self.thing, + |protocol, el| protocol.i32_len(*el), + ) + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestOnewayResultRecv { + #[derivative(Default)] + Ok(()), + } + + impl ::pilota::thrift::Message for ThriftTestTestOnewayResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestOnewayResultRecv", + })?; + match self { + ThriftTestTestOnewayResultRecv::Ok(ref value) => {} + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Ok(ThriftTestTestOnewayResultRecv::Ok(())) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Ok(ThriftTestTestOnewayResultRecv::Ok(())) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestOnewayResultRecv", + }) + match self { + ThriftTestTestOnewayResultRecv::Ok(ref value) => 0, + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestNestArgsSend { + pub thing: Xtruct2, + } + impl ::pilota::thrift::Message for ThriftTestTestNestArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestNestArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_struct_field(1, &self.thing, ::pilota::thrift::TType::Struct)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + thing = Some(::pilota::thrift::Message::decode(protocol)?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestNestArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Struct => + { + thing = Some( + ::decode_async( + protocol, + ) + .await?, + ); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestNestArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestNestArgsSend", + }) + protocol.struct_field_len(Some(1), &self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestMultiArgsRecv { + pub arg0: i8, + + pub arg1: i32, + + pub arg2: i64, + + pub arg3: ::pilota::AHashMap, + + pub arg4: Numberz, + + pub arg5: UserId, + } + impl ::pilota::thrift::Message for ThriftTestTestMultiArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMultiArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_i8_field(1, *&self.arg0)?; + protocol.write_i32_field(2, *&self.arg1)?; + protocol.write_i64_field(3, *&self.arg2)?; + protocol.write_map_field( + 4, + ::pilota::thrift::TType::I16, + ::pilota::thrift::TType::Binary, + &&self.arg3, + |protocol, key| { + protocol.write_i16(*key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_faststr((val).clone())?; + ::std::result::Result::Ok(()) + }, + )?; + protocol.write_i32_field(5, (&self.arg4).inner())?; + protocol.write_struct_field(6, &self.arg5, ::pilota::thrift::TType::I64)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut arg0 = None; + let mut arg1 = None; + let mut arg2 = None; + let mut arg3 = None; + let mut arg4 = None; + let mut arg5 = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I8 => { + arg0 = Some(protocol.read_i8()?); + } + Some(2) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + arg1 = Some(protocol.read_i32()?); + } + Some(3) if field_ident.field_type == ::pilota::thrift::TType::I64 => { + arg2 = Some(protocol.read_i64()?); + } + Some(4) if field_ident.field_type == ::pilota::thrift::TType::Map => { + arg3 = Some({ + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(protocol.read_i16()?, protocol.read_faststr()?); + } + protocol.read_map_end()?; + val + }); + } + Some(5) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + arg4 = Some(::pilota::thrift::Message::decode(protocol)?); + } + Some(6) if field_ident.field_type == ::pilota::thrift::TType::I64 => { + arg5 = Some(::pilota::thrift::Message::decode(protocol)?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestMultiArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(arg0) = arg0 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg0 is required".to_string(), + )); + }; + let Some(arg1) = arg1 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg1 is required".to_string(), + )); + }; + let Some(arg2) = arg2 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg2 is required".to_string(), + )); + }; + let Some(arg3) = arg3 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg3 is required".to_string(), + )); + }; + let Some(arg4) = arg4 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg4 is required".to_string(), + )); + }; + let Some(arg5) = arg5 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg5 is required".to_string(), + )); + }; + + let data = Self { + arg0, + arg1, + arg2, + arg3, + arg4, + arg5, + }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut arg0 = None; + let mut arg1 = None; + let mut arg2 = None; + let mut arg3 = None; + let mut arg4 = None; + let mut arg5 = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I8 => + { + arg0 = Some(protocol.read_i8().await?); + } + Some(2) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + arg1 = Some(protocol.read_i32().await?); + } + Some(3) + if field_ident.field_type == ::pilota::thrift::TType::I64 => + { + arg2 = Some(protocol.read_i64().await?); + } + Some(4) + if field_ident.field_type == ::pilota::thrift::TType::Map => + { + arg3 = Some({ + let map_ident = protocol.read_map_begin().await?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_i16().await?, + protocol.read_faststr().await?, + ); + } + protocol.read_map_end().await?; + val + }); + } + Some(5) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + arg4 = Some( + ::decode_async( + protocol, + ) + .await?, + ); + } + Some(6) + if field_ident.field_type == ::pilota::thrift::TType::I64 => + { + arg5 = Some( + ::decode_async( + protocol, + ) + .await?, + ); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestMultiArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(arg0) = arg0 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg0 is required".to_string(), + ), + ); + }; + let Some(arg1) = arg1 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg1 is required".to_string(), + ), + ); + }; + let Some(arg2) = arg2 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg2 is required".to_string(), + ), + ); + }; + let Some(arg3) = arg3 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg3 is required".to_string(), + ), + ); + }; + let Some(arg4) = arg4 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg4 is required".to_string(), + ), + ); + }; + let Some(arg5) = arg5 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg5 is required".to_string(), + ), + ); + }; + + let data = Self { + arg0, + arg1, + arg2, + arg3, + arg4, + arg5, + }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMultiArgsRecv", + }) + protocol.i8_field_len(Some(1), *&self.arg0) + + protocol.i32_field_len(Some(2), *&self.arg1) + + protocol.i64_field_len(Some(3), *&self.arg2) + + protocol.map_field_len( + Some(4), + ::pilota::thrift::TType::I16, + ::pilota::thrift::TType::Binary, + &self.arg3, + |protocol, key| protocol.i16_len(*key), + |protocol, val| protocol.faststr_len(val), + ) + + protocol.i32_field_len(Some(5), (&self.arg4).inner()) + + protocol.struct_field_len(Some(6), &self.arg5) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct Xtruct { + pub string_thing: ::std::option::Option<::pilota::FastStr>, + + pub byte_thing: ::std::option::Option, + + pub i32_thing: ::std::option::Option, + + pub i64_thing: ::std::option::Option, + } + impl ::pilota::thrift::Message for Xtruct { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { name: "Xtruct" }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.string_thing.as_ref() { + protocol.write_faststr_field(1, (value).clone())?; + } + if let Some(value) = self.byte_thing.as_ref() { + protocol.write_i8_field(4, *value)?; + } + if let Some(value) = self.i32_thing.as_ref() { + protocol.write_i32_field(9, *value)?; + } + if let Some(value) = self.i64_thing.as_ref() { + protocol.write_i64_field(11, *value)?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut string_thing = None; + let mut byte_thing = None; + let mut i32_thing = None; + let mut i64_thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + string_thing = Some(protocol.read_faststr()?); + } + Some(4) if field_ident.field_type == ::pilota::thrift::TType::I8 => { + byte_thing = Some(protocol.read_i8()?); + } + Some(9) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + i32_thing = Some(protocol.read_i32()?); + } + Some(11) if field_ident.field_type == ::pilota::thrift::TType::I64 => { + i64_thing = Some(protocol.read_i64()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `Xtruct` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { + string_thing, + byte_thing, + i32_thing, + i64_thing, + }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut string_thing = None; + let mut byte_thing = None; + let mut i32_thing = None; + let mut i64_thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + string_thing = Some(protocol.read_faststr().await?); + } + Some(4) + if field_ident.field_type == ::pilota::thrift::TType::I8 => + { + byte_thing = Some(protocol.read_i8().await?); + } + Some(9) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + i32_thing = Some(protocol.read_i32().await?); + } + Some(11) + if field_ident.field_type == ::pilota::thrift::TType::I64 => + { + i64_thing = Some(protocol.read_i64().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `Xtruct` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { + string_thing, + byte_thing, + i32_thing, + i64_thing, + }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { name: "Xtruct" }) + + self + .string_thing + .as_ref() + .map_or(0, |value| protocol.faststr_field_len(Some(1), value)) + + self + .byte_thing + .as_ref() + .map_or(0, |value| protocol.i8_field_len(Some(4), *value)) + + self + .i32_thing + .as_ref() + .map_or(0, |value| protocol.i32_field_len(Some(9), *value)) + + self + .i64_thing + .as_ref() + .map_or(0, |value| protocol.i64_field_len(Some(11), *value)) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestDoubleArgsSend { + pub thing: f64, + } + impl ::pilota::thrift::Message for ThriftTestTestDoubleArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestDoubleArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_double_field(1, *&self.thing)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Double => + { + thing = Some(protocol.read_double()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestDoubleArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Double => + { + thing = Some(protocol.read_double().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestDoubleArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestDoubleArgsSend", + }) + protocol.double_field_len(Some(1), *&self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestEnumArgsRecv { + pub thing: Numberz, + } + impl ::pilota::thrift::Message for ThriftTestTestEnumArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestEnumArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_i32_field(1, (&self.thing).inner())?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + thing = Some(::pilota::thrift::Message::decode(protocol)?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestEnumArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + thing = Some( + ::decode_async( + protocol, + ) + .await?, + ); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestEnumArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestEnumArgsRecv", + }) + protocol.i32_field_len(Some(1), (&self.thing).inner()) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum SecondServiceSecondtestStringResultRecv { + #[derivative(Default)] + Ok(::pilota::FastStr), + } + + impl ::pilota::thrift::Message for SecondServiceSecondtestStringResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "SecondServiceSecondtestStringResultRecv", + })?; + match self { + SecondServiceSecondtestStringResultRecv::Ok(ref value) => { + protocol.write_faststr_field(0, (value).clone())?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_faststr()?; + protocol.faststr_len(&field_ident); + ret = + Some(SecondServiceSecondtestStringResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_faststr().await?; + + ret = Some(SecondServiceSecondtestStringResultRecv::Ok( + field_ident, + )); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "SecondServiceSecondtestStringResultRecv", + }) + match self { + SecondServiceSecondtestStringResultRecv::Ok(ref value) => { + protocol.faststr_field_len(Some(0), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestBoolArgsSend { + pub thing: bool, + } + impl ::pilota::thrift::Message for ThriftTestTestBoolArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestBoolArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_bool_field(1, *&self.thing)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::Bool => { + thing = Some(protocol.read_bool()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestBoolArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Bool => + { + thing = Some(protocol.read_bool().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestBoolArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestBoolArgsSend", + }) + protocol.bool_field_len(Some(1), *&self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestMapArgsRecv { + pub thing: ::pilota::AHashMap, + } + impl ::pilota::thrift::Message for ThriftTestTestMapArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMapArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_map_field( + 1, + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I32, + &&self.thing, + |protocol, key| { + protocol.write_i32(*key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::Map => { + thing = Some({ + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(protocol.read_i32()?, protocol.read_i32()?); + } + protocol.read_map_end()?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestMapArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Map => + { + thing = Some({ + let map_ident = protocol.read_map_begin().await?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_i32().await?, + protocol.read_i32().await?, + ); + } + protocol.read_map_end().await?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestMapArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMapArgsRecv", + }) + protocol.map_field_len( + Some(1), + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I32, + &self.thing, + |protocol, key| protocol.i32_len(*key), + |protocol, val| protocol.i32_len(*val), + ) + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestExceptionException { + #[derivative(Default)] + Err1(Xception), + } + + impl ::pilota::thrift::Message for ThriftTestTestExceptionException { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestExceptionException", + })?; + match self { + ThriftTestTestExceptionException::Err1(ref value) => { + protocol.write_struct_field(1, value, ::pilota::thrift::TType::Struct)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(1) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = Some(ThriftTestTestExceptionException::Err1(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(1) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(ThriftTestTestExceptionException::Err1(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestExceptionException", + }) + match self { + ThriftTestTestExceptionException::Err1(ref value) => { + protocol.struct_field_len(Some(1), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestBinaryArgsRecv { + pub thing: ::pilota::Bytes, + } + impl ::pilota::thrift::Message for ThriftTestTestBinaryArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestBinaryArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_bytes_field(1, (&self.thing).clone())?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + thing = Some(protocol.read_bytes()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestBinaryArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + thing = Some(protocol.read_bytes().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestBinaryArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestBinaryArgsRecv", + }) + protocol.bytes_field_len(Some(1), &self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestMapMapResultRecv { + #[derivative(Default)] + Ok(::pilota::AHashMap>), + } + + impl ::pilota::thrift::Message for ThriftTestTestMapMapResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMapMapResultRecv", + })?; + match self { + ThriftTestTestMapMapResultRecv::Ok(ref value) => { + protocol.write_map_field( + 0, + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::Map, + &value, + |protocol, key| { + protocol.write_i32(*key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_map( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I32, + &val, + |protocol, key| { + protocol.write_i32(*key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + }, + )?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(protocol.read_i32()?, { + let map_ident = protocol.read_map_begin()?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_i32()?, + protocol.read_i32()?, + ); + } + protocol.read_map_end()?; + val + }); + } + protocol.read_map_end()?; + val + }; + protocol.map_len( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::Map, + &field_ident, + |protocol, key| protocol.i32_len(*key), + |protocol, val| { + protocol.map_len( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I32, + val, + |protocol, key| protocol.i32_len(*key), + |protocol, val| protocol.i32_len(*val), + ) + }, + ); + ret = Some(ThriftTestTestMapMapResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let map_ident = protocol.read_map_begin().await?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(protocol.read_i32().await?, { + let map_ident = protocol.read_map_begin().await?; + let mut val = ::pilota::AHashMap::with_capacity( + map_ident.size, + ); + for _ in 0..map_ident.size { + val.insert( + protocol.read_i32().await?, + protocol.read_i32().await?, + ); + } + protocol.read_map_end().await?; + val + }); + } + protocol.read_map_end().await?; + val + }; + + ret = Some(ThriftTestTestMapMapResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMapMapResultRecv", + }) + match self { + ThriftTestTestMapMapResultRecv::Ok(ref value) => protocol.map_field_len( + Some(0), + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::Map, + value, + |protocol, key| protocol.i32_len(*key), + |protocol, val| { + protocol.map_len( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I32, + val, + |protocol, key| protocol.i32_len(*key), + |protocol, val| protocol.i32_len(*val), + ) + }, + ), + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct VersioningTestV1 { + pub begin_in_both: ::std::option::Option, + + pub old_string: ::std::option::Option<::pilota::FastStr>, + + pub end_in_both: ::std::option::Option, + } + impl ::pilota::thrift::Message for VersioningTestV1 { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "VersioningTestV1", + }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.begin_in_both.as_ref() { + protocol.write_i32_field(1, *value)?; + } + if let Some(value) = self.old_string.as_ref() { + protocol.write_faststr_field(3, (value).clone())?; + } + if let Some(value) = self.end_in_both.as_ref() { + protocol.write_i32_field(12, *value)?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut begin_in_both = None; + let mut old_string = None; + let mut end_in_both = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + begin_in_both = Some(protocol.read_i32()?); + } + Some(3) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + old_string = Some(protocol.read_faststr()?); + } + Some(12) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + end_in_both = Some(protocol.read_i32()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `VersioningTestV1` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { + begin_in_both, + old_string, + end_in_both, + }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut begin_in_both = None; + let mut old_string = None; + let mut end_in_both = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + begin_in_both = Some(protocol.read_i32().await?); + } + Some(3) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + old_string = Some(protocol.read_faststr().await?); + } + Some(12) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + end_in_both = Some(protocol.read_i32().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `VersioningTestV1` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { + begin_in_both, + old_string, + end_in_both, + }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "VersioningTestV1", + }) + self + .begin_in_both + .as_ref() + .map_or(0, |value| protocol.i32_field_len(Some(1), *value)) + + self + .old_string + .as_ref() + .map_or(0, |value| protocol.faststr_field_len(Some(3), value)) + + self + .end_in_both + .as_ref() + .map_or(0, |value| protocol.i32_field_len(Some(12), *value)) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestByteArgsRecv { + pub thing: i8, + } + impl ::pilota::thrift::Message for ThriftTestTestByteArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestByteArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_i8_field(1, *&self.thing)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I8 => { + thing = Some(protocol.read_i8()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestByteArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I8 => + { + thing = Some(protocol.read_i8().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestByteArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestByteArgsRecv", + }) + protocol.i8_field_len(Some(1), *&self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestSetResultRecv { + #[derivative(Default)] + Ok(::pilota::AHashSet), + } + + impl ::pilota::thrift::Message for ThriftTestTestSetResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestSetResultRecv", + })?; + match self { + ThriftTestTestSetResultRecv::Ok(ref value) => { + protocol.write_set_field( + 0, + ::pilota::thrift::TType::I32, + &value, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let list_ident = protocol.read_set_begin()?; + let mut val = + ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(protocol.read_i32()?); + } + protocol.read_set_end()?; + val + }; + protocol.set_len( + ::pilota::thrift::TType::I32, + &field_ident, + |protocol, el| protocol.i32_len(*el), + ); + ret = Some(ThriftTestTestSetResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let list_ident = protocol.read_set_begin().await?; + let mut val = + ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(protocol.read_i32().await?); + } + protocol.read_set_end().await?; + val + }; + + ret = Some(ThriftTestTestSetResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestSetResultRecv", + }) + match self { + ThriftTestTestSetResultRecv::Ok(ref value) => protocol.set_field_len( + Some(0), + ::pilota::thrift::TType::I32, + value, + |protocol, el| protocol.i32_len(*el), + ), + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct OneField { + pub field: ::std::option::Option, + } + impl ::pilota::thrift::Message for OneField { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { name: "OneField" }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.field.as_ref() { + protocol.write_struct_field(1, value, ::pilota::thrift::TType::Struct)?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut field = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + field = Some(::pilota::thrift::Message::decode(protocol)?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `OneField` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { field }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut field = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Struct => + { + field = Some( + ::decode_async( + protocol, + ) + .await?, + ); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `OneField` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { field }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { name: "OneField" }) + + self + .field + .as_ref() + .map_or(0, |value| protocol.struct_field_len(Some(1), value)) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestStructResultRecv { + #[derivative(Default)] + Ok(Xtruct), + } + + impl ::pilota::thrift::Message for ThriftTestTestStructResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStructResultRecv", + })?; + match self { + ThriftTestTestStructResultRecv::Ok(ref value) => { + protocol.write_struct_field(0, value, ::pilota::thrift::TType::Struct)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = Some(ThriftTestTestStructResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(ThriftTestTestStructResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStructResultRecv", + }) + match self { + ThriftTestTestStructResultRecv::Ok(ref value) => { + protocol.struct_field_len(Some(0), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct NestedListsI32x3 { + pub integerlist: + ::std::option::Option<::std::vec::Vec<::std::vec::Vec<::std::vec::Vec>>>, + } + impl ::pilota::thrift::Message for NestedListsI32x3 { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "NestedListsI32x3", + }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.integerlist.as_ref() { + protocol.write_list_field( + 1, + ::pilota::thrift::TType::List, + &value, + |protocol, val| { + protocol.write_list( + ::pilota::thrift::TType::List, + &val, + |protocol, val| { + protocol.write_list( + ::pilota::thrift::TType::I32, + &val, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + }, + )?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut integerlist = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::List => { + integerlist = Some(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec<::std::vec::Vec<::std::vec::Vec>> = + Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr().offset(i as isize).write(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec<::std::vec::Vec> = + Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr().offset(i as isize).write(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec = + Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr() + .offset(i as isize) + .write(protocol.read_i32()?); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `NestedListsI32x3` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { integerlist }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut integerlist = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::List => + { + integerlist = Some({ + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push({ + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push({ + let list_ident = + protocol.read_list_begin().await?; + let mut val = + Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push(protocol.read_i32().await?); + } + protocol.read_list_end().await?; + val + }); + } + protocol.read_list_end().await?; + val + }); + } + protocol.read_list_end().await?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `NestedListsI32x3` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { integerlist }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "NestedListsI32x3", + }) + self.integerlist.as_ref().map_or(0, |value| { + protocol.list_field_len( + Some(1), + ::pilota::thrift::TType::List, + value, + |protocol, el| { + protocol.list_len(::pilota::thrift::TType::List, el, |protocol, el| { + protocol.list_len( + ::pilota::thrift::TType::I32, + el, + |protocol, el| protocol.i32_len(*el), + ) + }) + }, + ) + }) + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestI64ResultRecv { + #[derivative(Default)] + Ok(i64), + } + + impl ::pilota::thrift::Message for ThriftTestTestI64ResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestI64ResultRecv", + })?; + match self { + ThriftTestTestI64ResultRecv::Ok(ref value) => { + protocol.write_i64_field(0, *value)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_i64()?; + protocol.i64_len(*&field_ident); + ret = Some(ThriftTestTestI64ResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_i64().await?; + + ret = Some(ThriftTestTestI64ResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestI64ResultRecv", + }) + match self { + ThriftTestTestI64ResultRecv::Ok(ref value) => { + protocol.i64_field_len(Some(0), *value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestStringResultRecv { + #[derivative(Default)] + Ok(::pilota::FastStr), + } + + impl ::pilota::thrift::Message for ThriftTestTestStringResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStringResultRecv", + })?; + match self { + ThriftTestTestStringResultRecv::Ok(ref value) => { + protocol.write_faststr_field(0, (value).clone())?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_faststr()?; + protocol.faststr_len(&field_ident); + ret = Some(ThriftTestTestStringResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_faststr().await?; + + ret = Some(ThriftTestTestStringResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStringResultRecv", + }) + match self { + ThriftTestTestStringResultRecv::Ok(ref value) => { + protocol.faststr_field_len(Some(0), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestMultiResultSend { + #[derivative(Default)] + Ok(Xtruct), + } + + impl ::pilota::thrift::Message for ThriftTestTestMultiResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMultiResultSend", + })?; + match self { + ThriftTestTestMultiResultSend::Ok(ref value) => { + protocol.write_struct_field(0, value, ::pilota::thrift::TType::Struct)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = Some(ThriftTestTestMultiResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(ThriftTestTestMultiResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMultiResultSend", + }) + match self { + ThriftTestTestMultiResultSend::Ok(ref value) => { + protocol.struct_field_len(Some(0), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct Bonk { + pub message: ::std::option::Option<::pilota::FastStr>, + + pub r#type: ::std::option::Option, + } + impl ::pilota::thrift::Message for Bonk { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { name: "Bonk" }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.message.as_ref() { + protocol.write_faststr_field(1, (value).clone())?; + } + if let Some(value) = self.r#type.as_ref() { + protocol.write_i32_field(2, *value)?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut message = None; + let mut r#type = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + message = Some(protocol.read_faststr()?); + } + Some(2) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + r#type = Some(protocol.read_i32()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `Bonk` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { message, r#type }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut message = None; + let mut r#type = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + message = Some(protocol.read_faststr().await?); + } + Some(2) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + r#type = Some(protocol.read_i32().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `Bonk` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { message, r#type }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { name: "Bonk" }) + + self + .message + .as_ref() + .map_or(0, |value| protocol.faststr_field_len(Some(1), value)) + + self + .r#type + .as_ref() + .map_or(0, |value| protocol.i32_field_len(Some(2), *value)) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + impl Default for OptionalSetDefaultTest { + fn default() -> Self { + OptionalSetDefaultTest { + with_default: Some(::pilota::AHashSet::from([ + ::pilota::FastStr::from_static_str("test"), + ])), + } + } + } + #[derive(Debug, Clone, PartialEq)] + pub struct OptionalSetDefaultTest { + pub with_default: ::std::option::Option<::pilota::AHashSet<::pilota::FastStr>>, + } + impl ::pilota::thrift::Message for OptionalSetDefaultTest { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "OptionalSetDefaultTest", + }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.with_default.as_ref() { + protocol.write_set_field( + 1, + ::pilota::thrift::TType::Binary, + &value, + |protocol, val| { + protocol.write_faststr((val).clone())?; + ::std::result::Result::Ok(()) + }, + )?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut with_default = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::Set => { + with_default = Some({ + let list_ident = protocol.read_set_begin()?; + let mut val = + ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(protocol.read_faststr()?); + } + protocol.read_set_end()?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `OptionalSetDefaultTest` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + if with_default.is_none() { + with_default = Some(::pilota::AHashSet::from([ + ::pilota::FastStr::from_static_str("test"), + ])); + } + + let data = Self { with_default }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut with_default = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Set => + { + with_default = Some({ + let list_ident = protocol.read_set_begin().await?; + let mut val = + ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(protocol.read_faststr().await?); + } + protocol.read_set_end().await?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `OptionalSetDefaultTest` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + if with_default.is_none() { + with_default = Some(::pilota::AHashSet::from([ + ::pilota::FastStr::from_static_str("test"), + ])); + } + + let data = Self { with_default }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "OptionalSetDefaultTest", + }) + self.with_default.as_ref().map_or(0, |value| { + protocol.set_field_len( + Some(1), + ::pilota::thrift::TType::Binary, + value, + |protocol, el| protocol.faststr_len(el), + ) + }) + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestEnumResultSend { + #[derivative(Default)] + Ok(Numberz), + } + + impl ::pilota::thrift::Message for ThriftTestTestEnumResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestEnumResultSend", + })?; + match self { + ThriftTestTestEnumResultSend::Ok(ref value) => { + protocol.write_i32_field(0, (value).inner())?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = Some(ThriftTestTestEnumResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(ThriftTestTestEnumResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestEnumResultSend", + }) + match self { + ThriftTestTestEnumResultSend::Ok(ref value) => { + protocol.i32_field_len(Some(0), (value).inner()) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestOnewayArgsSend { + pub seconds_to_sleep: i32, + } + impl ::pilota::thrift::Message for ThriftTestTestOnewayArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestOnewayArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_i32_field(1, *&self.seconds_to_sleep)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut seconds_to_sleep = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + seconds_to_sleep = Some(protocol.read_i32()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestOnewayArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(seconds_to_sleep) = seconds_to_sleep else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field seconds_to_sleep is required".to_string(), + )); + }; + + let data = Self { seconds_to_sleep }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut seconds_to_sleep = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + seconds_to_sleep = Some(protocol.read_i32().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestOnewayArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(seconds_to_sleep) = seconds_to_sleep else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field seconds_to_sleep is required".to_string(), + ), + ); + }; + + let data = Self { seconds_to_sleep }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestOnewayArgsSend", + }) + protocol.i32_field_len(Some(1), *&self.seconds_to_sleep) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestMapResultSend { + #[derivative(Default)] + Ok(::pilota::AHashMap), + } + + impl ::pilota::thrift::Message for ThriftTestTestMapResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMapResultSend", + })?; + match self { + ThriftTestTestMapResultSend::Ok(ref value) => { + protocol.write_map_field( + 0, + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I32, + &value, + |protocol, key| { + protocol.write_i32(*key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(protocol.read_i32()?, protocol.read_i32()?); + } + protocol.read_map_end()?; + val + }; + protocol.map_len( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I32, + &field_ident, + |protocol, key| protocol.i32_len(*key), + |protocol, val| protocol.i32_len(*val), + ); + ret = Some(ThriftTestTestMapResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let map_ident = protocol.read_map_begin().await?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_i32().await?, + protocol.read_i32().await?, + ); + } + protocol.read_map_end().await?; + val + }; + + ret = Some(ThriftTestTestMapResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMapResultSend", + }) + match self { + ThriftTestTestMapResultSend::Ok(ref value) => protocol.map_field_len( + Some(0), + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I32, + value, + |protocol, key| protocol.i32_len(*key), + |protocol, val| protocol.i32_len(*val), + ), + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestExceptionResultSend { + #[derivative(Default)] + Ok(()), + + Err1(Xception), + } + + impl ::pilota::thrift::Message for ThriftTestTestExceptionResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestExceptionResultSend", + })?; + match self { + ThriftTestTestExceptionResultSend::Ok(ref value) => {} + ThriftTestTestExceptionResultSend::Err1(ref value) => { + protocol.write_struct_field(1, value, ::pilota::thrift::TType::Struct)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(1) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = Some(ThriftTestTestExceptionResultSend::Err1(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Ok(ThriftTestTestExceptionResultSend::Ok(())) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(1) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = + Some(ThriftTestTestExceptionResultSend::Err1(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Ok(ThriftTestTestExceptionResultSend::Ok(())) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestExceptionResultSend", + }) + match self { + ThriftTestTestExceptionResultSend::Ok(ref value) => 0, + ThriftTestTestExceptionResultSend::Err1(ref value) => { + protocol.struct_field_len(Some(1), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, Default, Clone, PartialEq)] + pub struct CrazyNesting { + pub string_field: ::std::option::Option<::pilota::FastStr>, + + pub set_field: ::std::option::Option<::pilota::AHashSet>, + + pub list_field: ::std::vec::Vec< + ::pilota::AHashMap< + ::pilota::AHashSet, + ::pilota::AHashMap< + i32, + ::pilota::AHashSet< + ::std::vec::Vec<::pilota::AHashMap>, + >, + >, + >, + >, + + pub binary_field: ::std::option::Option<::pilota::Bytes>, + + pub uuid_field: ::std::option::Option<[u8; 16]>, + } + impl ::pilota::thrift::Message for CrazyNesting { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "CrazyNesting", + }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.string_field.as_ref() { + protocol.write_faststr_field(1, (value).clone())?; + } + if let Some(value) = self.set_field.as_ref() { + protocol.write_set_field( + 2, + ::pilota::thrift::TType::Struct, + &value, + |protocol, val| { + protocol.write_struct(val)?; + ::std::result::Result::Ok(()) + }, + )?; + } + protocol.write_list_field( + 3, + ::pilota::thrift::TType::Map, + &&self.list_field, + |protocol, val| { + protocol.write_map( + ::pilota::thrift::TType::Set, + ::pilota::thrift::TType::Map, + &val, + |protocol, key| { + protocol.write_set( + ::pilota::thrift::TType::I32, + &key, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_map( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::Set, + &val, + |protocol, key| { + protocol.write_i32(*key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_set( + ::pilota::thrift::TType::List, + &val, + |protocol, val| { + protocol.write_list( + ::pilota::thrift::TType::Map, + &val, + |protocol, val| { + protocol.write_map( + ::pilota::thrift::TType::Struct, + ::pilota::thrift::TType::Binary, + &val, + |protocol, key| { + protocol.write_struct(key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol + .write_faststr((val).clone())?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + }, + )?; + if let Some(value) = self.binary_field.as_ref() { + protocol.write_bytes_field(4, (value).clone())?; + } + if let Some(value) = self.uuid_field.as_ref() { + protocol.write_uuid_field(5, *value)?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut string_field = None; + let mut set_field = None; + let mut list_field = None; + let mut binary_field = None; + let mut uuid_field = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + string_field = Some(protocol.read_faststr()?); + } + Some(2) if field_ident.field_type == ::pilota::thrift::TType::Set => { + set_field = Some({ + let list_ident = protocol.read_set_begin()?; + let mut val = + ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(::pilota::thrift::Message::decode(protocol)?); + } + protocol.read_set_end()?; + val + }); + } + Some(3) if field_ident.field_type == ::pilota::thrift::TType::List => { + list_field = Some(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec< + ::pilota::AHashMap< + ::pilota::AHashSet, + ::pilota::AHashMap< + i32, + ::pilota::AHashSet< + ::std::vec::Vec< + ::pilota::AHashMap< + Insanity, + ::pilota::FastStr, + >, + >, + >, + >, + >, + > = Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr().offset(i as isize).write({ + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert({let list_ident = protocol.read_set_begin()?; + let mut val = ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(protocol.read_i32()?); + }; + protocol.read_set_end()?; + val}, { + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(protocol.read_i32()?, {let list_ident = protocol.read_set_begin()?; + let mut val = ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec<::pilota::AHashMap> = Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr().offset(i as isize).write({ + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(::pilota::thrift::Message::decode(protocol)?, protocol.read_faststr()?); + } + protocol.read_map_end()?; + val + }); + }; + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + }; + protocol.read_set_end()?; + val}); + } + protocol.read_map_end()?; + val + }); + } + protocol.read_map_end()?; + val + }); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + } + Some(4) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + binary_field = Some(protocol.read_bytes()?); + } + Some(5) if field_ident.field_type == ::pilota::thrift::TType::Uuid => { + uuid_field = Some(protocol.read_uuid()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `CrazyNesting` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(list_field) = list_field else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field list_field is required".to_string(), + )); + }; + + let data = Self { + string_field, + set_field, + list_field, + binary_field, + uuid_field, + }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut string_field = None; + let mut set_field = None; + let mut list_field = None; + let mut binary_field = None; + let mut uuid_field = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + + + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + + break; + } else { + + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::Binary => { + string_field = Some(protocol.read_faststr().await?); + + },Some(2) if field_ident.field_type == ::pilota::thrift::TType::Set => { + set_field = Some({let list_ident = protocol.read_set_begin().await?; + let mut val = ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(::decode_async(protocol).await?); + }; + protocol.read_set_end().await?; + val}); + + },Some(3) if field_ident.field_type == ::pilota::thrift::TType::List => { + list_field = Some({ + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push({ + let map_ident = protocol.read_map_begin().await?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert({let list_ident = protocol.read_set_begin().await?; + let mut val = ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(protocol.read_i32().await?); + }; + protocol.read_set_end().await?; + val}, { + let map_ident = protocol.read_map_begin().await?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(protocol.read_i32().await?, {let list_ident = protocol.read_set_begin().await?; + let mut val = ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert({ + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push({ + let map_ident = protocol.read_map_begin().await?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(::decode_async(protocol).await?, protocol.read_faststr().await?); + } + protocol.read_map_end().await?; + val + }); + }; + protocol.read_list_end().await?; + val + }); + }; + protocol.read_set_end().await?; + val}); + } + protocol.read_map_end().await?; + val + }); + } + protocol.read_map_end().await?; + val + }); + }; + protocol.read_list_end().await?; + val + }); + + },Some(4) if field_ident.field_type == ::pilota::thrift::TType::Binary => { + binary_field = Some(protocol.read_bytes().await?); + + },Some(5) if field_ident.field_type == ::pilota::thrift::TType::Uuid => { + uuid_field = Some(protocol.read_uuid().await?); + + }, + _ => { + protocol.skip(field_ident.field_type).await?; + + }, + } + + protocol.read_field_end().await?; + + + }; + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + }.await { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `CrazyNesting` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(list_field) = list_field else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field list_field is required".to_string(), + ), + ); + }; + + let data = Self { + string_field, + set_field, + list_field, + binary_field, + uuid_field, + }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "CrazyNesting", + }) + self + .string_field + .as_ref() + .map_or(0, |value| protocol.faststr_field_len(Some(1), value)) + + self.set_field.as_ref().map_or(0, |value| { + protocol.set_field_len( + Some(2), + ::pilota::thrift::TType::Struct, + value, + |protocol, el| protocol.struct_len(el), + ) + }) + + protocol.list_field_len( + Some(3), + ::pilota::thrift::TType::Map, + &self.list_field, + |protocol, el| { + protocol.map_len( + ::pilota::thrift::TType::Set, + ::pilota::thrift::TType::Map, + el, + |protocol, key| { + protocol.set_len( + ::pilota::thrift::TType::I32, + key, + |protocol, el| protocol.i32_len(*el), + ) + }, + |protocol, val| { + protocol.map_len( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::Set, + val, + |protocol, key| protocol.i32_len(*key), + |protocol, val| { + protocol.set_len( + ::pilota::thrift::TType::List, + val, + |protocol, el| { + protocol.list_len( + ::pilota::thrift::TType::Map, + el, + |protocol, el| { + protocol.map_len( + ::pilota::thrift::TType::Struct, + ::pilota::thrift::TType::Binary, + el, + |protocol, key| { + protocol.struct_len(key) + }, + |protocol, val| { + protocol.faststr_len(val) + }, + ) + }, + ) + }, + ) + }, + ) + }, + ) + }, + ) + + self + .binary_field + .as_ref() + .map_or(0, |value| protocol.bytes_field_len(Some(4), value)) + + self + .uuid_field + .as_ref() + .map_or(0, |value| protocol.uuid_field_len(Some(5), *value)) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestBinaryResultSend { + #[derivative(Default)] + Ok(::pilota::Bytes), + } + + impl ::pilota::thrift::Message for ThriftTestTestBinaryResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestBinaryResultSend", + })?; + match self { + ThriftTestTestBinaryResultSend::Ok(ref value) => { + protocol.write_bytes_field(0, (value).clone())?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_bytes()?; + protocol.bytes_len(&field_ident); + ret = Some(ThriftTestTestBinaryResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_bytes().await?; + + ret = Some(ThriftTestTestBinaryResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestBinaryResultSend", + }) + match self { + ThriftTestTestBinaryResultSend::Ok(ref value) => { + protocol.bytes_field_len(Some(0), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct SecondServiceSecondtestStringArgsSend { + pub thing: ::pilota::FastStr, + } + impl ::pilota::thrift::Message for SecondServiceSecondtestStringArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "SecondServiceSecondtestStringArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_faststr_field(1, (&self.thing).clone())?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + thing = Some(protocol.read_faststr()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `SecondServiceSecondtestStringArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + thing = Some(protocol.read_faststr().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `SecondServiceSecondtestStringArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "SecondServiceSecondtestStringArgsSend", + }) + protocol.faststr_field_len(Some(1), &self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestByteResultSend { + #[derivative(Default)] + Ok(i8), + } + + impl ::pilota::thrift::Message for ThriftTestTestByteResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestByteResultSend", + })?; + match self { + ThriftTestTestByteResultSend::Ok(ref value) => { + protocol.write_i8_field(0, *value)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_i8()?; + protocol.i8_len(*&field_ident); + ret = Some(ThriftTestTestByteResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_i8().await?; + + ret = Some(ThriftTestTestByteResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestByteResultSend", + }) + match self { + ThriftTestTestByteResultSend::Ok(ref value) => { + protocol.i8_field_len(Some(0), *value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestMultiExceptionResultRecv { + #[derivative(Default)] + Ok(Xtruct), + + Err1(Xception), + + Err2(Xception2), + } + + impl ::pilota::thrift::Message for ThriftTestTestMultiExceptionResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMultiExceptionResultRecv", + })?; + match self { + ThriftTestTestMultiExceptionResultRecv::Ok(ref value) => { + protocol.write_struct_field(0, value, ::pilota::thrift::TType::Struct)?; + } + ThriftTestTestMultiExceptionResultRecv::Err1(ref value) => { + protocol.write_struct_field(1, value, ::pilota::thrift::TType::Struct)?; + } + ThriftTestTestMultiExceptionResultRecv::Err2(ref value) => { + protocol.write_struct_field(2, value, ::pilota::thrift::TType::Struct)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = Some(ThriftTestTestMultiExceptionResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + Some(1) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = + Some(ThriftTestTestMultiExceptionResultRecv::Err1(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + Some(2) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = + Some(ThriftTestTestMultiExceptionResultRecv::Err2(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(ThriftTestTestMultiExceptionResultRecv::Ok( + field_ident, + )); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + Some(1) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(ThriftTestTestMultiExceptionResultRecv::Err1( + field_ident, + )); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + Some(2) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(ThriftTestTestMultiExceptionResultRecv::Err2( + field_ident, + )); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMultiExceptionResultRecv", + }) + match self { + ThriftTestTestMultiExceptionResultRecv::Ok(ref value) => { + protocol.struct_field_len(Some(0), value) + } + ThriftTestTestMultiExceptionResultRecv::Err1(ref value) => { + protocol.struct_field_len(Some(1), value) + } + ThriftTestTestMultiExceptionResultRecv::Err2(ref value) => { + protocol.struct_field_len(Some(2), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct Xception { + pub error_code: ::std::option::Option, + + pub message: ::std::option::Option<::pilota::FastStr>, + } + impl ::pilota::thrift::Message for Xception { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { name: "Xception" }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.error_code.as_ref() { + protocol.write_i32_field(1, *value)?; + } + if let Some(value) = self.message.as_ref() { + protocol.write_faststr_field(2, (value).clone())?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut error_code = None; + let mut message = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + error_code = Some(protocol.read_i32()?); + } + Some(2) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + message = Some(protocol.read_faststr()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `Xception` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { + error_code, + message, + }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut error_code = None; + let mut message = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + error_code = Some(protocol.read_i32().await?); + } + Some(2) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + message = Some(protocol.read_faststr().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `Xception` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { + error_code, + message, + }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { name: "Xception" }) + + self + .error_code + .as_ref() + .map_or(0, |value| protocol.i32_field_len(Some(1), *value)) + + self + .message + .as_ref() + .map_or(0, |value| protocol.faststr_field_len(Some(2), value)) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestMapMapArgsSend { + pub hello: i32, + } + impl ::pilota::thrift::Message for ThriftTestTestMapMapArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMapMapArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_i32_field(1, *&self.hello)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut hello = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + hello = Some(protocol.read_i32()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestMapMapArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(hello) = hello else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field hello is required".to_string(), + )); + }; + + let data = Self { hello }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut hello = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + hello = Some(protocol.read_i32().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestMapMapArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(hello) = hello else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field hello is required".to_string(), + ), + ); + }; + + let data = Self { hello }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMapMapArgsSend", + }) + protocol.i32_field_len(Some(1), *&self.hello) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, Default, Clone, PartialEq)] + pub struct GuessProtocolStruct { + pub map_field: + ::std::option::Option<::pilota::AHashMap<::pilota::FastStr, ::pilota::FastStr>>, + } + impl ::pilota::thrift::Message for GuessProtocolStruct { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "GuessProtocolStruct", + }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.map_field.as_ref() { + protocol.write_map_field( + 7, + ::pilota::thrift::TType::Binary, + ::pilota::thrift::TType::Binary, + &value, + |protocol, key| { + protocol.write_faststr((key).clone())?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_faststr((val).clone())?; + ::std::result::Result::Ok(()) + }, + )?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut map_field = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(7) if field_ident.field_type == ::pilota::thrift::TType::Map => { + map_field = Some({ + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_faststr()?, + protocol.read_faststr()?, + ); + } + protocol.read_map_end()?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `GuessProtocolStruct` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { map_field }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut map_field = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(7) + if field_ident.field_type == ::pilota::thrift::TType::Map => + { + map_field = Some({ + let map_ident = protocol.read_map_begin().await?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_faststr().await?, + protocol.read_faststr().await?, + ); + } + protocol.read_map_end().await?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `GuessProtocolStruct` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { map_field }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "GuessProtocolStruct", + }) + self.map_field.as_ref().map_or(0, |value| { + protocol.map_field_len( + Some(7), + ::pilota::thrift::TType::Binary, + ::pilota::thrift::TType::Binary, + value, + |protocol, key| protocol.faststr_len(key), + |protocol, val| protocol.faststr_len(val), + ) + }) + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestSetArgsSend { + pub thing: ::pilota::AHashSet, + } + impl ::pilota::thrift::Message for ThriftTestTestSetArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestSetArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_set_field( + 1, + ::pilota::thrift::TType::I32, + &&self.thing, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::Set => { + thing = Some({ + let list_ident = protocol.read_set_begin()?; + let mut val = + ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(protocol.read_i32()?); + } + protocol.read_set_end()?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestSetArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Set => + { + thing = Some({ + let list_ident = protocol.read_set_begin().await?; + let mut val = + ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(protocol.read_i32().await?); + } + protocol.read_set_end().await?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestSetArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestSetArgsSend", + }) + protocol.set_field_len( + Some(1), + ::pilota::thrift::TType::I32, + &self.thing, + |protocol, el| protocol.i32_len(*el), + ) + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestStructArgsSend { + pub thing: Xtruct, + } + impl ::pilota::thrift::Message for ThriftTestTestStructArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStructArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_struct_field(1, &self.thing, ::pilota::thrift::TType::Struct)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + thing = Some(::pilota::thrift::Message::decode(protocol)?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestStructArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Struct => + { + thing = Some( + ::decode_async( + protocol, + ) + .await?, + ); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestStructArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStructArgsSend", + }) + protocol.struct_field_len(Some(1), &self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestInsanityArgsRecv { + pub argument: Insanity, + } + impl ::pilota::thrift::Message for ThriftTestTestInsanityArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestInsanityArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_struct_field(1, &self.argument, ::pilota::thrift::TType::Struct)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut argument = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + argument = Some(::pilota::thrift::Message::decode(protocol)?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestInsanityArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(argument) = argument else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field argument is required".to_string(), + )); + }; + + let data = Self { argument }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut argument = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Struct => + { + argument = Some( + ::decode_async( + protocol, + ) + .await?, + ); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestInsanityArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(argument) = argument else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field argument is required".to_string(), + ), + ); + }; + + let data = Self { argument }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestInsanityArgsRecv", + }) + protocol.struct_field_len(Some(1), &self.argument) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + impl Default for BoolTest { + fn default() -> Self { + BoolTest { + b: Some(true), + s: Some(::pilota::FastStr::from_static_str("true")), + } + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)] + pub struct BoolTest { + pub b: ::std::option::Option, + + pub s: ::std::option::Option<::pilota::FastStr>, + } + impl ::pilota::thrift::Message for BoolTest { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { name: "BoolTest" }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.b.as_ref() { + protocol.write_bool_field(1, *value)?; + } + if let Some(value) = self.s.as_ref() { + protocol.write_faststr_field(2, (value).clone())?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut b = Some(true); + let mut s = Some(::pilota::FastStr::from_static_str("true")); + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::Bool => { + b = Some(protocol.read_bool()?); + } + Some(2) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + s = Some(protocol.read_faststr()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `BoolTest` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { b, s }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut b = Some(true); + let mut s = Some(::pilota::FastStr::from_static_str("true")); + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Bool => + { + b = Some(protocol.read_bool().await?); + } + Some(2) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + s = Some(protocol.read_faststr().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `BoolTest` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { b, s }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { name: "BoolTest" }) + + self + .b + .as_ref() + .map_or(0, |value| protocol.bool_field_len(Some(1), *value)) + + self + .s + .as_ref() + .map_or(0, |value| protocol.faststr_field_len(Some(2), value)) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestI64ArgsSend { + pub thing: i64, + } + impl ::pilota::thrift::Message for ThriftTestTestI64ArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestI64ArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_i64_field(1, *&self.thing)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I64 => { + thing = Some(protocol.read_i64()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestI64ArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I64 => + { + thing = Some(protocol.read_i64().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestI64ArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestI64ArgsSend", + }) + protocol.i64_field_len(Some(1), *&self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestListArgsRecv { + pub thing: ::std::vec::Vec, + } + impl ::pilota::thrift::Message for ThriftTestTestListArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestListArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_list_field( + 1, + ::pilota::thrift::TType::I32, + &&self.thing, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::List => { + thing = Some(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec = Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr() + .offset(i as isize) + .write(protocol.read_i32()?); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestListArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::List => + { + thing = Some({ + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push(protocol.read_i32().await?); + } + protocol.read_list_end().await?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestListArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestListArgsRecv", + }) + protocol.list_field_len( + Some(1), + ::pilota::thrift::TType::I32, + &self.thing, + |protocol, el| protocol.i32_len(*el), + ) + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestStringArgsSend { + pub thing: ::pilota::FastStr, + } + impl ::pilota::thrift::Message for ThriftTestTestStringArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStringArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_faststr_field(1, (&self.thing).clone())?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + thing = Some(protocol.read_faststr()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestStringArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + thing = Some(protocol.read_faststr().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestStringArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStringArgsSend", + }) + protocol.faststr_field_len(Some(1), &self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestNestArgsRecv { + pub thing: Xtruct2, + } + impl ::pilota::thrift::Message for ThriftTestTestNestArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestNestArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_struct_field(1, &self.thing, ::pilota::thrift::TType::Struct)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + thing = Some(::pilota::thrift::Message::decode(protocol)?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestNestArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Struct => + { + thing = Some( + ::decode_async( + protocol, + ) + .await?, + ); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestNestArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestNestArgsRecv", + }) + protocol.struct_field_len(Some(1), &self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestExceptionResultRecv { + #[derivative(Default)] + Ok(()), + + Err1(Xception), + } + + impl ::pilota::thrift::Message for ThriftTestTestExceptionResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestExceptionResultRecv", + })?; + match self { + ThriftTestTestExceptionResultRecv::Ok(ref value) => {} + ThriftTestTestExceptionResultRecv::Err1(ref value) => { + protocol.write_struct_field(1, value, ::pilota::thrift::TType::Struct)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(1) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = Some(ThriftTestTestExceptionResultRecv::Err1(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Ok(ThriftTestTestExceptionResultRecv::Ok(())) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(1) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = + Some(ThriftTestTestExceptionResultRecv::Err1(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Ok(ThriftTestTestExceptionResultRecv::Ok(())) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestExceptionResultRecv", + }) + match self { + ThriftTestTestExceptionResultRecv::Ok(ref value) => 0, + ThriftTestTestExceptionResultRecv::Err1(ref value) => { + protocol.struct_field_len(Some(1), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct Xtruct2 { + pub byte_thing: ::std::option::Option, + + pub struct_thing: ::std::option::Option, + + pub i32_thing: ::std::option::Option, + } + impl ::pilota::thrift::Message for Xtruct2 { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { name: "Xtruct2" }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.byte_thing.as_ref() { + protocol.write_i8_field(1, *value)?; + } + if let Some(value) = self.struct_thing.as_ref() { + protocol.write_struct_field(2, value, ::pilota::thrift::TType::Struct)?; + } + if let Some(value) = self.i32_thing.as_ref() { + protocol.write_i32_field(3, *value)?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut byte_thing = None; + let mut struct_thing = None; + let mut i32_thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I8 => { + byte_thing = Some(protocol.read_i8()?); + } + Some(2) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + struct_thing = Some(::pilota::thrift::Message::decode(protocol)?); + } + Some(3) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + i32_thing = Some(protocol.read_i32()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `Xtruct2` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { + byte_thing, + struct_thing, + i32_thing, + }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut byte_thing = None; + let mut struct_thing = None; + let mut i32_thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I8 => + { + byte_thing = Some(protocol.read_i8().await?); + } + Some(2) + if field_ident.field_type + == ::pilota::thrift::TType::Struct => + { + struct_thing = Some( + ::decode_async( + protocol, + ) + .await?, + ); + } + Some(3) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + i32_thing = Some(protocol.read_i32().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `Xtruct2` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { + byte_thing, + struct_thing, + i32_thing, + }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { name: "Xtruct2" }) + + self + .byte_thing + .as_ref() + .map_or(0, |value| protocol.i8_field_len(Some(1), *value)) + + self + .struct_thing + .as_ref() + .map_or(0, |value| protocol.struct_field_len(Some(2), value)) + + self + .i32_thing + .as_ref() + .map_or(0, |value| protocol.i32_field_len(Some(3), *value)) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestDoubleArgsRecv { + pub thing: f64, + } + impl ::pilota::thrift::Message for ThriftTestTestDoubleArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestDoubleArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_double_field(1, *&self.thing)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Double => + { + thing = Some(protocol.read_double()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestDoubleArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Double => + { + thing = Some(protocol.read_double().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestDoubleArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestDoubleArgsRecv", + }) + protocol.double_field_len(Some(1), *&self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestTypedefResultRecv { + #[derivative(Default)] + Ok(UserId), + } + + impl ::pilota::thrift::Message for ThriftTestTestTypedefResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestTypedefResultRecv", + })?; + match self { + ThriftTestTestTypedefResultRecv::Ok(ref value) => { + protocol.write_struct_field(0, value, ::pilota::thrift::TType::I64)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = Some(ThriftTestTestTypedefResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(ThriftTestTestTypedefResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestTypedefResultRecv", + }) + match self { + ThriftTestTestTypedefResultRecv::Ok(ref value) => { + protocol.struct_field_len(Some(0), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestBoolArgsRecv { + pub thing: bool, + } + impl ::pilota::thrift::Message for ThriftTestTestBoolArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestBoolArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_bool_field(1, *&self.thing)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::Bool => { + thing = Some(protocol.read_bool()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestBoolArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Bool => + { + thing = Some(protocol.read_bool().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestBoolArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestBoolArgsRecv", + }) + protocol.bool_field_len(Some(1), *&self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestStringMapResultRecv { + #[derivative(Default)] + Ok(::pilota::AHashMap<::pilota::FastStr, ::pilota::FastStr>), + } + + impl ::pilota::thrift::Message for ThriftTestTestStringMapResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStringMapResultRecv", + })?; + match self { + ThriftTestTestStringMapResultRecv::Ok(ref value) => { + protocol.write_map_field( + 0, + ::pilota::thrift::TType::Binary, + ::pilota::thrift::TType::Binary, + &value, + |protocol, key| { + protocol.write_faststr((key).clone())?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_faststr((val).clone())?; + ::std::result::Result::Ok(()) + }, + )?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_faststr()?, + protocol.read_faststr()?, + ); + } + protocol.read_map_end()?; + val + }; + protocol.map_len( + ::pilota::thrift::TType::Binary, + ::pilota::thrift::TType::Binary, + &field_ident, + |protocol, key| protocol.faststr_len(key), + |protocol, val| protocol.faststr_len(val), + ); + ret = Some(ThriftTestTestStringMapResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let map_ident = protocol.read_map_begin().await?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_faststr().await?, + protocol.read_faststr().await?, + ); + } + protocol.read_map_end().await?; + val + }; + + ret = Some(ThriftTestTestStringMapResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStringMapResultRecv", + }) + match self { + ThriftTestTestStringMapResultRecv::Ok(ref value) => protocol.map_field_len( + Some(0), + ::pilota::thrift::TType::Binary, + ::pilota::thrift::TType::Binary, + value, + |protocol, key| protocol.faststr_len(key), + |protocol, val| protocol.faststr_len(val), + ), + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestUuidResultRecv { + #[derivative(Default)] + Ok([u8; 16]), + } + + impl ::pilota::thrift::Message for ThriftTestTestUuidResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestUuidResultRecv", + })?; + match self { + ThriftTestTestUuidResultRecv::Ok(ref value) => { + protocol.write_uuid_field(0, *value)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_uuid()?; + protocol.uuid_len(*&field_ident); + ret = Some(ThriftTestTestUuidResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_uuid().await?; + + ret = Some(ThriftTestTestUuidResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestUuidResultRecv", + }) + match self { + ThriftTestTestUuidResultRecv::Ok(ref value) => { + protocol.uuid_field_len(Some(0), *value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, Default, Clone, PartialEq)] + pub struct VersioningTestV2 { + pub begin_in_both: ::std::option::Option, + + pub newint: ::std::option::Option, + + pub newbyte: ::std::option::Option, + + pub newshort: ::std::option::Option, + + pub newlong: ::std::option::Option, + + pub newdouble: ::std::option::Option, + + pub newstruct: ::std::option::Option, + + pub newlist: ::std::option::Option<::std::vec::Vec>, + + pub newset: ::std::option::Option<::pilota::AHashSet>, + + pub newmap: ::std::option::Option<::pilota::AHashMap>, + + pub newstring: ::std::option::Option<::pilota::FastStr>, + + pub end_in_both: ::std::option::Option, + } + impl ::pilota::thrift::Message for VersioningTestV2 { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "VersioningTestV2", + }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.begin_in_both.as_ref() { + protocol.write_i32_field(1, *value)?; + } + if let Some(value) = self.newint.as_ref() { + protocol.write_i32_field(2, *value)?; + } + if let Some(value) = self.newbyte.as_ref() { + protocol.write_i8_field(3, *value)?; + } + if let Some(value) = self.newshort.as_ref() { + protocol.write_i16_field(4, *value)?; + } + if let Some(value) = self.newlong.as_ref() { + protocol.write_i64_field(5, *value)?; + } + if let Some(value) = self.newdouble.as_ref() { + protocol.write_double_field(6, *value)?; + } + if let Some(value) = self.newstruct.as_ref() { + protocol.write_struct_field(7, value, ::pilota::thrift::TType::Struct)?; + } + if let Some(value) = self.newlist.as_ref() { + protocol.write_list_field( + 8, + ::pilota::thrift::TType::I32, + &value, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + } + if let Some(value) = self.newset.as_ref() { + protocol.write_set_field( + 9, + ::pilota::thrift::TType::I32, + &value, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + } + if let Some(value) = self.newmap.as_ref() { + protocol.write_map_field( + 10, + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I32, + &value, + |protocol, key| { + protocol.write_i32(*key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + } + if let Some(value) = self.newstring.as_ref() { + protocol.write_faststr_field(11, (value).clone())?; + } + if let Some(value) = self.end_in_both.as_ref() { + protocol.write_i32_field(12, *value)?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut begin_in_both = None; + let mut newint = None; + let mut newbyte = None; + let mut newshort = None; + let mut newlong = None; + let mut newdouble = None; + let mut newstruct = None; + let mut newlist = None; + let mut newset = None; + let mut newmap = None; + let mut newstring = None; + let mut end_in_both = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + begin_in_both = Some(protocol.read_i32()?); + } + Some(2) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + newint = Some(protocol.read_i32()?); + } + Some(3) if field_ident.field_type == ::pilota::thrift::TType::I8 => { + newbyte = Some(protocol.read_i8()?); + } + Some(4) if field_ident.field_type == ::pilota::thrift::TType::I16 => { + newshort = Some(protocol.read_i16()?); + } + Some(5) if field_ident.field_type == ::pilota::thrift::TType::I64 => { + newlong = Some(protocol.read_i64()?); + } + Some(6) + if field_ident.field_type == ::pilota::thrift::TType::Double => + { + newdouble = Some(protocol.read_double()?); + } + Some(7) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + newstruct = Some(::pilota::thrift::Message::decode(protocol)?); + } + Some(8) if field_ident.field_type == ::pilota::thrift::TType::List => { + newlist = Some(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec = Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr() + .offset(i as isize) + .write(protocol.read_i32()?); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + } + Some(9) if field_ident.field_type == ::pilota::thrift::TType::Set => { + newset = Some({ + let list_ident = protocol.read_set_begin()?; + let mut val = + ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(protocol.read_i32()?); + } + protocol.read_set_end()?; + val + }); + } + Some(10) if field_ident.field_type == ::pilota::thrift::TType::Map => { + newmap = Some({ + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(protocol.read_i32()?, protocol.read_i32()?); + } + protocol.read_map_end()?; + val + }); + } + Some(11) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + newstring = Some(protocol.read_faststr()?); + } + Some(12) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + end_in_both = Some(protocol.read_i32()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `VersioningTestV2` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { + begin_in_both, + newint, + newbyte, + newshort, + newlong, + newdouble, + newstruct, + newlist, + newset, + newmap, + newstring, + end_in_both, + }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut begin_in_both = None; + let mut newint = None; + let mut newbyte = None; + let mut newshort = None; + let mut newlong = None; + let mut newdouble = None; + let mut newstruct = None; + let mut newlist = None; + let mut newset = None; + let mut newmap = None; + let mut newstring = None; + let mut end_in_both = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + begin_in_both = Some(protocol.read_i32().await?); + } + Some(2) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + newint = Some(protocol.read_i32().await?); + } + Some(3) + if field_ident.field_type == ::pilota::thrift::TType::I8 => + { + newbyte = Some(protocol.read_i8().await?); + } + Some(4) + if field_ident.field_type == ::pilota::thrift::TType::I16 => + { + newshort = Some(protocol.read_i16().await?); + } + Some(5) + if field_ident.field_type == ::pilota::thrift::TType::I64 => + { + newlong = Some(protocol.read_i64().await?); + } + Some(6) + if field_ident.field_type + == ::pilota::thrift::TType::Double => + { + newdouble = Some(protocol.read_double().await?); + } + Some(7) + if field_ident.field_type + == ::pilota::thrift::TType::Struct => + { + newstruct = Some( + ::decode_async(protocol) + .await?, + ); + } + Some(8) + if field_ident.field_type == ::pilota::thrift::TType::List => + { + newlist = Some({ + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push(protocol.read_i32().await?); + } + protocol.read_list_end().await?; + val + }); + } + Some(9) + if field_ident.field_type == ::pilota::thrift::TType::Set => + { + newset = Some({ + let list_ident = protocol.read_set_begin().await?; + let mut val = + ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(protocol.read_i32().await?); + } + protocol.read_set_end().await?; + val + }); + } + Some(10) + if field_ident.field_type == ::pilota::thrift::TType::Map => + { + newmap = Some({ + let map_ident = protocol.read_map_begin().await?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_i32().await?, + protocol.read_i32().await?, + ); + } + protocol.read_map_end().await?; + val + }); + } + Some(11) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + newstring = Some(protocol.read_faststr().await?); + } + Some(12) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + end_in_both = Some(protocol.read_i32().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `VersioningTestV2` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { + begin_in_both, + newint, + newbyte, + newshort, + newlong, + newdouble, + newstruct, + newlist, + newset, + newmap, + newstring, + end_in_both, + }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "VersioningTestV2", + }) + self + .begin_in_both + .as_ref() + .map_or(0, |value| protocol.i32_field_len(Some(1), *value)) + + self + .newint + .as_ref() + .map_or(0, |value| protocol.i32_field_len(Some(2), *value)) + + self + .newbyte + .as_ref() + .map_or(0, |value| protocol.i8_field_len(Some(3), *value)) + + self + .newshort + .as_ref() + .map_or(0, |value| protocol.i16_field_len(Some(4), *value)) + + self + .newlong + .as_ref() + .map_or(0, |value| protocol.i64_field_len(Some(5), *value)) + + self + .newdouble + .as_ref() + .map_or(0, |value| protocol.double_field_len(Some(6), *value)) + + self + .newstruct + .as_ref() + .map_or(0, |value| protocol.struct_field_len(Some(7), value)) + + self.newlist.as_ref().map_or(0, |value| { + protocol.list_field_len( + Some(8), + ::pilota::thrift::TType::I32, + value, + |protocol, el| protocol.i32_len(*el), + ) + }) + + self.newset.as_ref().map_or(0, |value| { + protocol.set_field_len( + Some(9), + ::pilota::thrift::TType::I32, + value, + |protocol, el| protocol.i32_len(*el), + ) + }) + + self.newmap.as_ref().map_or(0, |value| { + protocol.map_field_len( + Some(10), + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I32, + value, + |protocol, key| protocol.i32_len(*key), + |protocol, val| protocol.i32_len(*val), + ) + }) + + self + .newstring + .as_ref() + .map_or(0, |value| protocol.faststr_field_len(Some(11), value)) + + self + .end_in_both + .as_ref() + .map_or(0, |value| protocol.i32_field_len(Some(12), *value)) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestI32ResultRecv { + #[derivative(Default)] + Ok(i32), + } + + impl ::pilota::thrift::Message for ThriftTestTestI32ResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestI32ResultRecv", + })?; + match self { + ThriftTestTestI32ResultRecv::Ok(ref value) => { + protocol.write_i32_field(0, *value)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_i32()?; + protocol.i32_len(*&field_ident); + ret = Some(ThriftTestTestI32ResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_i32().await?; + + ret = Some(ThriftTestTestI32ResultRecv::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestI32ResultRecv", + }) + match self { + ThriftTestTestI32ResultRecv::Ok(ref value) => { + protocol.i32_field_len(Some(0), *value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestMultiExceptionResultSend { + #[derivative(Default)] + Ok(Xtruct), + + Err1(Xception), + + Err2(Xception2), + } + + impl ::pilota::thrift::Message for ThriftTestTestMultiExceptionResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMultiExceptionResultSend", + })?; + match self { + ThriftTestTestMultiExceptionResultSend::Ok(ref value) => { + protocol.write_struct_field(0, value, ::pilota::thrift::TType::Struct)?; + } + ThriftTestTestMultiExceptionResultSend::Err1(ref value) => { + protocol.write_struct_field(1, value, ::pilota::thrift::TType::Struct)?; + } + ThriftTestTestMultiExceptionResultSend::Err2(ref value) => { + protocol.write_struct_field(2, value, ::pilota::thrift::TType::Struct)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = Some(ThriftTestTestMultiExceptionResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + Some(1) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = + Some(ThriftTestTestMultiExceptionResultSend::Err1(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + Some(2) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = + Some(ThriftTestTestMultiExceptionResultSend::Err2(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(ThriftTestTestMultiExceptionResultSend::Ok( + field_ident, + )); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + Some(1) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(ThriftTestTestMultiExceptionResultSend::Err1( + field_ident, + )); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + Some(2) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(ThriftTestTestMultiExceptionResultSend::Err2( + field_ident, + )); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMultiExceptionResultSend", + }) + match self { + ThriftTestTestMultiExceptionResultSend::Ok(ref value) => { + protocol.struct_field_len(Some(0), value) + } + ThriftTestTestMultiExceptionResultSend::Err1(ref value) => { + protocol.struct_field_len(Some(1), value) + } + ThriftTestTestMultiExceptionResultSend::Err2(ref value) => { + protocol.struct_field_len(Some(2), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestVoidResultRecv { + #[derivative(Default)] + Ok(()), + } + + impl ::pilota::thrift::Message for ThriftTestTestVoidResultRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestVoidResultRecv", + })?; + match self { + ThriftTestTestVoidResultRecv::Ok(ref value) => {} + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Ok(ThriftTestTestVoidResultRecv::Ok(())) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Ok(ThriftTestTestVoidResultRecv::Ok(())) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestVoidResultRecv", + }) + match self { + ThriftTestTestVoidResultRecv::Ok(ref value) => 0, + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestInsanityResultSend { + #[derivative(Default)] + Ok(::pilota::AHashMap>), + } + + impl ::pilota::thrift::Message for ThriftTestTestInsanityResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestInsanityResultSend", + })?; + match self { + ThriftTestTestInsanityResultSend::Ok(ref value) => { + protocol.write_map_field( + 0, + ::pilota::thrift::TType::I64, + ::pilota::thrift::TType::Map, + &value, + |protocol, key| { + protocol.write_struct(key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_map( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::Struct, + &val, + |protocol, key| { + protocol.write_struct(key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_struct(val)?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + }, + )?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(::pilota::thrift::Message::decode(protocol)?, { + let map_ident = protocol.read_map_begin()?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + ::pilota::thrift::Message::decode(protocol)?, + ::pilota::thrift::Message::decode(protocol)?, + ); + } + protocol.read_map_end()?; + val + }); + } + protocol.read_map_end()?; + val + }; + protocol.map_len( + ::pilota::thrift::TType::I64, + ::pilota::thrift::TType::Map, + &field_ident, + |protocol, key| protocol.struct_len(key), + |protocol, val| { + protocol.map_len( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::Struct, + val, + |protocol, key| protocol.struct_len(key), + |protocol, val| protocol.struct_len(val), + ) + }, + ); + ret = Some(ThriftTestTestInsanityResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let map_ident = protocol.read_map_begin().await?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(::decode_async(protocol).await?, { + let map_ident = protocol.read_map_begin().await?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(::decode_async(protocol).await?, ::decode_async(protocol).await?); + } + protocol.read_map_end().await?; + val + }); + } + protocol.read_map_end().await?; + val + }; + + ret = Some(ThriftTestTestInsanityResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestInsanityResultSend", + }) + match self { + ThriftTestTestInsanityResultSend::Ok(ref value) => protocol.map_field_len( + Some(0), + ::pilota::thrift::TType::I64, + ::pilota::thrift::TType::Map, + value, + |protocol, key| protocol.struct_len(key), + |protocol, val| { + protocol.map_len( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::Struct, + val, + |protocol, key| protocol.struct_len(key), + |protocol, val| protocol.struct_len(val), + ) + }, + ), + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, Default, Clone, PartialEq)] + pub struct NestedMixedx2 { + pub int_set_list: ::std::option::Option<::std::vec::Vec<::pilota::AHashSet>>, + + pub map_int_strset: ::std::option::Option< + ::pilota::AHashMap>, + >, + + pub map_int_strset_list: ::std::option::Option< + ::std::vec::Vec<::pilota::AHashMap>>, + >, + } + impl ::pilota::thrift::Message for NestedMixedx2 { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "NestedMixedx2", + }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.int_set_list.as_ref() { + protocol.write_list_field( + 1, + ::pilota::thrift::TType::Set, + &value, + |protocol, val| { + protocol.write_set( + ::pilota::thrift::TType::I32, + &val, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + }, + )?; + } + if let Some(value) = self.map_int_strset.as_ref() { + protocol.write_map_field( + 2, + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::Set, + &value, + |protocol, key| { + protocol.write_i32(*key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_set( + ::pilota::thrift::TType::Binary, + &val, + |protocol, val| { + protocol.write_faststr((val).clone())?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + }, + )?; + } + if let Some(value) = self.map_int_strset_list.as_ref() { + protocol.write_list_field( + 3, + ::pilota::thrift::TType::Map, + &value, + |protocol, val| { + protocol.write_map( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::Set, + &val, + |protocol, key| { + protocol.write_i32(*key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_set( + ::pilota::thrift::TType::Binary, + &val, + |protocol, val| { + protocol.write_faststr((val).clone())?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + }, + )?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut int_set_list = None; + let mut map_int_strset = None; + let mut map_int_strset_list = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::List => { + int_set_list = Some(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec<::pilota::AHashSet> = + Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr().offset(i as isize).write({ + let list_ident = protocol.read_set_begin()?; + let mut val = + ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(protocol.read_i32()?); + } + protocol.read_set_end()?; + val + }); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + } + Some(2) if field_ident.field_type == ::pilota::thrift::TType::Map => { + map_int_strset = Some({ + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(protocol.read_i32()?, { + let list_ident = protocol.read_set_begin()?; + let mut val = + ::pilota::AHashSet::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.insert(protocol.read_faststr()?); + } + protocol.read_set_end()?; + val + }); + } + protocol.read_map_end()?; + val + }); + } + Some(3) if field_ident.field_type == ::pilota::thrift::TType::List => { + map_int_strset_list = Some(unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec< + ::pilota::AHashMap< + i32, + ::pilota::AHashSet<::pilota::FastStr>, + >, + > = Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr().offset(i as isize).write({ + let map_ident = protocol.read_map_begin()?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(protocol.read_i32()?, { + let list_ident = protocol.read_set_begin()?; + let mut val = ::pilota::AHashSet::with_capacity( + list_ident.size, + ); + for _ in 0..list_ident.size { + val.insert(protocol.read_faststr()?); + } + protocol.read_set_end()?; + val + }); + } + protocol.read_map_end()?; + val + }); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `NestedMixedx2` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { + int_set_list, + map_int_strset, + map_int_strset_list, + }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut int_set_list = None; + let mut map_int_strset = None; + let mut map_int_strset_list = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::List => + { + int_set_list = Some({ + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push({ + let list_ident = protocol.read_set_begin().await?; + let mut val = ::pilota::AHashSet::with_capacity( + list_ident.size, + ); + for _ in 0..list_ident.size { + val.insert(protocol.read_i32().await?); + } + protocol.read_set_end().await?; + val + }); + } + protocol.read_list_end().await?; + val + }); + } + Some(2) + if field_ident.field_type == ::pilota::thrift::TType::Map => + { + map_int_strset = Some({ + let map_ident = protocol.read_map_begin().await?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(protocol.read_i32().await?, { + let list_ident = protocol.read_set_begin().await?; + let mut val = ::pilota::AHashSet::with_capacity( + list_ident.size, + ); + for _ in 0..list_ident.size { + val.insert(protocol.read_faststr().await?); + } + protocol.read_set_end().await?; + val + }); + } + protocol.read_map_end().await?; + val + }); + } + Some(3) + if field_ident.field_type == ::pilota::thrift::TType::List => + { + map_int_strset_list = Some({ + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push({ + let map_ident = protocol.read_map_begin().await?; + let mut val = ::pilota::AHashMap::with_capacity( + map_ident.size, + ); + for _ in 0..map_ident.size { + val.insert(protocol.read_i32().await?, { + let list_ident = + protocol.read_set_begin().await?; + let mut val = + ::pilota::AHashSet::with_capacity( + list_ident.size, + ); + for _ in 0..list_ident.size { + val.insert( + protocol.read_faststr().await?, + ); + } + protocol.read_set_end().await?; + val + }); + } + protocol.read_map_end().await?; + val + }); + } + protocol.read_list_end().await?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `NestedMixedx2` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { + int_set_list, + map_int_strset, + map_int_strset_list, + }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "NestedMixedx2", + }) + self.int_set_list.as_ref().map_or(0, |value| { + protocol.list_field_len( + Some(1), + ::pilota::thrift::TType::Set, + value, + |protocol, el| { + protocol.set_len(::pilota::thrift::TType::I32, el, |protocol, el| { + protocol.i32_len(*el) + }) + }, + ) + }) + self.map_int_strset.as_ref().map_or(0, |value| { + protocol.map_field_len( + Some(2), + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::Set, + value, + |protocol, key| protocol.i32_len(*key), + |protocol, val| { + protocol.set_len( + ::pilota::thrift::TType::Binary, + val, + |protocol, el| protocol.faststr_len(el), + ) + }, + ) + }) + self.map_int_strset_list.as_ref().map_or(0, |value| { + protocol.list_field_len( + Some(3), + ::pilota::thrift::TType::Map, + value, + |protocol, el| { + protocol.map_len( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::Set, + el, + |protocol, key| protocol.i32_len(*key), + |protocol, val| { + protocol.set_len( + ::pilota::thrift::TType::Binary, + val, + |protocol, el| protocol.faststr_len(el), + ) + }, + ) + }, + ) + }) + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestListResultSend { + #[derivative(Default)] + Ok(::std::vec::Vec), + } + + impl ::pilota::thrift::Message for ThriftTestTestListResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestListResultSend", + })?; + match self { + ThriftTestTestListResultSend::Ok(ref value) => { + protocol.write_list_field( + 0, + ::pilota::thrift::TType::I32, + &value, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = unsafe { + let list_ident = protocol.read_list_begin()?; + let mut val: Vec = Vec::with_capacity(list_ident.size); + for i in 0..list_ident.size { + val.as_mut_ptr() + .offset(i as isize) + .write(protocol.read_i32()?); + } + val.set_len(list_ident.size); + protocol.read_list_end()?; + val + }; + protocol.list_len( + ::pilota::thrift::TType::I32, + &field_ident, + |protocol, el| protocol.i32_len(*el), + ); + ret = Some(ThriftTestTestListResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = { + let list_ident = protocol.read_list_begin().await?; + let mut val = Vec::with_capacity(list_ident.size); + for _ in 0..list_ident.size { + val.push(protocol.read_i32().await?); + } + protocol.read_list_end().await?; + val + }; + + ret = Some(ThriftTestTestListResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestListResultSend", + }) + match self { + ThriftTestTestListResultSend::Ok(ref value) => protocol.list_field_len( + Some(0), + ::pilota::thrift::TType::I32, + value, + |protocol, el| protocol.i32_len(*el), + ), + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestMultiExceptionArgsSend { + pub arg0: ::pilota::FastStr, + + pub arg1: ::pilota::FastStr, + } + impl ::pilota::thrift::Message for ThriftTestTestMultiExceptionArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMultiExceptionArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_faststr_field(1, (&self.arg0).clone())?; + protocol.write_faststr_field(2, (&self.arg1).clone())?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut arg0 = None; + let mut arg1 = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + arg0 = Some(protocol.read_faststr()?); + } + Some(2) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + arg1 = Some(protocol.read_faststr()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestMultiExceptionArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(arg0) = arg0 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg0 is required".to_string(), + )); + }; + let Some(arg1) = arg1 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg1 is required".to_string(), + )); + }; + + let data = Self { arg0, arg1 }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut arg0 = None; + let mut arg1 = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + arg0 = Some(protocol.read_faststr().await?); + } + Some(2) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + arg1 = Some(protocol.read_faststr().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestMultiExceptionArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(arg0) = arg0 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg0 is required".to_string(), + ), + ); + }; + let Some(arg1) = arg1 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field arg1 is required".to_string(), + ), + ); + }; + + let data = Self { arg0, arg1 }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMultiExceptionArgsSend", + }) + protocol.faststr_field_len(Some(1), &self.arg0) + + protocol.faststr_field_len(Some(2), &self.arg1) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestNestResultSend { + #[derivative(Default)] + Ok(Xtruct2), + } + + impl ::pilota::thrift::Message for ThriftTestTestNestResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestNestResultSend", + })?; + match self { + ThriftTestTestNestResultSend::Ok(ref value) => { + protocol.write_struct_field(0, value, ::pilota::thrift::TType::Struct)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = Some(ThriftTestTestNestResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(ThriftTestTestNestResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestNestResultSend", + }) + match self { + ThriftTestTestNestResultSend::Ok(ref value) => { + protocol.struct_field_len(Some(0), value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, Default, Clone, PartialEq)] + pub struct MapType(pub ::pilota::AHashMap<::pilota::FastStr, Bonk>); + + impl ::std::ops::Deref for MapType { + type Target = ::pilota::AHashMap<::pilota::FastStr, Bonk>; + + fn deref(&self) -> &Self::Target { + &self.0 + } + } + + impl From<::pilota::AHashMap<::pilota::FastStr, Bonk>> for MapType { + fn from(v: ::pilota::AHashMap<::pilota::FastStr, Bonk>) -> Self { + Self(v) + } + } + + impl ::pilota::thrift::Message for MapType { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_map( + ::pilota::thrift::TType::Binary, + ::pilota::thrift::TType::Struct, + &(&**self), + |protocol, key| { + protocol.write_faststr((key).clone())?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_struct(val)?; + ::std::result::Result::Ok(()) + }, + )?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + ::std::result::Result::Ok(MapType({ + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_faststr()?, + ::pilota::thrift::Message::decode(protocol)?, + ); + } + protocol.read_map_end()?; + val + })) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + ::std::result::Result::Ok(MapType({ + let map_ident = protocol.read_map_begin().await?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_faststr().await?, + ::decode_async(protocol).await?, + ); + } + protocol.read_map_end().await?; + val + })) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.map_len( + ::pilota::thrift::TType::Binary, + ::pilota::thrift::TType::Struct, + &**self, + |protocol, key| protocol.faststr_len(key), + |protocol, val| protocol.struct_len(val), + ) + } + } + impl Default for OptionalBinary { + fn default() -> Self { + OptionalBinary { + bin_map: Some({ + let mut map = ::pilota::AHashMap::with_capacity(0); + + map + }), + } + } + } + #[derive(Debug, Clone, PartialEq)] + pub struct OptionalBinary { + pub bin_map: ::std::option::Option<::pilota::AHashMap<::pilota::Bytes, i32>>, + } + impl ::pilota::thrift::Message for OptionalBinary { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "OptionalBinary", + }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.bin_map.as_ref() { + protocol.write_map_field( + 2, + ::pilota::thrift::TType::Binary, + ::pilota::thrift::TType::I32, + &value, + |protocol, key| { + protocol.write_bytes(key.clone())?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_i32(*val)?; + ::std::result::Result::Ok(()) + }, + )?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut bin_map = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(2) if field_ident.field_type == ::pilota::thrift::TType::Map => { + bin_map = Some({ + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(protocol.read_bytes()?, protocol.read_i32()?); + } + protocol.read_map_end()?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `OptionalBinary` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + if bin_map.is_none() { + bin_map = Some({ + let mut map = ::pilota::AHashMap::with_capacity(0); + + map + }); + } + + let data = Self { bin_map }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut bin_map = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(2) + if field_ident.field_type == ::pilota::thrift::TType::Map => + { + bin_map = Some({ + let map_ident = protocol.read_map_begin().await?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_bytes().await?, + protocol.read_i32().await?, + ); + } + protocol.read_map_end().await?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `OptionalBinary` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + if bin_map.is_none() { + bin_map = Some({ + let mut map = ::pilota::AHashMap::with_capacity(0); + + map + }); + } + + let data = Self { bin_map }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "OptionalBinary", + }) + self.bin_map.as_ref().map_or(0, |value| { + protocol.map_field_len( + Some(2), + ::pilota::thrift::TType::Binary, + ::pilota::thrift::TType::I32, + value, + |protocol, key| protocol.bytes_len(key), + |protocol, val| protocol.i32_len(*val), + ) + }) + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestDoubleResultSend { + #[derivative(Default)] + Ok(f64), + } + + impl ::pilota::thrift::Message for ThriftTestTestDoubleResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestDoubleResultSend", + })?; + match self { + ThriftTestTestDoubleResultSend::Ok(ref value) => { + protocol.write_double_field(0, *value)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_double()?; + protocol.double_len(*&field_ident); + ret = Some(ThriftTestTestDoubleResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_double().await?; + + ret = Some(ThriftTestTestDoubleResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestDoubleResultSend", + }) + match self { + ThriftTestTestDoubleResultSend::Ok(ref value) => { + protocol.double_field_len(Some(0), *value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestOnewayArgsRecv { + pub seconds_to_sleep: i32, + } + impl ::pilota::thrift::Message for ThriftTestTestOnewayArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestOnewayArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_i32_field(1, *&self.seconds_to_sleep)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut seconds_to_sleep = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + seconds_to_sleep = Some(protocol.read_i32()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestOnewayArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(seconds_to_sleep) = seconds_to_sleep else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field seconds_to_sleep is required".to_string(), + )); + }; + + let data = Self { seconds_to_sleep }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut seconds_to_sleep = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + seconds_to_sleep = Some(protocol.read_i32().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestOnewayArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(seconds_to_sleep) = seconds_to_sleep else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field seconds_to_sleep is required".to_string(), + ), + ); + }; + + let data = Self { seconds_to_sleep }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestOnewayArgsRecv", + }) + protocol.i32_field_len(Some(1), *&self.seconds_to_sleep) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum ThriftTestTestBoolResultSend { + #[derivative(Default)] + Ok(bool), + } + + impl ::pilota::thrift::Message for ThriftTestTestBoolResultSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestBoolResultSend", + })?; + match self { + ThriftTestTestBoolResultSend::Ok(ref value) => { + protocol.write_bool_field(0, *value)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_bool()?; + protocol.bool_len(*&field_ident); + ret = Some(ThriftTestTestBoolResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(0) => { + if ret.is_none() { + let field_ident = protocol.read_bool().await?; + + ret = Some(ThriftTestTestBoolResultSend::Ok(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestBoolResultSend", + }) + match self { + ThriftTestTestBoolResultSend::Ok(ref value) => { + protocol.bool_field_len(Some(0), *value) + } + } + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum SomeUnion { + #[derivative(Default)] + MapThing(::pilota::AHashMap), + + StringThing(::pilota::FastStr), + + I32Thing(i32), + + XtructThing(Xtruct3), + + InsanityThing(Insanity), + } + + impl ::pilota::thrift::Message for SomeUnion { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { + name: "SomeUnion", + })?; + match self { + SomeUnion::MapThing(ref value) => { + protocol.write_map_field( + 1, + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I64, + &value, + |protocol, key| { + protocol.write_struct(key)?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_struct(val)?; + ::std::result::Result::Ok(()) + }, + )?; + } + SomeUnion::StringThing(ref value) => { + protocol.write_faststr_field(2, (value).clone())?; + } + SomeUnion::I32Thing(ref value) => { + protocol.write_i32_field(3, *value)?; + } + SomeUnion::XtructThing(ref value) => { + protocol.write_struct_field(4, value, ::pilota::thrift::TType::Struct)?; + } + SomeUnion::InsanityThing(ref value) => { + protocol.write_struct_field(5, value, ::pilota::thrift::TType::Struct)?; + } + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + let mut ret = None; + protocol.read_struct_begin()?; + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + match field_ident.id { + Some(1) => { + if ret.is_none() { + let field_ident = { + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + ::pilota::thrift::Message::decode(protocol)?, + ::pilota::thrift::Message::decode(protocol)?, + ); + } + protocol.read_map_end()?; + val + }; + protocol.map_len( + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I64, + &field_ident, + |protocol, key| protocol.struct_len(key), + |protocol, val| protocol.struct_len(val), + ); + ret = Some(SomeUnion::MapThing(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + Some(2) => { + if ret.is_none() { + let field_ident = protocol.read_faststr()?; + protocol.faststr_len(&field_ident); + ret = Some(SomeUnion::StringThing(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + Some(3) => { + if ret.is_none() { + let field_ident = protocol.read_i32()?; + protocol.i32_len(*&field_ident); + ret = Some(SomeUnion::I32Thing(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + Some(4) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = Some(SomeUnion::XtructThing(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + Some(5) => { + if ret.is_none() { + let field_ident = ::pilota::thrift::Message::decode(protocol)?; + protocol.struct_len(&field_ident); + ret = Some(SomeUnion::InsanityThing(field_ident)); + } else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message", + ), + ); + } + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + } + protocol.read_field_end()?; + protocol.read_struct_end()?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut ret = None; + protocol.read_struct_begin().await?; + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + match field_ident.id { + Some(1) => { + if ret.is_none() { + let field_ident = { + let map_ident = protocol.read_map_begin().await?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert(::decode_async(protocol).await?, ::decode_async(protocol).await?); + } + protocol.read_map_end().await?; + val + }; + + ret = Some(SomeUnion::MapThing(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + Some(2) => { + if ret.is_none() { + let field_ident = protocol.read_faststr().await?; + + ret = Some(SomeUnion::StringThing(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + Some(3) => { + if ret.is_none() { + let field_ident = protocol.read_i32().await?; + + ret = Some(SomeUnion::I32Thing(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + Some(4) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(SomeUnion::XtructThing(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + Some(5) => { + if ret.is_none() { + let field_ident = + ::decode_async( + protocol, + ) + .await?; + + ret = Some(SomeUnion::InsanityThing(field_ident)); + } else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received multiple fields for union from remote Message" + )); + } + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + } + protocol.read_field_end().await?; + protocol.read_struct_end().await?; + if let Some(ret) = ret { + ::std::result::Result::Ok(ret) + } else { + ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "received empty union from remote Message", + )) + } + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol + .struct_begin_len(&::pilota::thrift::TStructIdentifier { name: "SomeUnion" }) + + match self { + SomeUnion::MapThing(ref value) => protocol.map_field_len( + Some(1), + ::pilota::thrift::TType::I32, + ::pilota::thrift::TType::I64, + value, + |protocol, key| protocol.struct_len(key), + |protocol, val| protocol.struct_len(val), + ), + SomeUnion::StringThing(ref value) => { + protocol.faststr_field_len(Some(2), value) + } + SomeUnion::I32Thing(ref value) => protocol.i32_field_len(Some(3), *value), + SomeUnion::XtructThing(ref value) => { + protocol.struct_field_len(Some(4), value) + } + SomeUnion::InsanityThing(ref value) => { + protocol.struct_field_len(Some(5), value) + } + } + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestTypedefArgsSend { + pub thing: UserId, + } + impl ::pilota::thrift::Message for ThriftTestTestTypedefArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestTypedefArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_struct_field(1, &self.thing, ::pilota::thrift::TType::I64)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I64 => { + thing = Some(::pilota::thrift::Message::decode(protocol)?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestTypedefArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I64 => + { + thing = Some( + ::decode_async( + protocol, + ) + .await?, + ); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestTypedefArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestTypedefArgsSend", + }) + protocol.struct_field_len(Some(1), &self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct SecondServiceSecondtestStringArgsRecv { + pub thing: ::pilota::FastStr, + } + impl ::pilota::thrift::Message for SecondServiceSecondtestStringArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "SecondServiceSecondtestStringArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_faststr_field(1, (&self.thing).clone())?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + thing = Some(protocol.read_faststr()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `SecondServiceSecondtestStringArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + thing = Some(protocol.read_faststr().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `SecondServiceSecondtestStringArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "SecondServiceSecondtestStringArgsRecv", + }) + protocol.faststr_field_len(Some(1), &self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestStringMapArgsSend { + pub thing: ::pilota::AHashMap<::pilota::FastStr, ::pilota::FastStr>, + } + impl ::pilota::thrift::Message for ThriftTestTestStringMapArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStringMapArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_map_field( + 1, + ::pilota::thrift::TType::Binary, + ::pilota::thrift::TType::Binary, + &&self.thing, + |protocol, key| { + protocol.write_faststr((key).clone())?; + ::std::result::Result::Ok(()) + }, + |protocol, val| { + protocol.write_faststr((val).clone())?; + ::std::result::Result::Ok(()) + }, + )?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::Map => { + thing = Some({ + let map_ident = protocol.read_map_begin()?; + let mut val = ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_faststr()?, + protocol.read_faststr()?, + ); + } + protocol.read_map_end()?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestStringMapArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Map => + { + thing = Some({ + let map_ident = protocol.read_map_begin().await?; + let mut val = + ::pilota::AHashMap::with_capacity(map_ident.size); + for _ in 0..map_ident.size { + val.insert( + protocol.read_faststr().await?, + protocol.read_faststr().await?, + ); + } + protocol.read_map_end().await?; + val + }); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestStringMapArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestStringMapArgsSend", + }) + protocol.map_field_len( + Some(1), + ::pilota::thrift::TType::Binary, + ::pilota::thrift::TType::Binary, + &self.thing, + |protocol, key| protocol.faststr_len(key), + |protocol, val| protocol.faststr_len(val), + ) + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct Xception2 { + pub error_code: ::std::option::Option, + + pub struct_thing: ::std::option::Option, + } + impl ::pilota::thrift::Message for Xception2 { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { name: "Xception2" }; + + protocol.write_struct_begin(&struct_ident)?; + if let Some(value) = self.error_code.as_ref() { + protocol.write_i32_field(1, *value)?; + } + if let Some(value) = self.struct_thing.as_ref() { + protocol.write_struct_field(2, value, ::pilota::thrift::TType::Struct)?; + } + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut error_code = None; + let mut struct_thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + error_code = Some(protocol.read_i32()?); + } + Some(2) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + struct_thing = Some(::pilota::thrift::Message::decode(protocol)?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `Xception2` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let data = Self { + error_code, + struct_thing, + }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut error_code = None; + let mut struct_thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + error_code = Some(protocol.read_i32().await?); + } + Some(2) + if field_ident.field_type + == ::pilota::thrift::TType::Struct => + { + struct_thing = Some( + ::decode_async( + protocol, + ) + .await?, + ); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!( + "decode struct `Xception2` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let data = Self { + error_code, + struct_thing, + }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol + .struct_begin_len(&::pilota::thrift::TStructIdentifier { name: "Xception2" }) + + self + .error_code + .as_ref() + .map_or(0, |value| protocol.i32_field_len(Some(1), *value)) + + self + .struct_thing + .as_ref() + .map_or(0, |value| protocol.struct_field_len(Some(2), value)) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestUuidArgsSend { + pub thing: [u8; 16], + } + impl ::pilota::thrift::Message for ThriftTestTestUuidArgsSend { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestUuidArgsSend", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_uuid_field(1, *&self.thing)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::Uuid => { + thing = Some(protocol.read_uuid()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestUuidArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(thing) = thing else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + )); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut thing = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Uuid => + { + thing = Some(protocol.read_uuid().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestUuidArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(thing) = thing else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field thing is required".to_string(), + ), + ); + }; + + let data = Self { thing }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestUuidArgsSend", + }) + protocol.uuid_field_len(Some(1), *&self.thing) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct ThriftTestTestMapMapArgsRecv { + pub hello: i32, + } + impl ::pilota::thrift::Message for ThriftTestTestMapMapArgsRecv { + fn encode( + &self, + protocol: &mut T, + ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { + #[allow(unused_imports)] + use ::pilota::thrift::TOutputProtocolExt; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMapMapArgsRecv", + }; + + protocol.write_struct_begin(&struct_ident)?; + protocol.write_i32_field(1, *&self.hello)?; + protocol.write_field_stop()?; + protocol.write_struct_end()?; + ::std::result::Result::Ok(()) + } + + fn decode( + protocol: &mut T, + ) -> ::std::result::Result { + #[allow(unused_imports)] + use ::pilota::{thrift::TLengthProtocolExt, Buf}; + + let mut hello = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin()?; + if let ::std::result::Result::Err(mut err) = (|| { + loop { + let field_ident = protocol.read_field_begin()?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + protocol.field_stop_len(); + break; + } else { + protocol.field_begin_len(field_ident.field_type, field_ident.id); + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) if field_ident.field_type == ::pilota::thrift::TType::I32 => { + hello = Some(protocol.read_i32()?); + } + _ => { + protocol.skip(field_ident.field_type)?; + } + } + + protocol.read_field_end()?; + protocol.field_end_len(); + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestMapMapArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end()?; + + let Some(hello) = hello else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field hello is required".to_string(), + )); + }; + + let data = Self { hello }; + ::std::result::Result::Ok(data) + } + + fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( + protocol: &'a mut T, + ) -> ::std::pin::Pin< + ::std::boxed::Box< + dyn ::std::future::Future< + Output = ::std::result::Result, + > + Send + + 'a, + >, + > { + ::std::boxed::Box::pin(async move { + let mut hello = None; + + let mut __pilota_decoding_field_id = None; + + protocol.read_struct_begin().await?; + if let ::std::result::Result::Err(mut err) = async { + loop { + let field_ident = protocol.read_field_begin().await?; + if field_ident.field_type == ::pilota::thrift::TType::Stop { + break; + } else { + } + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::I32 => + { + hello = Some(protocol.read_i32().await?); + } + _ => { + protocol.skip(field_ident.field_type).await?; + } + } + + protocol.read_field_end().await?; + } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + } + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `ThriftTestTestMapMapArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + protocol.read_struct_end().await?; + + let Some(hello) = hello else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field hello is required".to_string(), + ), + ); + }; + + let data = Self { hello }; + ::std::result::Result::Ok(data) + }) + } + + fn size(&self, protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "ThriftTestTestMapMapArgsRecv", + }) + protocol.i32_field_len(Some(1), *&self.hello) + + protocol.field_stop_len() + + protocol.struct_end_len() + } + } + } +} diff --git a/pilota-build/test_data/thrift/apache.thrift b/pilota-build/test_data/thrift/apache.thrift new file mode 100644 index 00000000..8de93e4d --- /dev/null +++ b/pilota-build/test_data/thrift/apache.thrift @@ -0,0 +1,426 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * Contains some contributions under the Thrift Software License. + * Please see doc/old-thrift-license.txt in the Thrift distribution for + * details. + */ + +namespace c_glib TTest +namespace cpp thrift.test +namespace delphi Thrift.Test +namespace go thrifttest +namespace java thrift.test +namespace js ThriftTest +namespace lua ThriftTest +namespace netstd ThriftTest +namespace perl ThriftTest +namespace php ThriftTest +namespace py ThriftTest +namespace py.twisted ThriftTest +namespace rb Thrift.Test +namespace st ThriftTest +namespace xsd test (uri = 'http://thrift.apache.org/ns/ThriftTest') + +// Presence of namespaces and sub-namespaces for which there is +// no generator should compile with warnings only +// namespace noexist ThriftTest +// namespace cpp.noexist ThriftTest + +namespace * thrift.test + +/** + * Docstring! + */ +enum Numberz +{ + ONE = 1, + TWO, + THREE, + FIVE = 5, + SIX, + EIGHT = 8 +} + +const Numberz myNumberz = Numberz.ONE; +// the following is expected to fail: +// const Numberz urNumberz = ONE; + +typedef i64 UserId + +struct Bonk +{ + 1: string message, + 2: i32 type +} + +typedef map MapType + +struct Bools { + 1: bool im_true, + 2: bool im_false, +} + +struct Xtruct +{ + 1: string string_thing, + 4: i8 byte_thing, + 9: i32 i32_thing, + 11: i64 i64_thing +} + +struct Xtruct2 +{ + 1: i8 byte_thing, // used to be byte, hence the name + 2: Xtruct struct_thing, + 3: i32 i32_thing +} + +struct Xtruct3 +{ + 1: string string_thing, + 4: i32 changed, + 9: i32 i32_thing, + 11: i64 i64_thing +} + + +struct Insanity +{ + 1: map userMap, + 2: list xtructs +} (python.immutable= "") + +struct CrazyNesting { + 1: string string_field, + 2: optional set set_field, + // Do not insert line break as test/go/Makefile.am is removing this line with pattern match + 3: required list (python.immutable = ""), map(python.immutable = "")> (python.immutable = "")>>>> list_field, + 4: binary binary_field + 5: uuid uuid_field +} + +union SomeUnion { + 1: map map_thing, + 2: string string_thing, + 3: i32 i32_thing, + 4: Xtruct3 xtruct_thing, + 5: Insanity insanity_thing +} + +exception Xception { + 1: i32 errorCode, + 2: string message +} + +exception Xception2 { + 1: i32 errorCode, + 2: Xtruct struct_thing +} + +struct EmptyStruct {} + +struct OneField { + 1: EmptyStruct field +} + +service ThriftTest +{ + /** + * Prints "testVoid()" and returns nothing. + */ + void testVoid(), + + /** + * Prints 'testString("%s")' with thing as '%s' + * @param string thing - the string to print + * @return string - returns the string 'thing' + */ + string testString(1: string thing), + + /** + * Prints 'testBool("%s")' where '%s' with thing as 'true' or 'false' + * @param bool thing - the bool data to print + * @return bool - returns the bool 'thing' + */ + bool testBool(1: bool thing), + + /** + * Prints 'testByte("%d")' with thing as '%d' + * The types i8 and byte are synonyms, use of i8 is encouraged, byte still exists for the sake of compatibility. + * @param byte thing - the i8/byte to print + * @return i8 - returns the i8/byte 'thing' + */ + i8 testByte(1: i8 thing), + + /** + * Prints 'testI32("%d")' with thing as '%d' + * @param i32 thing - the i32 to print + * @return i32 - returns the i32 'thing' + */ + i32 testI32(1: i32 thing), + + /** + * Prints 'testI64("%d")' with thing as '%d' + * @param i64 thing - the i64 to print + * @return i64 - returns the i64 'thing' + */ + i64 testI64(1: i64 thing), + + /** + * Prints 'testDouble("%f")' with thing as '%f' + * @param double thing - the double to print + * @return double - returns the double 'thing' + */ + double testDouble(1: double thing), + + /** + * Prints 'testBinary("%s")' where '%s' is a hex-formatted string of thing's data + * @param binary thing - the binary data to print + * @return binary - returns the binary 'thing' + */ + binary testBinary(1: binary thing), + + /** + * Prints 'testUuid("%s")' where '%s' is the uuid given. Note that the uuid byte order should be correct. + * @param uuid thing - the uuid to print + * @return uuid - returns the uuid 'thing' + */ + uuid testUuid(1: uuid thing), + + /** + * Prints 'testStruct("{%s}")' where thing has been formatted into a string of comma separated values + * @param Xtruct thing - the Xtruct to print + * @return Xtruct - returns the Xtruct 'thing' + */ + Xtruct testStruct(1: Xtruct thing), + + /** + * Prints 'testNest("{%s}")' where thing has been formatted into a string of the nested struct + * @param Xtruct2 thing - the Xtruct2 to print + * @return Xtruct2 - returns the Xtruct2 'thing' + */ + Xtruct2 testNest(1: Xtruct2 thing), + + /** + * Prints 'testMap("{%s")' where thing has been formatted into a string of 'key => value' pairs + * separated by commas and new lines + * @param map thing - the map to print + * @return map - returns the map 'thing' + */ + map testMap(1: map thing), + + /** + * Prints 'testStringMap("{%s}")' where thing has been formatted into a string of 'key => value' pairs + * separated by commas and new lines + * @param map thing - the map to print + * @return map - returns the map 'thing' + */ + map testStringMap(1: map thing), + + /** + * Prints 'testSet("{%s}")' where thing has been formatted into a string of values + * separated by commas and new lines + * @param set thing - the set to print + * @return set - returns the set 'thing' + */ + set testSet(1: set thing), + + /** + * Prints 'testList("{%s}")' where thing has been formatted into a string of values + * separated by commas and new lines + * @param list thing - the list to print + * @return list - returns the list 'thing' + */ + list testList(1: list thing), + + /** + * Prints 'testEnum("%d")' where thing has been formatted into its numeric value + * @param Numberz thing - the Numberz to print + * @return Numberz - returns the Numberz 'thing' + */ + Numberz testEnum(1: Numberz thing), + + /** + * Prints 'testTypedef("%d")' with thing as '%d' + * @param UserId thing - the UserId to print + * @return UserId - returns the UserId 'thing' + */ + UserId testTypedef(1: UserId thing), + + /** + * Prints 'testMapMap("%d")' with hello as '%d' + * @param i32 hello - the i32 to print + * @return map> - returns a dictionary with these values: + * {-4 => {-4 => -4, -3 => -3, -2 => -2, -1 => -1, }, 4 => {1 => 1, 2 => 2, 3 => 3, 4 => 4, }, } + */ + map> testMapMap(1: i32 hello), + + /** + * So you think you've got this all worked out, eh? + * + * Creates a map with these values and prints it out: + * { 1 => { 2 => argument, + * 3 => argument, + * }, + * 2 => { 6 => , }, + * } + * @return map> - a map with the above values + */ + map> testInsanity(1: Insanity argument), + + /** + * Prints 'testMulti()' + * @param i8 arg0 - + * @param i32 arg1 - + * @param i64 arg2 - + * @param map arg3 - + * @param Numberz arg4 - + * @param UserId arg5 - + * @return Xtruct - returns an Xtruct with string_thing = "Hello2, byte_thing = arg0, i32_thing = arg1 + * and i64_thing = arg2 + */ + Xtruct testMulti(1: i8 arg0, 2: i32 arg1, 3: i64 arg2, 4: map arg3, 5: Numberz arg4, 6: UserId arg5), + + /** + * Print 'testException(%s)' with arg as '%s' + * @param string arg - a string indication what type of exception to throw + * if arg == "Xception" throw Xception with errorCode = 1001 and message = arg + * else if arg == "TException" throw TException + * else do not throw anything + */ + void testException(1: string arg) throws(1: Xception err1), + + /** + * Print 'testMultiException(%s, %s)' with arg0 as '%s' and arg1 as '%s' + * @param string arg - a string indicating what type of exception to throw + * if arg0 == "Xception" throw Xception with errorCode = 1001 and message = "This is an Xception" + * else if arg0 == "Xception2" throw Xception2 with errorCode = 2002 and struct_thing.string_thing = "This is an Xception2" + * else do not throw anything + * @return Xtruct - an Xtruct with string_thing = arg1 + */ + Xtruct testMultiException(1: string arg0, 2: string arg1) throws(1: Xception err1, 2: Xception2 err2) + + /** + * Print 'testOneway(%d): Sleeping...' with secondsToSleep as '%d' + * sleep 'secondsToSleep' + * Print 'testOneway(%d): done sleeping!' with secondsToSleep as '%d' + * @param i32 secondsToSleep - the number of seconds to sleep + */ + oneway void testOneway(1:i32 secondsToSleep) +} + +service SecondService +{ + /** + * Prints 'testString("%s")' with thing as '%s' + * @param string thing - the string to print + * @return string - returns the string 'thing' + */ + string secondtestString(1: string thing) +} + +struct VersioningTestV1 { + 1: i32 begin_in_both, + 3: string old_string, + 12: i32 end_in_both +} + +struct VersioningTestV2 { + 1: i32 begin_in_both, + + 2: i32 newint, + 3: i8 newbyte, + 4: i16 newshort, + 5: i64 newlong, + 6: double newdouble + 7: Bonk newstruct, + 8: list newlist, + 9: set newset, + 10: map newmap, + 11: string newstring, + 12: i32 end_in_both +} + +struct ListTypeVersioningV1 { + 1: list myints; + 2: string hello; +} + +struct ListTypeVersioningV2 { + 1: list strings; + 2: string hello; +} + +struct GuessProtocolStruct { + 7: map map_field, +} + +struct LargeDeltas { + 1: Bools b1, + 10: Bools b10, + 100: Bools b100, + 500: bool check_true, + 1000: Bools b1000, + 1500: bool check_false, + 2000: VersioningTestV2 vertwo2000, + 2500: set a_set2500, + 3000: VersioningTestV2 vertwo3000, + 4000: list big_numbers +} + +struct NestedListsI32x2 { + 1: list> integerlist +} +struct NestedListsI32x3 { + 1: list>> integerlist +} +struct NestedMixedx2 { + 1: list> int_set_list + 2: map> map_int_strset + 3: list>> map_int_strset_list +} +struct ListBonks { + 1: list bonk +} +struct NestedListsBonk { + 1: list>> bonk +} + +struct BoolTest { + 1: optional bool b = true; + 2: optional string s = "true"; +} + +struct StructA { + 1: required string s; +} + +struct StructB { + 1: optional StructA aa; + 2: required StructA ab; +} + +struct OptionalSetDefaultTest { + 1: optional set with_default = [ "test" ] +} + +struct OptionalBinary { +//1: optional set bin_set = [] + 2: optional map bin_map = {} +}