diff --git a/Cargo.lock b/Cargo.lock index 4fcf5fb4..5cc557a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -805,7 +805,7 @@ dependencies = [ [[package]] name = "pilota-build" -version = "0.11.18" +version = "0.11.19" dependencies = [ "ahash", "anyhow", diff --git a/pilota-build/Cargo.toml b/pilota-build/Cargo.toml index 7cd74b20..e5a8f9bd 100644 --- a/pilota-build/Cargo.toml +++ b/pilota-build/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pilota-build" -version = "0.11.18" +version = "0.11.19" edition = "2021" description = "Compile thrift and protobuf idl into rust code at compile-time." documentation = "https://docs.rs/pilota-build" diff --git a/pilota-build/src/parser/thrift/mod.rs b/pilota-build/src/parser/thrift/mod.rs index 17a16a14..8deadd9d 100644 --- a/pilota-build/src/parser/thrift/mod.rs +++ b/pilota-build/src/parser/thrift/mod.rs @@ -226,12 +226,8 @@ impl ThriftLower { result.push(self.mk_item(kind, tags.into())); if !exception.is_empty() { - let name: Ident = format!( - "{}{}Exception", - service.name.to_upper_camel_case().as_str(), - method_name - ) - .into(); + let name: Ident = + format!("{}{}Exception", service.name.as_str(), method_name).into(); let kind = ir::ItemKind::Enum(ir::Enum { name: name.clone(), variants: exception, @@ -243,12 +239,7 @@ impl ThriftLower { result.push(self.mk_item(kind, tags.into())); } - let name: Ident = format!( - "{}{}ArgsSend", - service.name.to_upper_camel_case().as_str(), - method_name - ) - .into(); + let name: Ident = format!("{}{}ArgsSend", service.name.as_str(), method_name).into(); let kind = ir::ItemKind::Message(ir::Message { name: name.clone(), fields: f.arguments.iter().map(|a| self.lower_field(a)).collect(), @@ -258,12 +249,7 @@ impl ThriftLower { tags.insert(crate::tags::KeepUnknownFields(false)); result.push(self.mk_item(kind, tags.into())); - let name: Ident = format!( - "{}{}ArgsRecv", - service.name.to_upper_camel_case().as_str(), - method_name - ) - .into(); + let name: Ident = format!("{}{}ArgsRecv", service.name.as_str(), method_name).into(); let kind = ir::ItemKind::Message(ir::Message { name: name.clone(), fields: f diff --git a/pilota-build/test_data/thrift/auto_name.rs b/pilota-build/test_data/thrift/auto_name.rs index 1819ddc5..960648fa 100644 --- a/pilota-build/test_data/thrift/auto_name.rs +++ b/pilota-build/test_data/thrift/auto_name.rs @@ -155,30 +155,23 @@ pub mod auto_name { + __protocol.struct_end_len() } } - pub trait TestService {} - #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] - #[derivative(Default)] - #[derive(Clone, PartialEq)] - pub enum TestServiceTestResultRecv { - #[derivative(Default)] - Ok(Test), + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct testServiceTest2ArgsRecv { + pub self_: TEST, } - - impl ::pilota::thrift::Message for TestServiceTestResultRecv { + impl ::pilota::thrift::Message for testServiceTest2ArgsRecv { 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: "TestServiceTestResultRecv", - })?; - match self { - TestServiceTestResultRecv::Ok(ref value) => { - __protocol.write_struct_field(0, value, ::pilota::thrift::TType::Struct)?; - } - } + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "testServiceTest2ArgsRecv", + }; + + __protocol.write_struct_begin(&struct_ident)?; + __protocol.write_struct_field(1, &self.self_, ::pilota::thrift::TType::Struct)?; __protocol.write_field_stop()?; __protocol.write_struct_end()?; ::std::result::Result::Ok(()) @@ -189,46 +182,54 @@ pub mod auto_name { ) -> ::std::result::Result { #[allow(unused_imports)] use ::pilota::{thrift::TLengthProtocolExt, Buf}; - let mut ret = None; + + let mut var_1 = None; + + let mut __pilota_decoding_field_id = 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(TestServiceTestResultRecv::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", - ), - ); - } + 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); } - _ => { - __protocol.skip(field_ident.field_type)?; + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + var_1 = Some(::pilota::thrift::Message::decode(__protocol)?); + } + _ => { + __protocol.skip(field_ident.field_type)?; + } } + + __protocol.read_field_end()?; + __protocol.field_end_len(); } - } - __protocol.read_field_end()?; + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `testServiceTest2ArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; __protocol.read_struct_end()?; - if let Some(ret) = ret { - ::std::result::Result::Ok(ret) - } else { - ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + + let Some(var_1) = var_1 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "received empty union from remote Message", - )) - } + "field self_ is required".to_string(), + )); + }; + + let data = Self { self_: var_1 }; + ::std::result::Result::Ok(data) } fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( @@ -242,46 +243,60 @@ pub mod auto_name { >, > { ::std::boxed::Box::pin(async move { - let mut ret = None; + let mut var_1 = None; + + let mut __pilota_decoding_field_id = 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( + 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 => + { + var_1 = Some( + ::decode_async( __protocol, ) - .await?; - - ret = Some(TestServiceTestResultRecv::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" - )); + .await?, + ); + } + _ => { + __protocol.skip(field_ident.field_type).await?; } } - _ => { - __protocol.skip(field_ident.field_type).await?; - } + + __protocol.read_field_end().await?; } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) } - __protocol.read_field_end().await?; + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `testServiceTest2ArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; __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", - )) - } + + let Some(var_1) = var_1 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field self_ is required".to_string(), + ), + ); + }; + + let data = Self { self_: var_1 }; + ::std::result::Result::Ok(data) }) } @@ -289,38 +304,29 @@ pub mod auto_name { #[allow(unused_imports)] use ::pilota::thrift::TLengthProtocolExt; __protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { - name: "TestServiceTestResultRecv", - }) + match self { - TestServiceTestResultRecv::Ok(ref value) => { - __protocol.struct_field_len(Some(0), value) - } - } + __protocol.field_stop_len() + name: "testServiceTest2ArgsRecv", + }) + __protocol.struct_field_len(Some(1), &self.self_) + + __protocol.field_stop_len() + __protocol.struct_end_len() } } - #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] - #[derivative(Default)] - #[derive(Clone, PartialEq)] - pub enum TestServicetestResultRecv { - #[derivative(Default)] - Ok(Test), + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct testServiceTestArgsRecv { + pub req: TEST, } - - impl ::pilota::thrift::Message for TestServicetestResultRecv { + impl ::pilota::thrift::Message for testServiceTestArgsRecv { 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: "TestServicetestResultRecv", - })?; - match self { - TestServicetestResultRecv::Ok(ref value) => { - __protocol.write_struct_field(0, value, ::pilota::thrift::TType::Struct)?; - } - } + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "testServiceTestArgsRecv", + }; + + __protocol.write_struct_begin(&struct_ident)?; + __protocol.write_struct_field(1, &self.req, ::pilota::thrift::TType::Struct)?; __protocol.write_field_stop()?; __protocol.write_struct_end()?; ::std::result::Result::Ok(()) @@ -331,46 +337,2508 @@ pub mod auto_name { ) -> ::std::result::Result { #[allow(unused_imports)] use ::pilota::{thrift::TLengthProtocolExt, Buf}; - let mut ret = None; + + let mut var_1 = None; + + let mut __pilota_decoding_field_id = 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(TestServicetestResultRecv::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", - ), - ); - } + 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); } - _ => { - __protocol.skip(field_ident.field_type)?; + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + var_1 = Some(::pilota::thrift::Message::decode(__protocol)?); + } + _ => { + __protocol.skip(field_ident.field_type)?; + } } + + __protocol.read_field_end()?; + __protocol.field_end_len(); } - } - __protocol.read_field_end()?; - __protocol.read_struct_end()?; - if let Some(ret) = ret { - ::std::result::Result::Ok(ret) + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `testServiceTestArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + __protocol.read_struct_end()?; + + let Some(var_1) = var_1 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field req is required".to_string(), + )); + }; + + let data = Self { req: var_1 }; + ::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 var_1 = 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 => + { + var_1 = 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 `testServiceTestArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + __protocol.read_struct_end().await?; + + let Some(var_1) = var_1 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field req is required".to_string(), + ), + ); + }; + + let data = Self { req: var_1 }; + ::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: "testServiceTestArgsRecv", + }) + __protocol.struct_field_len(Some(1), &self.req) + + __protocol.field_stop_len() + + __protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct testServicetestArgsRecv { + pub req: TEST, + } + impl ::pilota::thrift::Message for testServicetestArgsRecv { + 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: "testServicetestArgsRecv", + }; + + __protocol.write_struct_begin(&struct_ident)?; + __protocol.write_struct_field(1, &self.req, ::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 var_1 = 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 => + { + var_1 = 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 `testServicetestArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + __protocol.read_struct_end()?; + + let Some(var_1) = var_1 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field req is required".to_string(), + )); + }; + + let data = Self { req: var_1 }; + ::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 var_1 = 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 => + { + var_1 = 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 `testServicetestArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + __protocol.read_struct_end().await?; + + let Some(var_1) = var_1 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field req is required".to_string(), + ), + ); + }; + + let data = Self { req: var_1 }; + ::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: "testServicetestArgsRecv", + }) + __protocol.struct_field_len(Some(1), &self.req) + + __protocol.field_stop_len() + + __protocol.struct_end_len() + } + } + pub trait TestService {} + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum TestServiceTest2ResultRecv { + #[derivative(Default)] + Ok(Test), + } + + impl ::pilota::thrift::Message for TestServiceTest2ResultRecv { + 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: "TestServiceTest2ResultRecv", + })?; + match self { + TestServiceTest2ResultRecv::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(TestServiceTest2ResultRecv::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(TestServiceTest2ResultRecv::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: "TestServiceTest2ResultRecv", + }) + match self { + TestServiceTest2ResultRecv::Ok(ref value) => { + __protocol.struct_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 TestServiceTestResultRecv { + #[derivative(Default)] + Ok(Test), + } + + impl ::pilota::thrift::Message for TestServiceTestResultRecv { + 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: "TestServiceTestResultRecv", + })?; + match self { + TestServiceTestResultRecv::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(TestServiceTestResultRecv::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(TestServiceTestResultRecv::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: "TestServiceTestResultRecv", + }) + match self { + TestServiceTestResultRecv::Ok(ref value) => { + __protocol.struct_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 TestServicetestResultRecv { + #[derivative(Default)] + Ok(Test), + } + + impl ::pilota::thrift::Message for TestServicetestResultRecv { + 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: "TestServicetestResultRecv", + })?; + match self { + TestServicetestResultRecv::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(TestServicetestResultRecv::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(TestServicetestResultRecv::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: "TestServicetestResultRecv", + }) + match self { + TestServicetestResultRecv::Ok(ref value) => { + __protocol.struct_field_len(Some(0), value) + } + } + __protocol.field_stop_len() + + __protocol.struct_end_len() + } + } + pub const ip: &'static str = "ip"; + pub trait testService {} + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum testServiceTest2ResultRecv { + #[derivative(Default)] + Ok(Test), + } + + impl ::pilota::thrift::Message for testServiceTest2ResultRecv { + 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: "testServiceTest2ResultRecv", + })?; + match self { + testServiceTest2ResultRecv::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(testServiceTest2ResultRecv::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(testServiceTest2ResultRecv::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: "testServiceTest2ResultRecv", + }) + match self { + testServiceTest2ResultRecv::Ok(ref value) => { + __protocol.struct_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 testServiceTestResultRecv { + #[derivative(Default)] + Ok(Test), + } + + impl ::pilota::thrift::Message for testServiceTestResultRecv { + 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: "testServiceTestResultRecv", + })?; + match self { + testServiceTestResultRecv::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(testServiceTestResultRecv::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(testServiceTestResultRecv::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: "testServiceTestResultRecv", + }) + match self { + testServiceTestResultRecv::Ok(ref value) => { + __protocol.struct_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 testServicetestResultRecv { + #[derivative(Default)] + Ok(Test), + } + + impl ::pilota::thrift::Message for testServicetestResultRecv { + 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: "testServicetestResultRecv", + })?; + match self { + testServicetestResultRecv::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(testServicetestResultRecv::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(testServicetestResultRecv::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: "testServicetestResultRecv", + }) + match self { + testServicetestResultRecv::Ok(ref value) => { + __protocol.struct_field_len(Some(0), value) + } + } + __protocol.field_stop_len() + + __protocol.struct_end_len() + } + } + pub const IP: &'static str = "IP"; + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum TestServiceTest2ResultSend { + #[derivative(Default)] + Ok(Test), + } + + impl ::pilota::thrift::Message for TestServiceTest2ResultSend { + 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: "TestServiceTest2ResultSend", + })?; + match self { + TestServiceTest2ResultSend::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(TestServiceTest2ResultSend::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(TestServiceTest2ResultSend::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: "TestServiceTest2ResultSend", + }) + match self { + TestServiceTest2ResultSend::Ok(ref value) => { + __protocol.struct_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 TestServiceTestResultSend { + #[derivative(Default)] + Ok(Test), + } + + impl ::pilota::thrift::Message for TestServiceTestResultSend { + 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: "TestServiceTestResultSend", + })?; + match self { + TestServiceTestResultSend::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(TestServiceTestResultSend::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(TestServiceTestResultSend::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: "TestServiceTestResultSend", + }) + match self { + TestServiceTestResultSend::Ok(ref value) => { + __protocol.struct_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 TestServicetestResultSend { + #[derivative(Default)] + Ok(Test), + } + + impl ::pilota::thrift::Message for TestServicetestResultSend { + 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: "TestServicetestResultSend", + })?; + match self { + TestServicetestResultSend::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(TestServicetestResultSend::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(TestServicetestResultSend::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: "TestServicetestResultSend", + }) + match self { + TestServicetestResultSend::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 Test { + pub ID: ::pilota::FastStr, + + pub Id: ::pilota::FastStr, + } + impl ::pilota::thrift::Message for Test { + 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: "Test" }; + + __protocol.write_struct_begin(&struct_ident)?; + __protocol.write_faststr_field(1, (&self.ID).clone())?; + __protocol.write_faststr_field(2, (&self.Id).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 var_1 = None; + let mut var_2 = 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 => + { + var_1 = Some(__protocol.read_faststr()?); + } + Some(2) + if field_ident.field_type == ::pilota::thrift::TType::Binary => + { + var_2 = 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 `Test` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + __protocol.read_struct_end()?; + + let Some(var_1) = var_1 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field ID is required".to_string(), + )); + }; + let Some(var_2) = var_2 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field Id is required".to_string(), + )); + }; + + let data = Self { + ID: var_1, + Id: var_2, + }; + ::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 var_1 = None; + let mut var_2 = 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 => + { + var_1 = Some(__protocol.read_faststr().await?); + } + Some(2) + if field_ident.field_type + == ::pilota::thrift::TType::Binary => + { + var_2 = 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 `Test` field(#{}) failed, caused by: ", + field_id + )); + } + return ::std::result::Result::Err(err); + }; + __protocol.read_struct_end().await?; + + let Some(var_1) = var_1 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field ID is required".to_string(), + ), + ); + }; + let Some(var_2) = var_2 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field Id is required".to_string(), + ), + ); + }; + + let data = Self { + ID: var_1, + Id: var_2, + }; + ::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: "Test" }) + + __protocol.faststr_field_len(Some(1), &self.ID) + + __protocol.faststr_field_len(Some(2), &self.Id) + + __protocol.field_stop_len() + + __protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] + #[derivative(Default)] + #[derive(Clone, PartialEq)] + pub enum testServiceTest2ResultSend { + #[derivative(Default)] + Ok(Test), + } + + impl ::pilota::thrift::Message for testServiceTest2ResultSend { + 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: "testServiceTest2ResultSend", + })?; + match self { + testServiceTest2ResultSend::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(testServiceTest2ResultSend::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(testServiceTest2ResultSend::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: "testServiceTest2ResultSend", + }) + match self { + testServiceTest2ResultSend::Ok(ref value) => { + __protocol.struct_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 testServiceTestResultSend { + #[derivative(Default)] + Ok(Test), + } + + impl ::pilota::thrift::Message for testServiceTestResultSend { + 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: "testServiceTestResultSend", + })?; + match self { + testServiceTestResultSend::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(testServiceTestResultSend::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(testServiceTestResultSend::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: "testServiceTestResultSend", + }) + match self { + testServiceTestResultSend::Ok(ref value) => { + __protocol.struct_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 testServicetestResultSend { + #[derivative(Default)] + Ok(Test), + } + + impl ::pilota::thrift::Message for testServicetestResultSend { + 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: "testServicetestResultSend", + })?; + match self { + testServicetestResultSend::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(testServicetestResultSend::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", - )) - } + "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(testServicetestResultSend::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: "testServicetestResultSend", + }) + match self { + testServicetestResultSend::Ok(ref value) => { + __protocol.struct_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, Copy)] + #[repr(transparent)] + pub struct Index(i32); + + impl Index { + pub const A: Self = Self(0); + pub const a: Self = Self(1); + + pub fn inner(&self) -> i32 { + self.0 + } + + pub fn to_string(&self) -> ::std::string::String { + match self { + Self(0) => ::std::string::String::from("A"), + Self(1) => ::std::string::String::from("a"), + Self(val) => val.to_string(), + } + } + } + + impl ::std::convert::From for Index { + fn from(value: i32) -> Self { + Self(value) + } + } + + impl ::std::convert::From for i32 { + fn from(value: Index) -> i32 { + value.0 + } + } + + impl ::pilota::thrift::Message for Index { + 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 Index, 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 Index, value: {}", value), + ) + }, + )?) + }) + } + + fn size(&self, __protocol: &mut T) -> usize { + #[allow(unused_imports)] + use ::pilota::thrift::TLengthProtocolExt; + __protocol.i32_len(self.inner()) + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct TestServiceTest2ArgsSend { + pub r#type: TEST, + } + impl ::pilota::thrift::Message for TestServiceTest2ArgsSend { + 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: "TestServiceTest2ArgsSend", + }; + + __protocol.write_struct_begin(&struct_ident)?; + __protocol.write_struct_field(1, &self.r#type, ::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 var_1 = 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 => + { + var_1 = 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 `TestServiceTest2ArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + __protocol.read_struct_end()?; + + let Some(var_1) = var_1 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field r#type is required".to_string(), + )); + }; + + let data = Self { r#type: var_1 }; + ::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 var_1 = 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 => + { + var_1 = 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 `TestServiceTest2ArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + __protocol.read_struct_end().await?; + + let Some(var_1) = var_1 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field r#type is required".to_string(), + ), + ); + }; + + let data = Self { r#type: var_1 }; + ::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: "TestServiceTest2ArgsSend", + }) + __protocol.struct_field_len(Some(1), &self.r#type) + + __protocol.field_stop_len() + + __protocol.struct_end_len() + } + } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct TestServiceTestArgsSend { + pub req: TEST, + } + impl ::pilota::thrift::Message for TestServiceTestArgsSend { + 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: "TestServiceTestArgsSend", + }; + + __protocol.write_struct_begin(&struct_ident)?; + __protocol.write_struct_field(1, &self.req, ::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 var_1 = 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 => + { + var_1 = 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 `TestServiceTestArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + __protocol.read_struct_end()?; + + let Some(var_1) = var_1 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field req is required".to_string(), + )); + }; + + let data = Self { req: var_1 }; + ::std::result::Result::Ok(data) } fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( @@ -384,46 +2852,60 @@ pub mod auto_name { >, > { ::std::boxed::Box::pin(async move { - let mut ret = None; + let mut var_1 = None; + + let mut __pilota_decoding_field_id = 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( + 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 => + { + var_1 = Some( + ::decode_async( __protocol, ) - .await?; - - ret = Some(TestServicetestResultRecv::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" - )); + .await?, + ); + } + _ => { + __protocol.skip(field_ident.field_type).await?; } } - _ => { - __protocol.skip(field_ident.field_type).await?; - } + + __protocol.read_field_end().await?; } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) } - __protocol.read_field_end().await?; + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `TestServiceTestArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; __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", - )) - } + + let Some(var_1) = var_1 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field req is required".to_string(), + ), + ); + }; + + let data = Self { req: var_1 }; + ::std::result::Result::Ok(data) }) } @@ -431,58 +2913,31 @@ pub mod auto_name { #[allow(unused_imports)] use ::pilota::thrift::TLengthProtocolExt; __protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { - name: "TestServicetestResultRecv", - }) + match self { - TestServicetestResultRecv::Ok(ref value) => { - __protocol.struct_field_len(Some(0), value) - } - } + __protocol.field_stop_len() + name: "TestServiceTestArgsSend", + }) + __protocol.struct_field_len(Some(1), &self.req) + + __protocol.field_stop_len() + __protocol.struct_end_len() } } - #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] - #[derivative(Default)] - #[derive(Clone, PartialEq, Copy)] - #[repr(transparent)] - pub struct Index(i32); - - impl Index { - pub const A: Self = Self(0); - pub const a: Self = Self(1); - - pub fn inner(&self) -> i32 { - self.0 - } - - pub fn to_string(&self) -> ::std::string::String { - match self { - Self(0) => ::std::string::String::from("A"), - Self(1) => ::std::string::String::from("a"), - Self(val) => val.to_string(), - } - } - } - - impl ::std::convert::From for Index { - fn from(value: i32) -> Self { - Self(value) - } - } - - impl ::std::convert::From for i32 { - fn from(value: Index) -> i32 { - value.0 - } + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct TestServicetestArgsSend { + pub req: TEST, } - - impl ::pilota::thrift::Message for Index { + impl ::pilota::thrift::Message for TestServicetestArgsSend { fn encode( &self, __protocol: &mut T, ) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { #[allow(unused_imports)] use ::pilota::thrift::TOutputProtocolExt; - __protocol.write_i32(self.inner())?; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "TestServicetestArgsSend", + }; + + __protocol.write_struct_begin(&struct_ident)?; + __protocol.write_struct_field(1, &self.req, ::pilota::thrift::TType::Struct)?; + __protocol.write_field_stop()?; + __protocol.write_struct_end()?; ::std::result::Result::Ok(()) } @@ -491,15 +2946,54 @@ pub mod auto_name { ) -> ::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 Index, value: {}", value), - ) - }, - )?) + + let mut var_1 = 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 => + { + var_1 = 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 `TestServicetestArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + __protocol.read_struct_end()?; + + let Some(var_1) = var_1 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field req is required".to_string(), + )); + }; + + let data = Self { req: var_1 }; + ::std::result::Result::Ok(data) } fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( @@ -513,30 +3007,78 @@ pub mod auto_name { >, > { ::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| { + let mut var_1 = 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 => + { + var_1 = 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 `TestServicetestArgsSend` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; + __protocol.read_struct_end().await?; + + let Some(var_1) = var_1 else { + return ::std::result::Result::Err( ::pilota::thrift::new_protocol_exception( ::pilota::thrift::ProtocolExceptionKind::InvalidData, - format!("invalid enum value for Index, value: {}", value), - ) - }, - )?) + "field req is required".to_string(), + ), + ); + }; + + let data = Self { req: var_1 }; + ::std::result::Result::Ok(data) }) } fn size(&self, __protocol: &mut T) -> usize { #[allow(unused_imports)] use ::pilota::thrift::TLengthProtocolExt; - __protocol.i32_len(self.inner()) + __protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "TestServicetestArgsSend", + }) + __protocol.struct_field_len(Some(1), &self.req) + + __protocol.field_stop_len() + + __protocol.struct_end_len() } } - pub const ip: &'static str = "ip"; #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] - pub struct TestServiceTestArgsSend { - pub req: TEST, + pub struct testServiceTest2ArgsSend { + pub self_: TEST, } - impl ::pilota::thrift::Message for TestServiceTestArgsSend { + impl ::pilota::thrift::Message for testServiceTest2ArgsSend { fn encode( &self, __protocol: &mut T, @@ -544,11 +3086,11 @@ pub mod auto_name { #[allow(unused_imports)] use ::pilota::thrift::TOutputProtocolExt; let struct_ident = ::pilota::thrift::TStructIdentifier { - name: "TestServiceTestArgsSend", + name: "testServiceTest2ArgsSend", }; __protocol.write_struct_begin(&struct_ident)?; - __protocol.write_struct_field(1, &self.req, ::pilota::thrift::TType::Struct)?; + __protocol.write_struct_field(1, &self.self_, ::pilota::thrift::TType::Struct)?; __protocol.write_field_stop()?; __protocol.write_struct_end()?; ::std::result::Result::Ok(()) @@ -592,7 +3134,7 @@ pub mod auto_name { ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) })() { if let Some(field_id) = __pilota_decoding_field_id { - err.prepend_msg(&format!("decode struct `TestServiceTestArgsSend` field(#{}) failed, caused by: ", field_id)); + err.prepend_msg(&format!("decode struct `testServiceTest2ArgsSend` field(#{}) failed, caused by: ", field_id)); } return ::std::result::Result::Err(err); }; @@ -601,11 +3143,11 @@ pub mod auto_name { let Some(var_1) = var_1 else { return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field req is required".to_string(), + "field self_ is required".to_string(), )); }; - let data = Self { req: var_1 }; + let data = Self { self_: var_1 }; ::std::result::Result::Ok(data) } @@ -657,7 +3199,7 @@ pub mod auto_name { .await { if let Some(field_id) = __pilota_decoding_field_id { - err.prepend_msg(&format!("decode struct `TestServiceTestArgsSend` field(#{}) failed, caused by: ", field_id)); + err.prepend_msg(&format!("decode struct `testServiceTest2ArgsSend` field(#{}) failed, caused by: ", field_id)); } return ::std::result::Result::Err(err); }; @@ -667,12 +3209,12 @@ pub mod auto_name { return ::std::result::Result::Err( ::pilota::thrift::new_protocol_exception( ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field req is required".to_string(), + "field self_ is required".to_string(), ), ); }; - let data = Self { req: var_1 }; + let data = Self { self_: var_1 }; ::std::result::Result::Ok(data) }) } @@ -681,17 +3223,17 @@ pub mod auto_name { #[allow(unused_imports)] use ::pilota::thrift::TLengthProtocolExt; __protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { - name: "TestServiceTestArgsSend", - }) + __protocol.struct_field_len(Some(1), &self.req) + name: "testServiceTest2ArgsSend", + }) + __protocol.struct_field_len(Some(1), &self.self_) + __protocol.field_stop_len() + __protocol.struct_end_len() } } #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] - pub struct TestServicetestArgsSend { + pub struct testServiceTestArgsSend { pub req: TEST, } - impl ::pilota::thrift::Message for TestServicetestArgsSend { + impl ::pilota::thrift::Message for testServiceTestArgsSend { fn encode( &self, __protocol: &mut T, @@ -699,7 +3241,7 @@ pub mod auto_name { #[allow(unused_imports)] use ::pilota::thrift::TOutputProtocolExt; let struct_ident = ::pilota::thrift::TStructIdentifier { - name: "TestServicetestArgsSend", + name: "testServiceTestArgsSend", }; __protocol.write_struct_begin(&struct_ident)?; @@ -747,7 +3289,7 @@ pub mod auto_name { ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) })() { if let Some(field_id) = __pilota_decoding_field_id { - err.prepend_msg(&format!("decode struct `TestServicetestArgsSend` field(#{}) failed, caused by: ", field_id)); + err.prepend_msg(&format!("decode struct `testServiceTestArgsSend` field(#{}) failed, caused by: ", field_id)); } return ::std::result::Result::Err(err); }; @@ -812,7 +3354,7 @@ pub mod auto_name { .await { if let Some(field_id) = __pilota_decoding_field_id { - err.prepend_msg(&format!("decode struct `TestServicetestArgsSend` field(#{}) failed, caused by: ", field_id)); + err.prepend_msg(&format!("decode struct `testServiceTestArgsSend` field(#{}) failed, caused by: ", field_id)); } return ::std::result::Result::Err(err); }; @@ -836,18 +3378,17 @@ pub mod auto_name { #[allow(unused_imports)] use ::pilota::thrift::TLengthProtocolExt; __protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { - name: "TestServicetestArgsSend", + name: "testServiceTestArgsSend", }) + __protocol.struct_field_len(Some(1), &self.req) + __protocol.field_stop_len() + __protocol.struct_end_len() } } - pub const IP: &'static str = "IP"; #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] - pub struct TestServiceTestArgsRecv { + pub struct testServicetestArgsSend { pub req: TEST, } - impl ::pilota::thrift::Message for TestServiceTestArgsRecv { + impl ::pilota::thrift::Message for testServicetestArgsSend { fn encode( &self, __protocol: &mut T, @@ -855,7 +3396,7 @@ pub mod auto_name { #[allow(unused_imports)] use ::pilota::thrift::TOutputProtocolExt; let struct_ident = ::pilota::thrift::TStructIdentifier { - name: "TestServiceTestArgsRecv", + name: "testServicetestArgsSend", }; __protocol.write_struct_begin(&struct_ident)?; @@ -903,7 +3444,7 @@ pub mod auto_name { ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) })() { if let Some(field_id) = __pilota_decoding_field_id { - err.prepend_msg(&format!("decode struct `TestServiceTestArgsRecv` field(#{}) failed, caused by: ", field_id)); + err.prepend_msg(&format!("decode struct `testServicetestArgsSend` field(#{}) failed, caused by: ", field_id)); } return ::std::result::Result::Err(err); }; @@ -968,7 +3509,7 @@ pub mod auto_name { .await { if let Some(field_id) = __pilota_decoding_field_id { - err.prepend_msg(&format!("decode struct `TestServiceTestArgsRecv` field(#{}) failed, caused by: ", field_id)); + err.prepend_msg(&format!("decode struct `testServicetestArgsSend` field(#{}) failed, caused by: ", field_id)); } return ::std::result::Result::Err(err); }; @@ -992,35 +3533,29 @@ pub mod auto_name { #[allow(unused_imports)] use ::pilota::thrift::TLengthProtocolExt; __protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { - name: "TestServiceTestArgsRecv", + name: "testServicetestArgsSend", }) + __protocol.struct_field_len(Some(1), &self.req) + __protocol.field_stop_len() + __protocol.struct_end_len() } } - #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] - #[derivative(Default)] - #[derive(Clone, PartialEq)] - pub enum TestServiceTestResultSend { - #[derivative(Default)] - Ok(Test), + #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] + pub struct TestServiceTest2ArgsRecv { + pub r#type: TEST, } - - impl ::pilota::thrift::Message for TestServiceTestResultSend { + impl ::pilota::thrift::Message for TestServiceTest2ArgsRecv { 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: "TestServiceTestResultSend", - })?; - match self { - TestServiceTestResultSend::Ok(ref value) => { - __protocol.write_struct_field(0, value, ::pilota::thrift::TType::Struct)?; - } - } + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "TestServiceTest2ArgsRecv", + }; + + __protocol.write_struct_begin(&struct_ident)?; + __protocol.write_struct_field(1, &self.r#type, ::pilota::thrift::TType::Struct)?; __protocol.write_field_stop()?; __protocol.write_struct_end()?; ::std::result::Result::Ok(()) @@ -1031,46 +3566,54 @@ pub mod auto_name { ) -> ::std::result::Result { #[allow(unused_imports)] use ::pilota::{thrift::TLengthProtocolExt, Buf}; - let mut ret = None; + + let mut var_1 = None; + + let mut __pilota_decoding_field_id = 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(TestServiceTestResultSend::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", - ), - ); - } + 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); } - _ => { - __protocol.skip(field_ident.field_type)?; + __pilota_decoding_field_id = field_ident.id; + match field_ident.id { + Some(1) + if field_ident.field_type == ::pilota::thrift::TType::Struct => + { + var_1 = Some(::pilota::thrift::Message::decode(__protocol)?); + } + _ => { + __protocol.skip(field_ident.field_type)?; + } } + + __protocol.read_field_end()?; + __protocol.field_end_len(); } - } - __protocol.read_field_end()?; + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) + })() { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `TestServiceTest2ArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; __protocol.read_struct_end()?; - if let Some(ret) = ret { - ::std::result::Result::Ok(ret) - } else { - ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( + + let Some(var_1) = var_1 else { + return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "received empty union from remote Message", - )) - } + "field r#type is required".to_string(), + )); + }; + + let data = Self { r#type: var_1 }; + ::std::result::Result::Ok(data) } fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( @@ -1084,46 +3627,60 @@ pub mod auto_name { >, > { ::std::boxed::Box::pin(async move { - let mut ret = None; + let mut var_1 = None; + + let mut __pilota_decoding_field_id = 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( + 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 => + { + var_1 = Some( + ::decode_async( __protocol, ) - .await?; - - ret = Some(TestServiceTestResultSend::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" - )); + .await?, + ); + } + _ => { + __protocol.skip(field_ident.field_type).await?; } } - _ => { - __protocol.skip(field_ident.field_type).await?; - } + + __protocol.read_field_end().await?; } + ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) } - __protocol.read_field_end().await?; + .await + { + if let Some(field_id) = __pilota_decoding_field_id { + err.prepend_msg(&format!("decode struct `TestServiceTest2ArgsRecv` field(#{}) failed, caused by: ", field_id)); + } + return ::std::result::Result::Err(err); + }; __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", - )) - } + + let Some(var_1) = var_1 else { + return ::std::result::Result::Err( + ::pilota::thrift::new_protocol_exception( + ::pilota::thrift::ProtocolExceptionKind::InvalidData, + "field r#type is required".to_string(), + ), + ); + }; + + let data = Self { r#type: var_1 }; + ::std::result::Result::Ok(data) }) } @@ -1131,20 +3688,17 @@ pub mod auto_name { #[allow(unused_imports)] use ::pilota::thrift::TLengthProtocolExt; __protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { - name: "TestServiceTestResultSend", - }) + match self { - TestServiceTestResultSend::Ok(ref value) => { - __protocol.struct_field_len(Some(0), value) - } - } + __protocol.field_stop_len() + name: "TestServiceTest2ArgsRecv", + }) + __protocol.struct_field_len(Some(1), &self.r#type) + + __protocol.field_stop_len() + __protocol.struct_end_len() } } #[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)] - pub struct TestServicetestArgsRecv { + pub struct TestServiceTestArgsRecv { pub req: TEST, } - impl ::pilota::thrift::Message for TestServicetestArgsRecv { + impl ::pilota::thrift::Message for TestServiceTestArgsRecv { fn encode( &self, __protocol: &mut T, @@ -1152,7 +3706,7 @@ pub mod auto_name { #[allow(unused_imports)] use ::pilota::thrift::TOutputProtocolExt; let struct_ident = ::pilota::thrift::TStructIdentifier { - name: "TestServicetestArgsRecv", + name: "TestServiceTestArgsRecv", }; __protocol.write_struct_begin(&struct_ident)?; @@ -1200,7 +3754,7 @@ pub mod auto_name { ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) })() { if let Some(field_id) = __pilota_decoding_field_id { - err.prepend_msg(&format!("decode struct `TestServicetestArgsRecv` field(#{}) failed, caused by: ", field_id)); + err.prepend_msg(&format!("decode struct `TestServiceTestArgsRecv` field(#{}) failed, caused by: ", field_id)); } return ::std::result::Result::Err(err); }; @@ -1265,7 +3819,7 @@ pub mod auto_name { .await { if let Some(field_id) = __pilota_decoding_field_id { - err.prepend_msg(&format!("decode struct `TestServicetestArgsRecv` field(#{}) failed, caused by: ", field_id)); + err.prepend_msg(&format!("decode struct `TestServiceTestArgsRecv` field(#{}) failed, caused by: ", field_id)); } return ::std::result::Result::Err(err); }; @@ -1289,172 +3843,29 @@ pub mod auto_name { #[allow(unused_imports)] use ::pilota::thrift::TLengthProtocolExt; __protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { - name: "TestServicetestArgsRecv", + name: "TestServiceTestArgsRecv", }) + __protocol.struct_field_len(Some(1), &self.req) + __protocol.field_stop_len() + __protocol.struct_end_len() } } - #[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] - #[derivative(Default)] - #[derive(Clone, PartialEq)] - pub enum TestServicetestResultSend { - #[derivative(Default)] - Ok(Test), - } - - impl ::pilota::thrift::Message for TestServicetestResultSend { - 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: "TestServicetestResultSend", - })?; - match self { - TestServicetestResultSend::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(TestServicetestResultSend::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(TestServicetestResultSend::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: "TestServicetestResultSend", - }) + match self { - TestServicetestResultSend::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 Test { - pub ID: ::pilota::FastStr, - - pub Id: ::pilota::FastStr, + pub struct TestServicetestArgsRecv { + pub req: TEST, } - impl ::pilota::thrift::Message for Test { + impl ::pilota::thrift::Message for TestServicetestArgsRecv { 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: "Test" }; + let struct_ident = ::pilota::thrift::TStructIdentifier { + name: "TestServicetestArgsRecv", + }; __protocol.write_struct_begin(&struct_ident)?; - __protocol.write_faststr_field(1, (&self.ID).clone())?; - __protocol.write_faststr_field(2, (&self.Id).clone())?; + __protocol.write_struct_field(1, &self.req, ::pilota::thrift::TType::Struct)?; __protocol.write_field_stop()?; __protocol.write_struct_end()?; ::std::result::Result::Ok(()) @@ -1467,7 +3878,6 @@ pub mod auto_name { use ::pilota::{thrift::TLengthProtocolExt, Buf}; let mut var_1 = None; - let mut var_2 = None; let mut __pilota_decoding_field_id = None; @@ -1484,14 +3894,9 @@ pub mod auto_name { __pilota_decoding_field_id = field_ident.id; match field_ident.id { Some(1) - if field_ident.field_type == ::pilota::thrift::TType::Binary => - { - var_1 = Some(__protocol.read_faststr()?); - } - Some(2) - if field_ident.field_type == ::pilota::thrift::TType::Binary => + if field_ident.field_type == ::pilota::thrift::TType::Struct => { - var_2 = Some(__protocol.read_faststr()?); + var_1 = Some(::pilota::thrift::Message::decode(__protocol)?); } _ => { __protocol.skip(field_ident.field_type)?; @@ -1504,10 +3909,7 @@ pub mod auto_name { ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) })() { if let Some(field_id) = __pilota_decoding_field_id { - err.prepend_msg(&format!( - "decode struct `Test` field(#{}) failed, caused by: ", - field_id - )); + err.prepend_msg(&format!("decode struct `TestServicetestArgsRecv` field(#{}) failed, caused by: ", field_id)); } return ::std::result::Result::Err(err); }; @@ -1516,20 +3918,11 @@ pub mod auto_name { let Some(var_1) = var_1 else { return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field ID is required".to_string(), - )); - }; - let Some(var_2) = var_2 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field Id is required".to_string(), + "field req is required".to_string(), )); }; - let data = Self { - ID: var_1, - Id: var_2, - }; + let data = Self { req: var_1 }; ::std::result::Result::Ok(data) } @@ -1545,7 +3938,6 @@ pub mod auto_name { > { ::std::boxed::Box::pin(async move { let mut var_1 = None; - let mut var_2 = None; let mut __pilota_decoding_field_id = None; @@ -1561,15 +3953,14 @@ pub mod auto_name { match field_ident.id { Some(1) if field_ident.field_type - == ::pilota::thrift::TType::Binary => - { - var_1 = Some(__protocol.read_faststr().await?); - } - Some(2) - if field_ident.field_type - == ::pilota::thrift::TType::Binary => + == ::pilota::thrift::TType::Struct => { - var_2 = Some(__protocol.read_faststr().await?); + var_1 = Some( + ::decode_async( + __protocol, + ) + .await?, + ); } _ => { __protocol.skip(field_ident.field_type).await?; @@ -1583,10 +3974,7 @@ pub mod auto_name { .await { if let Some(field_id) = __pilota_decoding_field_id { - err.prepend_msg(&format!( - "decode struct `Test` field(#{}) failed, caused by: ", - field_id - )); + err.prepend_msg(&format!("decode struct `TestServicetestArgsRecv` field(#{}) failed, caused by: ", field_id)); } return ::std::result::Result::Err(err); }; @@ -1596,23 +3984,12 @@ pub mod auto_name { return ::std::result::Result::Err( ::pilota::thrift::new_protocol_exception( ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field ID is required".to_string(), - ), - ); - }; - let Some(var_2) = var_2 else { - return ::std::result::Result::Err( - ::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field Id is required".to_string(), + "field req is required".to_string(), ), ); }; - let data = Self { - ID: var_1, - Id: var_2, - }; + let data = Self { req: var_1 }; ::std::result::Result::Ok(data) }) } @@ -1620,9 +3997,9 @@ pub mod auto_name { fn size(&self, __protocol: &mut T) -> usize { #[allow(unused_imports)] use ::pilota::thrift::TLengthProtocolExt; - __protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { name: "Test" }) - + __protocol.faststr_field_len(Some(1), &self.ID) - + __protocol.faststr_field_len(Some(2), &self.Id) + __protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { + name: "TestServicetestArgsRecv", + }) + __protocol.struct_field_len(Some(1), &self.req) + __protocol.field_stop_len() + __protocol.struct_end_len() } diff --git a/pilota-build/test_data/thrift/auto_name.thrift b/pilota-build/test_data/thrift/auto_name.thrift index 58d78e8e..9461df78 100644 --- a/pilota-build/test_data/thrift/auto_name.thrift +++ b/pilota-build/test_data/thrift/auto_name.thrift @@ -19,4 +19,11 @@ enum Index { service TestService { Test test(1: TEST req); Test Test(1: TEST Req); + Test Test2(1: TEST type); +} + +service testService { + Test test(1: TEST req); + Test Test(1: TEST Req); + Test Test2(1: TEST self); }