diff --git a/tests/code-generation-workspace-split/.gitignore b/tests/code-generation-workspace-split/.gitignore new file mode 100644 index 00000000..32b6b1ea --- /dev/null +++ b/tests/code-generation-workspace-split/.gitignore @@ -0,0 +1,4 @@ +common +rpc_article +rpc_author +rpc_image \ No newline at end of file diff --git a/tests/code-generation-workspace-split/common/Cargo.toml b/tests/code-generation-workspace-split/common/Cargo.toml deleted file mode 100644 index 717d3408..00000000 --- a/tests/code-generation-workspace-split/common/Cargo.toml +++ /dev/null @@ -1,28 +0,0 @@ -[dependencies.anyhow] -workspace = true - -[dependencies.async-trait] -workspace = true - -[dependencies.lazy_static] -workspace = true - -[dependencies.pilota] -workspace = true - -[dependencies.serde] -workspace = true - -[dependencies.volo] -workspace = true - -[dependencies.volo-build] -workspace = true - -[dependencies.volo-thrift] -workspace = true - -[package] -edition = "2021" -name = "common" -version = "0.1.0" diff --git a/tests/code-generation-workspace-split/common/src/article/image/cdn/message_CDN.rs b/tests/code-generation-workspace-split/common/src/article/image/cdn/message_CDN.rs deleted file mode 100644 index 50a535e9..00000000 --- a/tests/code-generation-workspace-split/common/src/article/image/cdn/message_CDN.rs +++ /dev/null @@ -1,216 +0,0 @@ -#[derive( - PartialOrd, - Hash, - Eq, - Ord, - Debug, - Default, - ::pilota::serde::Serialize, - ::pilota::serde::Deserialize, - Clone, - PartialEq, -)] -pub struct Cdn { - pub id: i64, - - pub url: ::pilota::FastStr, - - pub common_data: super::super::super::common::CommonData, -} -impl ::pilota::thrift::Message for Cdn { - 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: "Cdn" }; - - __protocol.write_struct_begin(&struct_ident)?; - __protocol.write_i64_field(1, *&self.id)?; - __protocol.write_faststr_field(2, (&self.url).clone())?; - __protocol.write_struct_field(3, &self.common_data, ::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 var_2 = None; - let mut var_3 = None; - - let mut __pilota_decoding_field_id = None; - - __protocol.read_struct_begin()?; - if let ::std::result::Result::Err(mut err) = (|| { - loop { - let field_ident = __protocol.read_field_begin()?; - if field_ident.field_type == ::pilota::thrift::TType::Stop { - __protocol.field_stop_len(); - break; - } else { - __protocol.field_begin_len(field_ident.field_type, field_ident.id); - } - __pilota_decoding_field_id = field_ident.id; - match field_ident.id { - Some(1) if field_ident.field_type == ::pilota::thrift::TType::I64 => { - var_1 = Some(__protocol.read_i64()?); - } - Some(2) if field_ident.field_type == ::pilota::thrift::TType::Binary => { - var_2 = Some(__protocol.read_faststr()?); - } - Some(3) if field_ident.field_type == ::pilota::thrift::TType::Struct => { - var_3 = 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 `Cdn` 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 url is required".to_string(), - )); - }; - let Some(var_3) = var_3 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field common_data is required".to_string(), - )); - }; - - let data = Self { - id: var_1, - url: var_2, - common_data: var_3, - }; - ::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 var_3 = None; - - let mut __pilota_decoding_field_id = None; - - __protocol.read_struct_begin().await?; - if let ::std::result::Result::Err(mut err) = async { - loop { - - - let field_ident = __protocol.read_field_begin().await?; - if field_ident.field_type == ::pilota::thrift::TType::Stop { - - break; - } else { - - } - __pilota_decoding_field_id = field_ident.id; - match field_ident.id { - Some(1) if field_ident.field_type == ::pilota::thrift::TType::I64 => { - var_1 = Some(__protocol.read_i64().await?); - - },Some(2) if field_ident.field_type == ::pilota::thrift::TType::Binary => { - var_2 = Some(__protocol.read_faststr().await?); - - },Some(3) if field_ident.field_type == ::pilota::thrift::TType::Struct => { - var_3 = 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 `Cdn` 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 url is required".to_string(), - )); - }; - let Some(var_3) = var_3 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field common_data is required".to_string(), - )); - }; - - let data = Self { - id: var_1, - url: var_2, - common_data: var_3, - }; - ::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: "Cdn" }) - + __protocol.i64_field_len(Some(1), *&self.id) - + __protocol.faststr_field_len(Some(2), &self.url) - + __protocol.struct_field_len(Some(3), &self.common_data) - + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/common/src/article/image/cdn/mod.rs b/tests/code-generation-workspace-split/common/src/article/image/cdn/mod.rs deleted file mode 100644 index bdf630b1..00000000 --- a/tests/code-generation-workspace-split/common/src/article/image/cdn/mod.rs +++ /dev/null @@ -1 +0,0 @@ -include!("message_CDN.rs"); diff --git a/tests/code-generation-workspace-split/common/src/article/image/message_Image.rs b/tests/code-generation-workspace-split/common/src/article/image/message_Image.rs deleted file mode 100644 index 1495d790..00000000 --- a/tests/code-generation-workspace-split/common/src/article/image/message_Image.rs +++ /dev/null @@ -1,242 +0,0 @@ -#[derive( - PartialOrd, - Hash, - Eq, - Ord, - Debug, - Default, - ::pilota::serde::Serialize, - ::pilota::serde::Deserialize, - Clone, - PartialEq, -)] -pub struct Image { - pub id: i64, - - pub url: ::pilota::FastStr, - - pub cdn: cdn::Cdn, - - pub common_data: super::super::common::CommonData, -} -impl ::pilota::thrift::Message for Image { - 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: "Image" }; - - __protocol.write_struct_begin(&struct_ident)?; - __protocol.write_i64_field(1, *&self.id)?; - __protocol.write_faststr_field(2, (&self.url).clone())?; - __protocol.write_struct_field(3, &self.cdn, ::pilota::thrift::TType::Struct)?; - __protocol.write_struct_field(4, &self.common_data, ::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 var_2 = None; - let mut var_3 = None; - let mut var_4 = None; - - let mut __pilota_decoding_field_id = None; - - __protocol.read_struct_begin()?; - if let ::std::result::Result::Err(mut err) = (|| { - loop { - let field_ident = __protocol.read_field_begin()?; - if field_ident.field_type == ::pilota::thrift::TType::Stop { - __protocol.field_stop_len(); - break; - } else { - __protocol.field_begin_len(field_ident.field_type, field_ident.id); - } - __pilota_decoding_field_id = field_ident.id; - match field_ident.id { - Some(1) if field_ident.field_type == ::pilota::thrift::TType::I64 => { - var_1 = Some(__protocol.read_i64()?); - } - Some(2) if field_ident.field_type == ::pilota::thrift::TType::Binary => { - var_2 = Some(__protocol.read_faststr()?); - } - Some(3) if field_ident.field_type == ::pilota::thrift::TType::Struct => { - var_3 = Some(::pilota::thrift::Message::decode(__protocol)?); - } - Some(4) if field_ident.field_type == ::pilota::thrift::TType::Struct => { - var_4 = 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 `Image` 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 url is required".to_string(), - )); - }; - let Some(var_3) = var_3 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field cdn is required".to_string(), - )); - }; - let Some(var_4) = var_4 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field common_data is required".to_string(), - )); - }; - - let data = Self { - id: var_1, - url: var_2, - cdn: var_3, - common_data: var_4, - }; - ::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 var_3 = None; - let mut var_4 = None; - - let mut __pilota_decoding_field_id = None; - - __protocol.read_struct_begin().await?; - if let ::std::result::Result::Err(mut err) = async { - loop { - - - let field_ident = __protocol.read_field_begin().await?; - if field_ident.field_type == ::pilota::thrift::TType::Stop { - - break; - } else { - - } - __pilota_decoding_field_id = field_ident.id; - match field_ident.id { - Some(1) if field_ident.field_type == ::pilota::thrift::TType::I64 => { - var_1 = Some(__protocol.read_i64().await?); - - },Some(2) if field_ident.field_type == ::pilota::thrift::TType::Binary => { - var_2 = Some(__protocol.read_faststr().await?); - - },Some(3) if field_ident.field_type == ::pilota::thrift::TType::Struct => { - var_3 = Some(::decode_async(__protocol).await?); - - },Some(4) if field_ident.field_type == ::pilota::thrift::TType::Struct => { - var_4 = 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 `Image` 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 url is required".to_string(), - )); - }; - let Some(var_3) = var_3 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field cdn is required".to_string(), - )); - }; - let Some(var_4) = var_4 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field common_data is required".to_string(), - )); - }; - - let data = Self { - id: var_1, - url: var_2, - cdn: var_3, - common_data: var_4, - }; - ::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: "Image" }) - + __protocol.i64_field_len(Some(1), *&self.id) - + __protocol.faststr_field_len(Some(2), &self.url) - + __protocol.struct_field_len(Some(3), &self.cdn) - + __protocol.struct_field_len(Some(4), &self.common_data) - + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/common/src/article/image/mod.rs b/tests/code-generation-workspace-split/common/src/article/image/mod.rs deleted file mode 100644 index fae6e988..00000000 --- a/tests/code-generation-workspace-split/common/src/article/image/mod.rs +++ /dev/null @@ -1 +0,0 @@ -include!("message_Image.rs"); diff --git a/tests/code-generation-workspace-split/common/src/author/message_Author.rs b/tests/code-generation-workspace-split/common/src/author/message_Author.rs deleted file mode 100644 index 0a4c14d2..00000000 --- a/tests/code-generation-workspace-split/common/src/author/message_Author.rs +++ /dev/null @@ -1,268 +0,0 @@ -#[derive( - PartialOrd, - Hash, - Eq, - Ord, - Debug, - Default, - ::pilota::serde::Serialize, - ::pilota::serde::Deserialize, - Clone, - PartialEq, -)] -pub struct Author { - pub id: i64, - - pub username: ::pilota::FastStr, - - pub email: ::pilota::FastStr, - - pub avatar: super::article::image::Image, - - pub common_data: super::common::CommonData, -} -impl ::pilota::thrift::Message for Author { - 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: "Author" }; - - __protocol.write_struct_begin(&struct_ident)?; - __protocol.write_i64_field(1, *&self.id)?; - __protocol.write_faststr_field(2, (&self.username).clone())?; - __protocol.write_faststr_field(3, (&self.email).clone())?; - __protocol.write_struct_field(4, &self.avatar, ::pilota::thrift::TType::Struct)?; - __protocol.write_struct_field(5, &self.common_data, ::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 var_2 = None; - let mut var_3 = None; - let mut var_4 = None; - let mut var_5 = None; - - let mut __pilota_decoding_field_id = None; - - __protocol.read_struct_begin()?; - if let ::std::result::Result::Err(mut err) = (|| { - loop { - let field_ident = __protocol.read_field_begin()?; - if field_ident.field_type == ::pilota::thrift::TType::Stop { - __protocol.field_stop_len(); - break; - } else { - __protocol.field_begin_len(field_ident.field_type, field_ident.id); - } - __pilota_decoding_field_id = field_ident.id; - match field_ident.id { - Some(1) if field_ident.field_type == ::pilota::thrift::TType::I64 => { - var_1 = Some(__protocol.read_i64()?); - } - Some(2) if field_ident.field_type == ::pilota::thrift::TType::Binary => { - var_2 = Some(__protocol.read_faststr()?); - } - Some(3) if field_ident.field_type == ::pilota::thrift::TType::Binary => { - var_3 = Some(__protocol.read_faststr()?); - } - Some(4) if field_ident.field_type == ::pilota::thrift::TType::Struct => { - var_4 = Some(::pilota::thrift::Message::decode(__protocol)?); - } - Some(5) if field_ident.field_type == ::pilota::thrift::TType::Struct => { - var_5 = 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 `Author` 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 username is required".to_string(), - )); - }; - let Some(var_3) = var_3 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field email is required".to_string(), - )); - }; - let Some(var_4) = var_4 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field avatar is required".to_string(), - )); - }; - let Some(var_5) = var_5 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field common_data is required".to_string(), - )); - }; - - let data = Self { - id: var_1, - username: var_2, - email: var_3, - avatar: var_4, - common_data: var_5, - }; - ::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 var_3 = None; - let mut var_4 = None; - let mut var_5 = None; - - let mut __pilota_decoding_field_id = None; - - __protocol.read_struct_begin().await?; - if let ::std::result::Result::Err(mut err) = async { - loop { - - - let field_ident = __protocol.read_field_begin().await?; - if field_ident.field_type == ::pilota::thrift::TType::Stop { - - break; - } else { - - } - __pilota_decoding_field_id = field_ident.id; - match field_ident.id { - Some(1) if field_ident.field_type == ::pilota::thrift::TType::I64 => { - var_1 = Some(__protocol.read_i64().await?); - - },Some(2) if field_ident.field_type == ::pilota::thrift::TType::Binary => { - var_2 = Some(__protocol.read_faststr().await?); - - },Some(3) if field_ident.field_type == ::pilota::thrift::TType::Binary => { - var_3 = Some(__protocol.read_faststr().await?); - - },Some(4) if field_ident.field_type == ::pilota::thrift::TType::Struct => { - var_4 = Some(::decode_async(__protocol).await?); - - },Some(5) if field_ident.field_type == ::pilota::thrift::TType::Struct => { - var_5 = 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 `Author` 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 username is required".to_string(), - )); - }; - let Some(var_3) = var_3 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field email is required".to_string(), - )); - }; - let Some(var_4) = var_4 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field avatar is required".to_string(), - )); - }; - let Some(var_5) = var_5 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field common_data is required".to_string(), - )); - }; - - let data = Self { - id: var_1, - username: var_2, - email: var_3, - avatar: var_4, - common_data: var_5, - }; - ::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: "Author" }) - + __protocol.i64_field_len(Some(1), *&self.id) - + __protocol.faststr_field_len(Some(2), &self.username) - + __protocol.faststr_field_len(Some(3), &self.email) - + __protocol.struct_field_len(Some(4), &self.avatar) - + __protocol.struct_field_len(Some(5), &self.common_data) - + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/common/src/author/mod.rs b/tests/code-generation-workspace-split/common/src/author/mod.rs deleted file mode 100644 index bc027b9a..00000000 --- a/tests/code-generation-workspace-split/common/src/author/mod.rs +++ /dev/null @@ -1 +0,0 @@ -include!("message_Author.rs"); diff --git a/tests/code-generation-workspace-split/common/src/common/message_CommonData.rs b/tests/code-generation-workspace-split/common/src/common/message_CommonData.rs deleted file mode 100644 index c6c253a7..00000000 --- a/tests/code-generation-workspace-split/common/src/common/message_CommonData.rs +++ /dev/null @@ -1,213 +0,0 @@ -#[derive( - PartialOrd, - Hash, - Eq, - Ord, - Debug, - Default, - ::pilota::serde::Serialize, - ::pilota::serde::Deserialize, - Clone, - PartialEq, -)] -pub struct CommonData { - pub id: i64, - - pub name: ::pilota::FastStr, - - pub description: ::pilota::FastStr, -} -impl ::pilota::thrift::Message for CommonData { - 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: "CommonData" }; - - __protocol.write_struct_begin(&struct_ident)?; - __protocol.write_i64_field(1, *&self.id)?; - __protocol.write_faststr_field(2, (&self.name).clone())?; - __protocol.write_faststr_field(3, (&self.description).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 var_3 = None; - - let mut __pilota_decoding_field_id = None; - - __protocol.read_struct_begin()?; - if let ::std::result::Result::Err(mut err) = (|| { - loop { - let field_ident = __protocol.read_field_begin()?; - if field_ident.field_type == ::pilota::thrift::TType::Stop { - __protocol.field_stop_len(); - break; - } else { - __protocol.field_begin_len(field_ident.field_type, field_ident.id); - } - __pilota_decoding_field_id = field_ident.id; - match field_ident.id { - Some(1) if field_ident.field_type == ::pilota::thrift::TType::I64 => { - var_1 = Some(__protocol.read_i64()?); - } - Some(2) if field_ident.field_type == ::pilota::thrift::TType::Binary => { - var_2 = Some(__protocol.read_faststr()?); - } - Some(3) if field_ident.field_type == ::pilota::thrift::TType::Binary => { - var_3 = 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 `CommonData` 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 name is required".to_string(), - )); - }; - let Some(var_3) = var_3 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field description is required".to_string(), - )); - }; - - let data = Self { - id: var_1, - name: var_2, - description: var_3, - }; - ::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 var_3 = None; - - let mut __pilota_decoding_field_id = None; - - __protocol.read_struct_begin().await?; - if let ::std::result::Result::Err(mut err) = async { - loop { - let field_ident = __protocol.read_field_begin().await?; - if field_ident.field_type == ::pilota::thrift::TType::Stop { - break; - } else { - } - __pilota_decoding_field_id = field_ident.id; - match field_ident.id { - Some(1) if field_ident.field_type == ::pilota::thrift::TType::I64 => { - var_1 = Some(__protocol.read_i64().await?); - } - Some(2) if field_ident.field_type == ::pilota::thrift::TType::Binary => { - var_2 = Some(__protocol.read_faststr().await?); - } - Some(3) if field_ident.field_type == ::pilota::thrift::TType::Binary => { - var_3 = 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 `CommonData` 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 name is required".to_string(), - )); - }; - let Some(var_3) = var_3 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field description is required".to_string(), - )); - }; - - let data = Self { - id: var_1, - name: var_2, - description: var_3, - }; - ::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: "CommonData" }) - + __protocol.i64_field_len(Some(1), *&self.id) - + __protocol.faststr_field_len(Some(2), &self.name) - + __protocol.faststr_field_len(Some(3), &self.description) - + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/common/src/common/mod.rs b/tests/code-generation-workspace-split/common/src/common/mod.rs deleted file mode 100644 index 5e2006a4..00000000 --- a/tests/code-generation-workspace-split/common/src/common/mod.rs +++ /dev/null @@ -1 +0,0 @@ -include!("message_CommonData.rs"); diff --git a/tests/code-generation-workspace-split/common/src/gen.rs b/tests/code-generation-workspace-split/common/src/gen.rs deleted file mode 100644 index df776c89..00000000 --- a/tests/code-generation-workspace-split/common/src/gen.rs +++ /dev/null @@ -1,22 +0,0 @@ -pub mod gen { - #![allow(warnings, clippy::all)] - - pub mod article { - - pub mod image { - include!("article/image/mod.rs"); - - pub mod cdn { - include!("article/image/cdn/mod.rs"); - } - } - } - - pub mod author { - include!("author/mod.rs"); - } - - pub mod common { - include!("common/mod.rs"); - } -} diff --git a/tests/code-generation-workspace-split/common/src/lib.rs b/tests/code-generation-workspace-split/common/src/lib.rs deleted file mode 100644 index 3a85e855..00000000 --- a/tests/code-generation-workspace-split/common/src/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -include!("gen.rs"); -pub use gen::*; diff --git a/tests/code-generation-workspace-split/rpc_article/Cargo.toml b/tests/code-generation-workspace-split/rpc_article/Cargo.toml deleted file mode 100644 index 663e2793..00000000 --- a/tests/code-generation-workspace-split/rpc_article/Cargo.toml +++ /dev/null @@ -1,31 +0,0 @@ -[dependencies.anyhow] -workspace = true - -[dependencies.async-trait] -workspace = true - -[dependencies.common] -path = "../common" - -[dependencies.lazy_static] -workspace = true - -[dependencies.pilota] -workspace = true - -[dependencies.serde] -workspace = true - -[dependencies.volo] -workspace = true - -[dependencies.volo-build] -workspace = true - -[dependencies.volo-thrift] -workspace = true - -[package] -edition = "2021" -name = "rpc_article" -version = "0.1.0" diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/enum_ArticleServiceRequestRecv.rs b/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/enum_ArticleServiceRequestRecv.rs deleted file mode 100644 index bf796d92..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/enum_ArticleServiceRequestRecv.rs +++ /dev/null @@ -1,58 +0,0 @@ -#[derive(Debug, Clone)] -pub enum ArticleServiceRequestRecv { - GetArticle(ArticleServiceGetArticleArgsRecv), -} - -impl ::volo_thrift::EntryMessage for ArticleServiceRequestRecv { - fn encode( - &self, - __protocol: &mut T, - ) -> ::core::result::Result<(), ::pilota::thrift::ThriftException> { - match self { - Self::GetArticle(value) => { - ::pilota::thrift::Message::encode(value, __protocol).map_err(|err| err.into()) - } - } - } - - fn decode( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetArticle" => Self::GetArticle(::pilota::thrift::Message::decode(__protocol)?), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - async fn decode_async( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetArticle" => Self::GetArticle( - ::decode_async( - __protocol, - ) - .await?, - ), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - fn size(&self, __protocol: &mut T) -> usize { - match self { - Self::GetArticle(value) => ::volo_thrift::Message::size(value, __protocol), - } - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/enum_ArticleServiceRequestSend.rs b/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/enum_ArticleServiceRequestSend.rs deleted file mode 100644 index 8a5c7865..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/enum_ArticleServiceRequestSend.rs +++ /dev/null @@ -1,58 +0,0 @@ -#[derive(Debug, Clone)] -pub enum ArticleServiceRequestSend { - GetArticle(ArticleServiceGetArticleArgsSend), -} - -impl ::volo_thrift::EntryMessage for ArticleServiceRequestSend { - fn encode( - &self, - __protocol: &mut T, - ) -> ::core::result::Result<(), ::pilota::thrift::ThriftException> { - match self { - Self::GetArticle(value) => { - ::pilota::thrift::Message::encode(value, __protocol).map_err(|err| err.into()) - } - } - } - - fn decode( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetArticle" => Self::GetArticle(::pilota::thrift::Message::decode(__protocol)?), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - async fn decode_async( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetArticle" => Self::GetArticle( - ::decode_async( - __protocol, - ) - .await?, - ), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - fn size(&self, __protocol: &mut T) -> usize { - match self { - Self::GetArticle(value) => ::volo_thrift::Message::size(value, __protocol), - } - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/enum_ArticleServiceResponseRecv.rs b/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/enum_ArticleServiceResponseRecv.rs deleted file mode 100644 index e458172a..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/enum_ArticleServiceResponseRecv.rs +++ /dev/null @@ -1,57 +0,0 @@ -#[derive(Debug, Clone)] -pub enum ArticleServiceResponseRecv { - GetArticle(ArticleServiceGetArticleResultRecv), -} -impl ::volo_thrift::EntryMessage for ArticleServiceResponseRecv { - fn encode( - &self, - __protocol: &mut T, - ) -> ::core::result::Result<(), ::pilota::thrift::ThriftException> { - match self { - Self::GetArticle(value) => { - ::pilota::thrift::Message::encode(value, __protocol).map_err(|err| err.into()) - } - } - } - - fn decode( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetArticle" => Self::GetArticle(::pilota::thrift::Message::decode(__protocol)?), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - async fn decode_async( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetArticle" => Self::GetArticle( - ::decode_async( - __protocol, - ) - .await?, - ), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - fn size(&self, __protocol: &mut T) -> usize { - match self { - Self::GetArticle(value) => ::volo_thrift::Message::size(value, __protocol), - } - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/enum_ArticleServiceResponseSend.rs b/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/enum_ArticleServiceResponseSend.rs deleted file mode 100644 index ab0b8fc0..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/enum_ArticleServiceResponseSend.rs +++ /dev/null @@ -1,58 +0,0 @@ -#[derive(Debug, Clone)] -pub enum ArticleServiceResponseSend { - GetArticle(ArticleServiceGetArticleResultSend), -} - -impl ::volo_thrift::EntryMessage for ArticleServiceResponseSend { - fn encode( - &self, - __protocol: &mut T, - ) -> ::core::result::Result<(), ::pilota::thrift::ThriftException> { - match self { - Self::GetArticle(value) => { - ::pilota::thrift::Message::encode(value, __protocol).map_err(|err| err.into()) - } - } - } - - fn decode( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetArticle" => Self::GetArticle(::pilota::thrift::Message::decode(__protocol)?), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - async fn decode_async( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetArticle" => Self::GetArticle( - ::decode_async( - __protocol, - ) - .await?, - ), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - fn size(&self, __protocol: &mut T) -> usize { - match self { - Self::GetArticle(value) => ::volo_thrift::Message::size(value, __protocol), - } - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/mod.rs b/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/mod.rs deleted file mode 100644 index ec4d08df..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -include!("service_ArticleServiceServer.rs"); -include!("service_ArticleServiceClient.rs"); -include!("enum_ArticleServiceRequestRecv.rs"); -include!("enum_ArticleServiceResponseRecv.rs"); -include!("enum_ArticleServiceRequestSend.rs"); -include!("enum_ArticleServiceResponseSend.rs"); diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/service_ArticleServiceClient.rs b/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/service_ArticleServiceClient.rs deleted file mode 100644 index a27dfe4b..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/service_ArticleServiceClient.rs +++ /dev/null @@ -1,127 +0,0 @@ -pub struct MkArticleServiceGenericClient; - -pub type ArticleServiceClient = ArticleServiceGenericClient< - ::volo::service::BoxCloneService< - ::volo_thrift::context::ClientContext, - ArticleServiceRequestSend, - ::std::option::Option, - ::volo_thrift::ClientError, - >, ->; - -impl ::volo::client::MkClient<::volo_thrift::Client> for MkArticleServiceGenericClient { - type Target = ArticleServiceGenericClient; - fn mk_client(&self, service: ::volo_thrift::Client) -> Self::Target { - ArticleServiceGenericClient(service) - } -} - -#[derive(Clone)] -pub struct ArticleServiceGenericClient(pub ::volo_thrift::Client); - -pub struct ArticleServiceOneShotClient(pub ::volo_thrift::Client); - -impl< - S: ::volo::service::Service< - ::volo_thrift::context::ClientContext, - ArticleServiceRequestSend, - Response = ::std::option::Option, - Error = ::volo_thrift::ClientError, - > + Send - + Sync - + 'static, - > ArticleServiceGenericClient -{ - pub fn with_callopt>( - self, - opt: Opt, - ) -> ArticleServiceOneShotClient<::volo::client::WithOptService> { - ArticleServiceOneShotClient(self.0.with_opt(opt)) - } - - pub async fn get_article( - &self, - req: GetArticleRequest, - ) -> ::std::result::Result { - let req = ArticleServiceRequestSend::GetArticle(ArticleServiceGetArticleArgsSend { req }); - let mut cx = self.0.make_cx("GetArticle", false); - #[allow(unreachable_patterns)] - let resp = match ::volo::service::Service::call(&self.0, &mut cx, req).await? { - Some(ArticleServiceResponseRecv::GetArticle( - ArticleServiceGetArticleResultRecv::Ok(resp), - )) => ::std::result::Result::Ok(resp), - None => unreachable!(), - _ => unreachable!(), - }; - ::volo_thrift::context::CLIENT_CONTEXT_CACHE.with(|cache| { - let mut cache = cache.borrow_mut(); - if cache.len() < cache.capacity() { - cache.push(cx); - } - }); - resp - } -} - -impl< - S: ::volo::client::OneShotService< - ::volo_thrift::context::ClientContext, - ArticleServiceRequestSend, - Response = ::std::option::Option, - Error = ::volo_thrift::ClientError, - > + Send - + Sync - + 'static, - > ArticleServiceOneShotClient -{ - pub async fn get_article( - self, - req: GetArticleRequest, - ) -> ::std::result::Result { - let req = ArticleServiceRequestSend::GetArticle(ArticleServiceGetArticleArgsSend { req }); - let mut cx = self.0.make_cx("GetArticle", false); - #[allow(unreachable_patterns)] - let resp = match ::volo::client::OneShotService::call(self.0, &mut cx, req).await? { - Some(ArticleServiceResponseRecv::GetArticle( - ArticleServiceGetArticleResultRecv::Ok(resp), - )) => ::std::result::Result::Ok(resp), - None => unreachable!(), - _ => unreachable!(), - }; - ::volo_thrift::context::CLIENT_CONTEXT_CACHE.with(|cache| { - let mut cache = cache.borrow_mut(); - if cache.len() < cache.capacity() { - cache.push(cx); - } - }); - resp - } -} - -pub struct ArticleServiceClientBuilder {} - -impl ArticleServiceClientBuilder { - pub fn new( - service_name: impl AsRef, - ) -> ::volo_thrift::client::ClientBuilder< - ::volo::layer::Identity, - ::volo::layer::Identity, - MkArticleServiceGenericClient, - ArticleServiceRequestSend, - ArticleServiceResponseRecv, - ::volo::net::dial::DefaultMakeTransport, - ::volo_thrift::codec::default::DefaultMakeCodec< - ::volo_thrift::codec::default::ttheader::MakeTTHeaderCodec< - ::volo_thrift::codec::default::framed::MakeFramedCodec< - ::volo_thrift::codec::default::thrift::MakeThriftCodec, - >, - >, - >, - ::volo::loadbalance::LbConfig< - ::volo::loadbalance::random::WeightedRandomBalance<()>, - ::volo::discovery::DummyDiscover, - >, - > { - ::volo_thrift::client::ClientBuilder::new(service_name, MkArticleServiceGenericClient) - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/service_ArticleServiceServer.rs b/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/service_ArticleServiceServer.rs deleted file mode 100644 index 75c60f41..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/ArticleService_1/service_ArticleServiceServer.rs +++ /dev/null @@ -1,54 +0,0 @@ -pub struct ArticleServiceServer { - inner: S, // handler -} - -impl ArticleServiceServer -where - S: ArticleService + ::core::marker::Send + ::core::marker::Sync + 'static, -{ - pub fn new( - inner: S, - ) -> ::volo_thrift::server::Server< - Self, - ::volo::layer::Identity, - ArticleServiceRequestRecv, - ::volo_thrift::codec::default::DefaultMakeCodec< - ::volo_thrift::codec::default::ttheader::MakeTTHeaderCodec< - ::volo_thrift::codec::default::framed::MakeFramedCodec< - ::volo_thrift::codec::default::thrift::MakeThriftCodec, - >, - >, - >, - ::volo_thrift::tracing::DefaultProvider, - > { - ::volo_thrift::server::Server::new(Self { inner }) - } -} - -impl ::volo::service::Service<::volo_thrift::context::ServerContext, ArticleServiceRequestRecv> - for ArticleServiceServer -where - T: ArticleService + Send + Sync + 'static, -{ - type Response = ArticleServiceResponseSend; - type Error = ::volo_thrift::ServerError; - - async fn call<'s, 'cx>( - &'s self, - _cx: &'cx mut ::volo_thrift::context::ServerContext, - req: ArticleServiceRequestRecv, - ) -> ::std::result::Result { - match req { - ArticleServiceRequestRecv::GetArticle(args) => { - ::std::result::Result::Ok(ArticleServiceResponseSend::GetArticle( - match self.inner.get_article(args.req).await { - ::std::result::Result::Ok(resp) => { - ArticleServiceGetArticleResultSend::Ok(resp) - } - ::std::result::Result::Err(err) => return ::std::result::Result::Err(err), - }, - )) - } - } - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/enum_articleServiceRequestRecv.rs b/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/enum_articleServiceRequestRecv.rs deleted file mode 100644 index 7ce81e75..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/enum_articleServiceRequestRecv.rs +++ /dev/null @@ -1,47 +0,0 @@ -#[derive(Debug, Clone)] -pub enum articleServiceRequestRecv {} - -impl ::volo_thrift::EntryMessage for articleServiceRequestRecv { - fn encode( - &self, - __protocol: &mut T, - ) -> ::core::result::Result<(), ::pilota::thrift::ThriftException> { - match self { - _ => unreachable!(), - } - } - - fn decode( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - async fn decode_async( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - fn size(&self, __protocol: &mut T) -> usize { - match self { - _ => unreachable!(), - } - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/enum_articleServiceRequestSend.rs b/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/enum_articleServiceRequestSend.rs deleted file mode 100644 index 108baf4e..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/enum_articleServiceRequestSend.rs +++ /dev/null @@ -1,47 +0,0 @@ -#[derive(Debug, Clone)] -pub enum articleServiceRequestSend {} - -impl ::volo_thrift::EntryMessage for articleServiceRequestSend { - fn encode( - &self, - __protocol: &mut T, - ) -> ::core::result::Result<(), ::pilota::thrift::ThriftException> { - match self { - _ => unreachable!(), - } - } - - fn decode( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - async fn decode_async( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - fn size(&self, __protocol: &mut T) -> usize { - match self { - _ => unreachable!(), - } - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/enum_articleServiceResponseRecv.rs b/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/enum_articleServiceResponseRecv.rs deleted file mode 100644 index f46bb74d..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/enum_articleServiceResponseRecv.rs +++ /dev/null @@ -1,46 +0,0 @@ -#[derive(Debug, Clone)] -pub enum articleServiceResponseRecv {} -impl ::volo_thrift::EntryMessage for articleServiceResponseRecv { - fn encode( - &self, - __protocol: &mut T, - ) -> ::core::result::Result<(), ::pilota::thrift::ThriftException> { - match self { - _ => unreachable!(), - } - } - - fn decode( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - async fn decode_async( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - fn size(&self, __protocol: &mut T) -> usize { - match self { - _ => unreachable!(), - } - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/enum_articleServiceResponseSend.rs b/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/enum_articleServiceResponseSend.rs deleted file mode 100644 index d3ebfc6a..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/enum_articleServiceResponseSend.rs +++ /dev/null @@ -1,47 +0,0 @@ -#[derive(Debug, Clone)] -pub enum articleServiceResponseSend {} - -impl ::volo_thrift::EntryMessage for articleServiceResponseSend { - fn encode( - &self, - __protocol: &mut T, - ) -> ::core::result::Result<(), ::pilota::thrift::ThriftException> { - match self { - _ => unreachable!(), - } - } - - fn decode( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - async fn decode_async( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - fn size(&self, __protocol: &mut T) -> usize { - match self { - _ => unreachable!(), - } - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/mod.rs b/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/mod.rs deleted file mode 100644 index bccfc158..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -include!("service_articleServiceServer.rs"); -include!("service_articleServiceClient.rs"); -include!("enum_articleServiceRequestRecv.rs"); -include!("enum_articleServiceResponseRecv.rs"); -include!("enum_articleServiceRequestSend.rs"); -include!("enum_articleServiceResponseSend.rs"); diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/service_articleServiceClient.rs b/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/service_articleServiceClient.rs deleted file mode 100644 index df17d296..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/service_articleServiceClient.rs +++ /dev/null @@ -1,82 +0,0 @@ -pub struct MkarticleServiceGenericClient; - -pub type articleServiceClient = articleServiceGenericClient< - ::volo::service::BoxCloneService< - ::volo_thrift::context::ClientContext, - articleServiceRequestSend, - ::std::option::Option, - ::volo_thrift::ClientError, - >, ->; - -impl ::volo::client::MkClient<::volo_thrift::Client> for MkarticleServiceGenericClient { - type Target = articleServiceGenericClient; - fn mk_client(&self, service: ::volo_thrift::Client) -> Self::Target { - articleServiceGenericClient(service) - } -} - -#[derive(Clone)] -pub struct articleServiceGenericClient(pub ::volo_thrift::Client); - -pub struct articleServiceOneShotClient(pub ::volo_thrift::Client); - -impl< - S: ::volo::service::Service< - ::volo_thrift::context::ClientContext, - articleServiceRequestSend, - Response = ::std::option::Option, - Error = ::volo_thrift::ClientError, - > + Send - + Sync - + 'static, - > articleServiceGenericClient -{ - pub fn with_callopt>( - self, - opt: Opt, - ) -> articleServiceOneShotClient<::volo::client::WithOptService> { - articleServiceOneShotClient(self.0.with_opt(opt)) - } -} - -impl< - S: ::volo::client::OneShotService< - ::volo_thrift::context::ClientContext, - articleServiceRequestSend, - Response = ::std::option::Option, - Error = ::volo_thrift::ClientError, - > + Send - + Sync - + 'static, - > articleServiceOneShotClient -{ -} - -pub struct articleServiceClientBuilder {} - -impl articleServiceClientBuilder { - pub fn new( - service_name: impl AsRef, - ) -> ::volo_thrift::client::ClientBuilder< - ::volo::layer::Identity, - ::volo::layer::Identity, - MkarticleServiceGenericClient, - articleServiceRequestSend, - articleServiceResponseRecv, - ::volo::net::dial::DefaultMakeTransport, - ::volo_thrift::codec::default::DefaultMakeCodec< - ::volo_thrift::codec::default::ttheader::MakeTTHeaderCodec< - ::volo_thrift::codec::default::framed::MakeFramedCodec< - ::volo_thrift::codec::default::thrift::MakeThriftCodec, - >, - >, - >, - ::volo::loadbalance::LbConfig< - ::volo::loadbalance::random::WeightedRandomBalance<()>, - ::volo::discovery::DummyDiscover, - >, - > { - ::volo_thrift::client::ClientBuilder::new(service_name, MkarticleServiceGenericClient) - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/service_articleServiceServer.rs b/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/service_articleServiceServer.rs deleted file mode 100644 index ee79550e..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/articleService_0/service_articleServiceServer.rs +++ /dev/null @@ -1,43 +0,0 @@ -pub struct articleServiceServer { - inner: S, // handler -} - -impl articleServiceServer -where - S: articleService + ::core::marker::Send + ::core::marker::Sync + 'static, -{ - pub fn new( - inner: S, - ) -> ::volo_thrift::server::Server< - Self, - ::volo::layer::Identity, - articleServiceRequestRecv, - ::volo_thrift::codec::default::DefaultMakeCodec< - ::volo_thrift::codec::default::ttheader::MakeTTHeaderCodec< - ::volo_thrift::codec::default::framed::MakeFramedCodec< - ::volo_thrift::codec::default::thrift::MakeThriftCodec, - >, - >, - >, - ::volo_thrift::tracing::DefaultProvider, - > { - ::volo_thrift::server::Server::new(Self { inner }) - } -} - -impl ::volo::service::Service<::volo_thrift::context::ServerContext, articleServiceRequestRecv> - for articleServiceServer -where - T: articleService + Send + Sync + 'static, -{ - type Response = articleServiceResponseSend; - type Error = ::volo_thrift::ServerError; - - async fn call<'s, 'cx>( - &'s self, - _cx: &'cx mut ::volo_thrift::context::ServerContext, - req: articleServiceRequestRecv, - ) -> ::std::result::Result { - match req {} - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/enum_ArticleServiceGetArticleResultRecv.rs b/tests/code-generation-workspace-split/rpc_article/src/article/enum_ArticleServiceGetArticleResultRecv.rs deleted file mode 100644 index fe4b9620..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/enum_ArticleServiceGetArticleResultRecv.rs +++ /dev/null @@ -1,144 +0,0 @@ -#[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] -#[derivative(Default)] -#[derive(::pilota::serde::Serialize, ::pilota::serde::Deserialize, Clone, PartialEq)] -pub enum ArticleServiceGetArticleResultRecv { - #[derivative(Default)] - Ok(GetArticleResponse), -} - -impl ::pilota::thrift::Message for ArticleServiceGetArticleResultRecv { - 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: "ArticleServiceGetArticleResultRecv", - })?; - match self { - ArticleServiceGetArticleResultRecv::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(ArticleServiceGetArticleResultRecv::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(ArticleServiceGetArticleResultRecv::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: "ArticleServiceGetArticleResultRecv", - }) + match self { - ArticleServiceGetArticleResultRecv::Ok(ref value) => { - __protocol.struct_field_len(Some(0), value) - } - } + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/enum_ArticleServiceGetArticleResultSend.rs b/tests/code-generation-workspace-split/rpc_article/src/article/enum_ArticleServiceGetArticleResultSend.rs deleted file mode 100644 index 34a6d22a..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/enum_ArticleServiceGetArticleResultSend.rs +++ /dev/null @@ -1,144 +0,0 @@ -#[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] -#[derivative(Default)] -#[derive(::pilota::serde::Serialize, ::pilota::serde::Deserialize, Clone, PartialEq)] -pub enum ArticleServiceGetArticleResultSend { - #[derivative(Default)] - Ok(GetArticleResponse), -} - -impl ::pilota::thrift::Message for ArticleServiceGetArticleResultSend { - 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: "ArticleServiceGetArticleResultSend", - })?; - match self { - ArticleServiceGetArticleResultSend::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(ArticleServiceGetArticleResultSend::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(ArticleServiceGetArticleResultSend::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: "ArticleServiceGetArticleResultSend", - }) + match self { - ArticleServiceGetArticleResultSend::Ok(ref value) => { - __protocol.struct_field_len(Some(0), value) - } - } + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/enum_Status.rs b/tests/code-generation-workspace-split/rpc_article/src/article/enum_Status.rs deleted file mode 100644 index f6c6a7ae..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/enum_Status.rs +++ /dev/null @@ -1,89 +0,0 @@ -#[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] -#[derivative(Default)] -#[derive(::pilota::serde::Serialize, ::pilota::serde::Deserialize)] -#[serde(transparent)] -#[derive(Clone, PartialEq, Copy)] -#[repr(transparent)] -pub struct Status(i32); - -impl Status { - pub const NORMAL: Self = Self(0); - pub const DELETED: 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("NORMAL"), - Self(1) => ::std::string::String::from("DELETED"), - Self(val) => val.to_string(), - } - } -} - -impl ::std::convert::From for Status { - fn from(value: i32) -> Self { - Self(value) - } -} - -impl ::std::convert::From for i32 { - fn from(value: Status) -> i32 { - value.0 - } -} - -impl ::pilota::thrift::Message for Status { - 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 Status, 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 Status, value: {}", value), - ) - })?) - }) - } - - fn size(&self, __protocol: &mut T) -> usize { - #[allow(unused_imports)] - use ::pilota::thrift::TLengthProtocolExt; - __protocol.i32_len(self.inner()) - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/image/cdn/message_CDN.rs b/tests/code-generation-workspace-split/rpc_article/src/article/image/cdn/message_CDN.rs deleted file mode 100644 index 0f1acce9..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/image/cdn/message_CDN.rs +++ /dev/null @@ -1 +0,0 @@ -pub use ::common::article::image::cdn::Cdn; diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/image/cdn/mod.rs b/tests/code-generation-workspace-split/rpc_article/src/article/image/cdn/mod.rs deleted file mode 100644 index bdf630b1..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/image/cdn/mod.rs +++ /dev/null @@ -1 +0,0 @@ -include!("message_CDN.rs"); diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/image/message_Image.rs b/tests/code-generation-workspace-split/rpc_article/src/article/image/message_Image.rs deleted file mode 100644 index 3e028164..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/image/message_Image.rs +++ /dev/null @@ -1 +0,0 @@ -pub use ::common::article::image::Image; diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/image/mod.rs b/tests/code-generation-workspace-split/rpc_article/src/article/image/mod.rs deleted file mode 100644 index fae6e988..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/image/mod.rs +++ /dev/null @@ -1 +0,0 @@ -include!("message_Image.rs"); diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/message_Article.rs b/tests/code-generation-workspace-split/rpc_article/src/article/message_Article.rs deleted file mode 100644 index fa604881..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/message_Article.rs +++ /dev/null @@ -1,353 +0,0 @@ -#[derive( - PartialOrd, - Hash, - Eq, - Ord, - Debug, - Default, - ::pilota::serde::Serialize, - ::pilota::serde::Deserialize, - Clone, - PartialEq, -)] -pub struct Article { - pub id: i64, - - pub title: ::pilota::FastStr, - - pub content: ::pilota::FastStr, - - pub author: ::common::author::Author, - - pub status: Status, - - pub images: ::std::vec::Vec<::common::article::image::Image>, - - pub common_data: ::common::common::CommonData, -} -impl ::pilota::thrift::Message for Article { - 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: "Article" }; - - __protocol.write_struct_begin(&struct_ident)?; - __protocol.write_i64_field(1, *&self.id)?; - __protocol.write_faststr_field(2, (&self.title).clone())?; - __protocol.write_faststr_field(3, (&self.content).clone())?; - __protocol.write_struct_field(4, &self.author, ::pilota::thrift::TType::Struct)?; - __protocol.write_i32_field(5, (&self.status).inner())?; - __protocol.write_list_field( - 6, - ::pilota::thrift::TType::Struct, - &&self.images, - |__protocol, val| { - __protocol.write_struct(val)?; - ::std::result::Result::Ok(()) - }, - )?; - __protocol.write_struct_field(7, &self.common_data, ::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 var_2 = None; - let mut var_3 = None; - let mut var_4 = None; - let mut var_5 = None; - let mut var_6 = None; - let mut var_7 = None; - - let mut __pilota_decoding_field_id = None; - - __protocol.read_struct_begin()?; - if let ::std::result::Result::Err(mut err) = (|| { - loop { - let field_ident = __protocol.read_field_begin()?; - if field_ident.field_type == ::pilota::thrift::TType::Stop { - __protocol.field_stop_len(); - break; - } else { - __protocol.field_begin_len(field_ident.field_type, field_ident.id); - } - __pilota_decoding_field_id = field_ident.id; - match field_ident.id { - Some(1) if field_ident.field_type == ::pilota::thrift::TType::I64 => { - var_1 = Some(__protocol.read_i64()?); - } - Some(2) if field_ident.field_type == ::pilota::thrift::TType::Binary => { - var_2 = Some(__protocol.read_faststr()?); - } - Some(3) if field_ident.field_type == ::pilota::thrift::TType::Binary => { - var_3 = Some(__protocol.read_faststr()?); - } - Some(4) if field_ident.field_type == ::pilota::thrift::TType::Struct => { - var_4 = Some(::pilota::thrift::Message::decode(__protocol)?); - } - Some(5) if field_ident.field_type == ::pilota::thrift::TType::I32 => { - var_5 = Some(::pilota::thrift::Message::decode(__protocol)?); - } - Some(6) if field_ident.field_type == ::pilota::thrift::TType::List => { - var_6 = Some(unsafe { - let list_ident = __protocol.read_list_begin()?; - let mut val: Vec<::common::article::image::Image> = - Vec::with_capacity(list_ident.size); - for i in 0..list_ident.size { - val.as_mut_ptr() - .offset(i as isize) - .write(::pilota::thrift::Message::decode(__protocol)?); - } - val.set_len(list_ident.size); - __protocol.read_list_end()?; - val - }); - } - Some(7) if field_ident.field_type == ::pilota::thrift::TType::Struct => { - var_7 = 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 `Article` 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 title is required".to_string(), - )); - }; - let Some(var_3) = var_3 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field content is required".to_string(), - )); - }; - let Some(var_4) = var_4 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field author is required".to_string(), - )); - }; - let Some(var_5) = var_5 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field status is required".to_string(), - )); - }; - let Some(var_6) = var_6 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field images is required".to_string(), - )); - }; - let Some(var_7) = var_7 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field common_data is required".to_string(), - )); - }; - - let data = Self { - id: var_1, - title: var_2, - content: var_3, - author: var_4, - status: var_5, - images: var_6, - common_data: var_7, - }; - ::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 var_3 = None; - let mut var_4 = None; - let mut var_5 = None; - let mut var_6 = None; - let mut var_7 = None; - - let mut __pilota_decoding_field_id = None; - - __protocol.read_struct_begin().await?; - if let ::std::result::Result::Err(mut err) = async { - loop { - - - let field_ident = __protocol.read_field_begin().await?; - if field_ident.field_type == ::pilota::thrift::TType::Stop { - - break; - } else { - - } - __pilota_decoding_field_id = field_ident.id; - match field_ident.id { - Some(1) if field_ident.field_type == ::pilota::thrift::TType::I64 => { - var_1 = Some(__protocol.read_i64().await?); - - },Some(2) if field_ident.field_type == ::pilota::thrift::TType::Binary => { - var_2 = Some(__protocol.read_faststr().await?); - - },Some(3) if field_ident.field_type == ::pilota::thrift::TType::Binary => { - var_3 = Some(__protocol.read_faststr().await?); - - },Some(4) if field_ident.field_type == ::pilota::thrift::TType::Struct => { - var_4 = Some(<::common::author::Author as ::pilota::thrift::Message>::decode_async(__protocol).await?); - - },Some(5) if field_ident.field_type == ::pilota::thrift::TType::I32 => { - var_5 = Some(::decode_async(__protocol).await?); - - },Some(6) if field_ident.field_type == ::pilota::thrift::TType::List => { - var_6 = Some({ - let list_ident = __protocol.read_list_begin().await?; - let mut val = Vec::with_capacity(list_ident.size); - for _ in 0..list_ident.size { - val.push(<::common::article::image::Image as ::pilota::thrift::Message>::decode_async(__protocol).await?); - }; - __protocol.read_list_end().await?; - val - }); - - },Some(7) if field_ident.field_type == ::pilota::thrift::TType::Struct => { - var_7 = Some(<::common::common::CommonData as ::pilota::thrift::Message>::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 `Article` 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 title is required".to_string(), - )); - }; - let Some(var_3) = var_3 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field content is required".to_string(), - )); - }; - let Some(var_4) = var_4 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field author is required".to_string(), - )); - }; - let Some(var_5) = var_5 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field status is required".to_string(), - )); - }; - let Some(var_6) = var_6 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field images is required".to_string(), - )); - }; - let Some(var_7) = var_7 else { - return ::std::result::Result::Err(::pilota::thrift::new_protocol_exception( - ::pilota::thrift::ProtocolExceptionKind::InvalidData, - "field common_data is required".to_string(), - )); - }; - - let data = Self { - id: var_1, - title: var_2, - content: var_3, - author: var_4, - status: var_5, - images: var_6, - common_data: var_7, - }; - ::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: "Article" }) - + __protocol.i64_field_len(Some(1), *&self.id) - + __protocol.faststr_field_len(Some(2), &self.title) - + __protocol.faststr_field_len(Some(3), &self.content) - + __protocol.struct_field_len(Some(4), &self.author) - + __protocol.i32_field_len(Some(5), (&self.status).inner()) - + __protocol.list_field_len( - Some(6), - ::pilota::thrift::TType::Struct, - &self.images, - |__protocol, el| __protocol.struct_len(el), - ) - + __protocol.struct_field_len(Some(7), &self.common_data) - + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/message_ArticleServiceGetArticleArgsRecv.rs b/tests/code-generation-workspace-split/rpc_article/src/article/message_ArticleServiceGetArticleArgsRecv.rs deleted file mode 100644 index 4d330cf4..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/message_ArticleServiceGetArticleArgsRecv.rs +++ /dev/null @@ -1,159 +0,0 @@ -#[derive( - PartialOrd, - Hash, - Eq, - Ord, - Debug, - Default, - ::pilota::serde::Serialize, - ::pilota::serde::Deserialize, - Clone, - PartialEq, -)] -pub struct ArticleServiceGetArticleArgsRecv { - pub req: GetArticleRequest, -} -impl ::pilota::thrift::Message for ArticleServiceGetArticleArgsRecv { - 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: "ArticleServiceGetArticleArgsRecv", - }; - - __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 `ArticleServiceGetArticleArgsRecv` 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 `ArticleServiceGetArticleArgsRecv` 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: "ArticleServiceGetArticleArgsRecv", - }) + __protocol.struct_field_len(Some(1), &self.req) - + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/message_ArticleServiceGetArticleArgsSend.rs b/tests/code-generation-workspace-split/rpc_article/src/article/message_ArticleServiceGetArticleArgsSend.rs deleted file mode 100644 index b4a4c806..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/message_ArticleServiceGetArticleArgsSend.rs +++ /dev/null @@ -1,159 +0,0 @@ -#[derive( - PartialOrd, - Hash, - Eq, - Ord, - Debug, - Default, - ::pilota::serde::Serialize, - ::pilota::serde::Deserialize, - Clone, - PartialEq, -)] -pub struct ArticleServiceGetArticleArgsSend { - pub req: GetArticleRequest, -} -impl ::pilota::thrift::Message for ArticleServiceGetArticleArgsSend { - 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: "ArticleServiceGetArticleArgsSend", - }; - - __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 `ArticleServiceGetArticleArgsSend` 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 `ArticleServiceGetArticleArgsSend` 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: "ArticleServiceGetArticleArgsSend", - }) + __protocol.struct_field_len(Some(1), &self.req) - + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/message_GetArticleRequest.rs b/tests/code-generation-workspace-split/rpc_article/src/article/message_GetArticleRequest.rs deleted file mode 100644 index 8374192c..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/message_GetArticleRequest.rs +++ /dev/null @@ -1,160 +0,0 @@ -#[derive( - PartialOrd, - Hash, - Eq, - Ord, - Debug, - Default, - ::pilota::serde::Serialize, - ::pilota::serde::Deserialize, - Clone, - PartialEq, -)] -pub struct GetArticleRequest { - pub id: i64, -} -impl ::pilota::thrift::Message for GetArticleRequest { - 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: "GetArticleRequest", - }; - - __protocol.write_struct_begin(&struct_ident)?; - __protocol.write_i64_field(1, *&self.id)?; - __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::I64 => { - var_1 = Some(__protocol.read_i64()?); - } - _ => { - __protocol.skip(field_ident.field_type)?; - } - } - - __protocol.read_field_end()?; - __protocol.field_end_len(); - } - ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) - })() { - if let Some(field_id) = __pilota_decoding_field_id { - err.prepend_msg(&format!( - "decode struct `GetArticleRequest` 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 data = Self { id: 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::I64 => { - var_1 = Some(__protocol.read_i64().await?); - } - _ => { - __protocol.skip(field_ident.field_type).await?; - } - } - - __protocol.read_field_end().await?; - } - ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) - } - .await - { - if let Some(field_id) = __pilota_decoding_field_id { - err.prepend_msg(&format!( - "decode struct `GetArticleRequest` 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 data = Self { id: 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: "GetArticleRequest", - }) + __protocol.i64_field_len(Some(1), *&self.id) - + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/message_GetArticleResponse.rs b/tests/code-generation-workspace-split/rpc_article/src/article/message_GetArticleResponse.rs deleted file mode 100644 index 1b7a27ce..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/message_GetArticleResponse.rs +++ /dev/null @@ -1,163 +0,0 @@ -#[derive( - PartialOrd, - Hash, - Eq, - Ord, - Debug, - Default, - ::pilota::serde::Serialize, - ::pilota::serde::Deserialize, - Clone, - PartialEq, -)] -pub struct GetArticleResponse { - pub article: Article, -} -impl ::pilota::thrift::Message for GetArticleResponse { - 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: "GetArticleResponse", - }; - - __protocol.write_struct_begin(&struct_ident)?; - __protocol.write_struct_field(1, &self.article, ::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 `GetArticleResponse` 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 article is required".to_string(), - )); - }; - - let data = Self { article: 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 `GetArticleResponse` 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 article is required".to_string(), - )); - }; - - let data = Self { article: 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: "GetArticleResponse", - }) + __protocol.struct_field_len(Some(1), &self.article) - + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/mod.rs b/tests/code-generation-workspace-split/rpc_article/src/article/mod.rs deleted file mode 100644 index 17ef1436..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/mod.rs +++ /dev/null @@ -1,10 +0,0 @@ -include!("enum_Status.rs"); -include!("message_Article.rs"); -include!("enum_ArticleServiceGetArticleResultSend.rs"); -include!("message_GetArticleResponse.rs"); -include!("message_ArticleServiceGetArticleArgsRecv.rs"); -include!("service_articleService.rs"); -include!("message_ArticleServiceGetArticleArgsSend.rs"); -include!("message_GetArticleRequest.rs"); -include!("service_ArticleService_2.rs"); -include!("enum_ArticleServiceGetArticleResultRecv.rs"); diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/service_ArticleService.rs b/tests/code-generation-workspace-split/rpc_article/src/article/service_ArticleService.rs deleted file mode 100644 index ff39d128..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/service_ArticleService.rs +++ /dev/null @@ -1,3 +0,0 @@ - -pub trait articleService {} -include!("articleService_0/mod.rs"); diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/service_ArticleService_2.rs b/tests/code-generation-workspace-split/rpc_article/src/article/service_ArticleService_2.rs deleted file mode 100644 index b10faf62..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/service_ArticleService_2.rs +++ /dev/null @@ -1,10 +0,0 @@ - -pub trait ArticleService { - fn get_article( - &self, - req: GetArticleRequest, - ) -> impl ::std::future::Future< - Output = ::core::result::Result, - > + Send; -} -include!("ArticleService_1/mod.rs"); diff --git a/tests/code-generation-workspace-split/rpc_article/src/article/service_articleService.rs b/tests/code-generation-workspace-split/rpc_article/src/article/service_articleService.rs deleted file mode 100644 index ff39d128..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/article/service_articleService.rs +++ /dev/null @@ -1,3 +0,0 @@ - -pub trait articleService {} -include!("articleService_0/mod.rs"); diff --git a/tests/code-generation-workspace-split/rpc_article/src/author/message_Author.rs b/tests/code-generation-workspace-split/rpc_article/src/author/message_Author.rs deleted file mode 100644 index 979682c3..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/author/message_Author.rs +++ /dev/null @@ -1 +0,0 @@ -pub use ::common::author::Author; diff --git a/tests/code-generation-workspace-split/rpc_article/src/author/mod.rs b/tests/code-generation-workspace-split/rpc_article/src/author/mod.rs deleted file mode 100644 index bc027b9a..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/author/mod.rs +++ /dev/null @@ -1 +0,0 @@ -include!("message_Author.rs"); diff --git a/tests/code-generation-workspace-split/rpc_article/src/common/message_CommonData.rs b/tests/code-generation-workspace-split/rpc_article/src/common/message_CommonData.rs deleted file mode 100644 index 501acfed..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/common/message_CommonData.rs +++ /dev/null @@ -1 +0,0 @@ -pub use ::common::common::CommonData; diff --git a/tests/code-generation-workspace-split/rpc_article/src/common/mod.rs b/tests/code-generation-workspace-split/rpc_article/src/common/mod.rs deleted file mode 100644 index 5e2006a4..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/common/mod.rs +++ /dev/null @@ -1 +0,0 @@ -include!("message_CommonData.rs"); diff --git a/tests/code-generation-workspace-split/rpc_article/src/gen.rs b/tests/code-generation-workspace-split/rpc_article/src/gen.rs deleted file mode 100644 index 4ab5d758..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/gen.rs +++ /dev/null @@ -1,24 +0,0 @@ -pub mod gen { - #![allow(warnings, clippy::all)] - - pub mod article { - include!("article/mod.rs"); - - pub mod image { - include!("article/image/mod.rs"); - - pub mod cdn { - include!("article/image/cdn/mod.rs"); - } - } - } - - pub mod author { - include!("author/mod.rs"); - } - - pub mod common { - include!("common/mod.rs"); - } - pub use article::*; -} diff --git a/tests/code-generation-workspace-split/rpc_article/src/lib.rs b/tests/code-generation-workspace-split/rpc_article/src/lib.rs deleted file mode 100644 index 3a85e855..00000000 --- a/tests/code-generation-workspace-split/rpc_article/src/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -include!("gen.rs"); -pub use gen::*; diff --git a/tests/code-generation-workspace-split/rpc_author/Cargo.toml b/tests/code-generation-workspace-split/rpc_author/Cargo.toml deleted file mode 100644 index b4b7da57..00000000 --- a/tests/code-generation-workspace-split/rpc_author/Cargo.toml +++ /dev/null @@ -1,31 +0,0 @@ -[dependencies.anyhow] -workspace = true - -[dependencies.async-trait] -workspace = true - -[dependencies.common] -path = "../common" - -[dependencies.lazy_static] -workspace = true - -[dependencies.pilota] -workspace = true - -[dependencies.serde] -workspace = true - -[dependencies.volo] -workspace = true - -[dependencies.volo-build] -workspace = true - -[dependencies.volo-thrift] -workspace = true - -[package] -edition = "2021" -name = "rpc_author" -version = "0.1.0" diff --git a/tests/code-generation-workspace-split/rpc_author/src/article/image/cdn/message_CDN.rs b/tests/code-generation-workspace-split/rpc_author/src/article/image/cdn/message_CDN.rs deleted file mode 100644 index 0f1acce9..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/article/image/cdn/message_CDN.rs +++ /dev/null @@ -1 +0,0 @@ -pub use ::common::article::image::cdn::Cdn; diff --git a/tests/code-generation-workspace-split/rpc_author/src/article/image/cdn/mod.rs b/tests/code-generation-workspace-split/rpc_author/src/article/image/cdn/mod.rs deleted file mode 100644 index bdf630b1..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/article/image/cdn/mod.rs +++ /dev/null @@ -1 +0,0 @@ -include!("message_CDN.rs"); diff --git a/tests/code-generation-workspace-split/rpc_author/src/article/image/message_Image.rs b/tests/code-generation-workspace-split/rpc_author/src/article/image/message_Image.rs deleted file mode 100644 index 3e028164..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/article/image/message_Image.rs +++ /dev/null @@ -1 +0,0 @@ -pub use ::common::article::image::Image; diff --git a/tests/code-generation-workspace-split/rpc_author/src/article/image/mod.rs b/tests/code-generation-workspace-split/rpc_author/src/article/image/mod.rs deleted file mode 100644 index fae6e988..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/article/image/mod.rs +++ /dev/null @@ -1 +0,0 @@ -include!("message_Image.rs"); diff --git a/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/enum_AuthorServiceRequestRecv.rs b/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/enum_AuthorServiceRequestRecv.rs deleted file mode 100644 index dcaca22d..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/enum_AuthorServiceRequestRecv.rs +++ /dev/null @@ -1,58 +0,0 @@ -#[derive(Debug, Clone)] -pub enum AuthorServiceRequestRecv { - GetAuthor(AuthorServiceGetAuthorArgsRecv), -} - -impl ::volo_thrift::EntryMessage for AuthorServiceRequestRecv { - fn encode( - &self, - __protocol: &mut T, - ) -> ::core::result::Result<(), ::pilota::thrift::ThriftException> { - match self { - Self::GetAuthor(value) => { - ::pilota::thrift::Message::encode(value, __protocol).map_err(|err| err.into()) - } - } - } - - fn decode( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetAuthor" => Self::GetAuthor(::pilota::thrift::Message::decode(__protocol)?), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - async fn decode_async( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetAuthor" => Self::GetAuthor( - ::decode_async( - __protocol, - ) - .await?, - ), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - fn size(&self, __protocol: &mut T) -> usize { - match self { - Self::GetAuthor(value) => ::volo_thrift::Message::size(value, __protocol), - } - } -} diff --git a/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/enum_AuthorServiceRequestSend.rs b/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/enum_AuthorServiceRequestSend.rs deleted file mode 100644 index ab747765..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/enum_AuthorServiceRequestSend.rs +++ /dev/null @@ -1,58 +0,0 @@ -#[derive(Debug, Clone)] -pub enum AuthorServiceRequestSend { - GetAuthor(AuthorServiceGetAuthorArgsSend), -} - -impl ::volo_thrift::EntryMessage for AuthorServiceRequestSend { - fn encode( - &self, - __protocol: &mut T, - ) -> ::core::result::Result<(), ::pilota::thrift::ThriftException> { - match self { - Self::GetAuthor(value) => { - ::pilota::thrift::Message::encode(value, __protocol).map_err(|err| err.into()) - } - } - } - - fn decode( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetAuthor" => Self::GetAuthor(::pilota::thrift::Message::decode(__protocol)?), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - async fn decode_async( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetAuthor" => Self::GetAuthor( - ::decode_async( - __protocol, - ) - .await?, - ), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - fn size(&self, __protocol: &mut T) -> usize { - match self { - Self::GetAuthor(value) => ::volo_thrift::Message::size(value, __protocol), - } - } -} diff --git a/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/enum_AuthorServiceResponseRecv.rs b/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/enum_AuthorServiceResponseRecv.rs deleted file mode 100644 index 94dae082..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/enum_AuthorServiceResponseRecv.rs +++ /dev/null @@ -1,57 +0,0 @@ -#[derive(Debug, Clone)] -pub enum AuthorServiceResponseRecv { - GetAuthor(AuthorServiceGetAuthorResultRecv), -} -impl ::volo_thrift::EntryMessage for AuthorServiceResponseRecv { - fn encode( - &self, - __protocol: &mut T, - ) -> ::core::result::Result<(), ::pilota::thrift::ThriftException> { - match self { - Self::GetAuthor(value) => { - ::pilota::thrift::Message::encode(value, __protocol).map_err(|err| err.into()) - } - } - } - - fn decode( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetAuthor" => Self::GetAuthor(::pilota::thrift::Message::decode(__protocol)?), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - async fn decode_async( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetAuthor" => Self::GetAuthor( - ::decode_async( - __protocol, - ) - .await?, - ), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - fn size(&self, __protocol: &mut T) -> usize { - match self { - Self::GetAuthor(value) => ::volo_thrift::Message::size(value, __protocol), - } - } -} diff --git a/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/enum_AuthorServiceResponseSend.rs b/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/enum_AuthorServiceResponseSend.rs deleted file mode 100644 index 6446ad95..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/enum_AuthorServiceResponseSend.rs +++ /dev/null @@ -1,58 +0,0 @@ -#[derive(Debug, Clone)] -pub enum AuthorServiceResponseSend { - GetAuthor(AuthorServiceGetAuthorResultSend), -} - -impl ::volo_thrift::EntryMessage for AuthorServiceResponseSend { - fn encode( - &self, - __protocol: &mut T, - ) -> ::core::result::Result<(), ::pilota::thrift::ThriftException> { - match self { - Self::GetAuthor(value) => { - ::pilota::thrift::Message::encode(value, __protocol).map_err(|err| err.into()) - } - } - } - - fn decode( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetAuthor" => Self::GetAuthor(::pilota::thrift::Message::decode(__protocol)?), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - async fn decode_async( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetAuthor" => Self::GetAuthor( - ::decode_async( - __protocol, - ) - .await?, - ), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - fn size(&self, __protocol: &mut T) -> usize { - match self { - Self::GetAuthor(value) => ::volo_thrift::Message::size(value, __protocol), - } - } -} diff --git a/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/mod.rs b/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/mod.rs deleted file mode 100644 index 6a3dc9b5..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -include!("service_AuthorServiceServer.rs"); -include!("service_AuthorServiceClient.rs"); -include!("enum_AuthorServiceRequestRecv.rs"); -include!("enum_AuthorServiceResponseRecv.rs"); -include!("enum_AuthorServiceRequestSend.rs"); -include!("enum_AuthorServiceResponseSend.rs"); diff --git a/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/service_AuthorServiceClient.rs b/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/service_AuthorServiceClient.rs deleted file mode 100644 index bde4723b..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/service_AuthorServiceClient.rs +++ /dev/null @@ -1,127 +0,0 @@ -pub struct MkAuthorServiceGenericClient; - -pub type AuthorServiceClient = AuthorServiceGenericClient< - ::volo::service::BoxCloneService< - ::volo_thrift::context::ClientContext, - AuthorServiceRequestSend, - ::std::option::Option, - ::volo_thrift::ClientError, - >, ->; - -impl ::volo::client::MkClient<::volo_thrift::Client> for MkAuthorServiceGenericClient { - type Target = AuthorServiceGenericClient; - fn mk_client(&self, service: ::volo_thrift::Client) -> Self::Target { - AuthorServiceGenericClient(service) - } -} - -#[derive(Clone)] -pub struct AuthorServiceGenericClient(pub ::volo_thrift::Client); - -pub struct AuthorServiceOneShotClient(pub ::volo_thrift::Client); - -impl< - S: ::volo::service::Service< - ::volo_thrift::context::ClientContext, - AuthorServiceRequestSend, - Response = ::std::option::Option, - Error = ::volo_thrift::ClientError, - > + Send - + Sync - + 'static, - > AuthorServiceGenericClient -{ - pub fn with_callopt>( - self, - opt: Opt, - ) -> AuthorServiceOneShotClient<::volo::client::WithOptService> { - AuthorServiceOneShotClient(self.0.with_opt(opt)) - } - - pub async fn get_author( - &self, - req: GetAuthorRequest, - ) -> ::std::result::Result { - let req = AuthorServiceRequestSend::GetAuthor(AuthorServiceGetAuthorArgsSend { req }); - let mut cx = self.0.make_cx("GetAuthor", false); - #[allow(unreachable_patterns)] - let resp = match ::volo::service::Service::call(&self.0, &mut cx, req).await? { - Some(AuthorServiceResponseRecv::GetAuthor(AuthorServiceGetAuthorResultRecv::Ok( - resp, - ))) => ::std::result::Result::Ok(resp), - None => unreachable!(), - _ => unreachable!(), - }; - ::volo_thrift::context::CLIENT_CONTEXT_CACHE.with(|cache| { - let mut cache = cache.borrow_mut(); - if cache.len() < cache.capacity() { - cache.push(cx); - } - }); - resp - } -} - -impl< - S: ::volo::client::OneShotService< - ::volo_thrift::context::ClientContext, - AuthorServiceRequestSend, - Response = ::std::option::Option, - Error = ::volo_thrift::ClientError, - > + Send - + Sync - + 'static, - > AuthorServiceOneShotClient -{ - pub async fn get_author( - self, - req: GetAuthorRequest, - ) -> ::std::result::Result { - let req = AuthorServiceRequestSend::GetAuthor(AuthorServiceGetAuthorArgsSend { req }); - let mut cx = self.0.make_cx("GetAuthor", false); - #[allow(unreachable_patterns)] - let resp = match ::volo::client::OneShotService::call(self.0, &mut cx, req).await? { - Some(AuthorServiceResponseRecv::GetAuthor(AuthorServiceGetAuthorResultRecv::Ok( - resp, - ))) => ::std::result::Result::Ok(resp), - None => unreachable!(), - _ => unreachable!(), - }; - ::volo_thrift::context::CLIENT_CONTEXT_CACHE.with(|cache| { - let mut cache = cache.borrow_mut(); - if cache.len() < cache.capacity() { - cache.push(cx); - } - }); - resp - } -} - -pub struct AuthorServiceClientBuilder {} - -impl AuthorServiceClientBuilder { - pub fn new( - service_name: impl AsRef, - ) -> ::volo_thrift::client::ClientBuilder< - ::volo::layer::Identity, - ::volo::layer::Identity, - MkAuthorServiceGenericClient, - AuthorServiceRequestSend, - AuthorServiceResponseRecv, - ::volo::net::dial::DefaultMakeTransport, - ::volo_thrift::codec::default::DefaultMakeCodec< - ::volo_thrift::codec::default::ttheader::MakeTTHeaderCodec< - ::volo_thrift::codec::default::framed::MakeFramedCodec< - ::volo_thrift::codec::default::thrift::MakeThriftCodec, - >, - >, - >, - ::volo::loadbalance::LbConfig< - ::volo::loadbalance::random::WeightedRandomBalance<()>, - ::volo::discovery::DummyDiscover, - >, - > { - ::volo_thrift::client::ClientBuilder::new(service_name, MkAuthorServiceGenericClient) - } -} diff --git a/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/service_AuthorServiceServer.rs b/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/service_AuthorServiceServer.rs deleted file mode 100644 index ce2ea976..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/author/AuthorService/service_AuthorServiceServer.rs +++ /dev/null @@ -1,50 +0,0 @@ -pub struct AuthorServiceServer { - inner: S, // handler -} - -impl AuthorServiceServer -where - S: AuthorService + ::core::marker::Send + ::core::marker::Sync + 'static, -{ - pub fn new( - inner: S, - ) -> ::volo_thrift::server::Server< - Self, - ::volo::layer::Identity, - AuthorServiceRequestRecv, - ::volo_thrift::codec::default::DefaultMakeCodec< - ::volo_thrift::codec::default::ttheader::MakeTTHeaderCodec< - ::volo_thrift::codec::default::framed::MakeFramedCodec< - ::volo_thrift::codec::default::thrift::MakeThriftCodec, - >, - >, - >, - ::volo_thrift::tracing::DefaultProvider, - > { - ::volo_thrift::server::Server::new(Self { inner }) - } -} - -impl ::volo::service::Service<::volo_thrift::context::ServerContext, AuthorServiceRequestRecv> - for AuthorServiceServer -where - T: AuthorService + Send + Sync + 'static, -{ - type Response = AuthorServiceResponseSend; - type Error = ::volo_thrift::ServerError; - - async fn call<'s, 'cx>( - &'s self, - _cx: &'cx mut ::volo_thrift::context::ServerContext, - req: AuthorServiceRequestRecv, - ) -> ::std::result::Result { - match req { - AuthorServiceRequestRecv::GetAuthor(args) => ::std::result::Result::Ok( - AuthorServiceResponseSend::GetAuthor(match self.inner.get_author(args.req).await { - ::std::result::Result::Ok(resp) => AuthorServiceGetAuthorResultSend::Ok(resp), - ::std::result::Result::Err(err) => return ::std::result::Result::Err(err), - }), - ), - } - } -} diff --git a/tests/code-generation-workspace-split/rpc_author/src/author/enum_AuthorServiceGetAuthorResultRecv.rs b/tests/code-generation-workspace-split/rpc_author/src/author/enum_AuthorServiceGetAuthorResultRecv.rs deleted file mode 100644 index 78ed47d4..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/author/enum_AuthorServiceGetAuthorResultRecv.rs +++ /dev/null @@ -1,144 +0,0 @@ -#[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] -#[derivative(Default)] -#[derive(::pilota::serde::Serialize, ::pilota::serde::Deserialize, Clone, PartialEq)] -pub enum AuthorServiceGetAuthorResultRecv { - #[derivative(Default)] - Ok(GetAuthorResponse), -} - -impl ::pilota::thrift::Message for AuthorServiceGetAuthorResultRecv { - 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: "AuthorServiceGetAuthorResultRecv", - })?; - match self { - AuthorServiceGetAuthorResultRecv::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(AuthorServiceGetAuthorResultRecv::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(AuthorServiceGetAuthorResultRecv::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: "AuthorServiceGetAuthorResultRecv", - }) + match self { - AuthorServiceGetAuthorResultRecv::Ok(ref value) => { - __protocol.struct_field_len(Some(0), value) - } - } + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/rpc_author/src/author/enum_AuthorServiceGetAuthorResultSend.rs b/tests/code-generation-workspace-split/rpc_author/src/author/enum_AuthorServiceGetAuthorResultSend.rs deleted file mode 100644 index 6a4e24b4..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/author/enum_AuthorServiceGetAuthorResultSend.rs +++ /dev/null @@ -1,144 +0,0 @@ -#[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] -#[derivative(Default)] -#[derive(::pilota::serde::Serialize, ::pilota::serde::Deserialize, Clone, PartialEq)] -pub enum AuthorServiceGetAuthorResultSend { - #[derivative(Default)] - Ok(GetAuthorResponse), -} - -impl ::pilota::thrift::Message for AuthorServiceGetAuthorResultSend { - 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: "AuthorServiceGetAuthorResultSend", - })?; - match self { - AuthorServiceGetAuthorResultSend::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(AuthorServiceGetAuthorResultSend::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(AuthorServiceGetAuthorResultSend::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: "AuthorServiceGetAuthorResultSend", - }) + match self { - AuthorServiceGetAuthorResultSend::Ok(ref value) => { - __protocol.struct_field_len(Some(0), value) - } - } + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/rpc_author/src/author/message_Author.rs b/tests/code-generation-workspace-split/rpc_author/src/author/message_Author.rs deleted file mode 100644 index 979682c3..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/author/message_Author.rs +++ /dev/null @@ -1 +0,0 @@ -pub use ::common::author::Author; diff --git a/tests/code-generation-workspace-split/rpc_author/src/author/message_AuthorServiceGetAuthorArgsRecv.rs b/tests/code-generation-workspace-split/rpc_author/src/author/message_AuthorServiceGetAuthorArgsRecv.rs deleted file mode 100644 index a8a72e61..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/author/message_AuthorServiceGetAuthorArgsRecv.rs +++ /dev/null @@ -1,162 +0,0 @@ -#[derive( - PartialOrd, - Hash, - Eq, - Ord, - Debug, - Default, - ::pilota::serde::Serialize, - ::pilota::serde::Deserialize, - Clone, - PartialEq, -)] -pub struct AuthorServiceGetAuthorArgsRecv { - pub req: GetAuthorRequest, -} -impl ::pilota::thrift::Message for AuthorServiceGetAuthorArgsRecv { - 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: "AuthorServiceGetAuthorArgsRecv", - }; - - __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 `AuthorServiceGetAuthorArgsRecv` 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 `AuthorServiceGetAuthorArgsRecv` 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: "AuthorServiceGetAuthorArgsRecv", - }) + __protocol.struct_field_len(Some(1), &self.req) - + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/rpc_author/src/author/message_AuthorServiceGetAuthorArgsSend.rs b/tests/code-generation-workspace-split/rpc_author/src/author/message_AuthorServiceGetAuthorArgsSend.rs deleted file mode 100644 index c6a98c56..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/author/message_AuthorServiceGetAuthorArgsSend.rs +++ /dev/null @@ -1,162 +0,0 @@ -#[derive( - PartialOrd, - Hash, - Eq, - Ord, - Debug, - Default, - ::pilota::serde::Serialize, - ::pilota::serde::Deserialize, - Clone, - PartialEq, -)] -pub struct AuthorServiceGetAuthorArgsSend { - pub req: GetAuthorRequest, -} -impl ::pilota::thrift::Message for AuthorServiceGetAuthorArgsSend { - 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: "AuthorServiceGetAuthorArgsSend", - }; - - __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 `AuthorServiceGetAuthorArgsSend` 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 `AuthorServiceGetAuthorArgsSend` 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: "AuthorServiceGetAuthorArgsSend", - }) + __protocol.struct_field_len(Some(1), &self.req) - + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/rpc_author/src/author/message_GetAuthorRequest.rs b/tests/code-generation-workspace-split/rpc_author/src/author/message_GetAuthorRequest.rs deleted file mode 100644 index a6de9c9d..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/author/message_GetAuthorRequest.rs +++ /dev/null @@ -1,160 +0,0 @@ -#[derive( - PartialOrd, - Hash, - Eq, - Ord, - Debug, - Default, - ::pilota::serde::Serialize, - ::pilota::serde::Deserialize, - Clone, - PartialEq, -)] -pub struct GetAuthorRequest { - pub id: i64, -} -impl ::pilota::thrift::Message for GetAuthorRequest { - 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: "GetAuthorRequest", - }; - - __protocol.write_struct_begin(&struct_ident)?; - __protocol.write_i64_field(1, *&self.id)?; - __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::I64 => { - var_1 = Some(__protocol.read_i64()?); - } - _ => { - __protocol.skip(field_ident.field_type)?; - } - } - - __protocol.read_field_end()?; - __protocol.field_end_len(); - } - ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) - })() { - if let Some(field_id) = __pilota_decoding_field_id { - err.prepend_msg(&format!( - "decode struct `GetAuthorRequest` 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 data = Self { id: 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::I64 => { - var_1 = Some(__protocol.read_i64().await?); - } - _ => { - __protocol.skip(field_ident.field_type).await?; - } - } - - __protocol.read_field_end().await?; - } - ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) - } - .await - { - if let Some(field_id) = __pilota_decoding_field_id { - err.prepend_msg(&format!( - "decode struct `GetAuthorRequest` 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 data = Self { id: 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: "GetAuthorRequest", - }) + __protocol.i64_field_len(Some(1), *&self.id) - + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/rpc_author/src/author/message_GetAuthorResponse.rs b/tests/code-generation-workspace-split/rpc_author/src/author/message_GetAuthorResponse.rs deleted file mode 100644 index cad552f3..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/author/message_GetAuthorResponse.rs +++ /dev/null @@ -1,163 +0,0 @@ -#[derive( - PartialOrd, - Hash, - Eq, - Ord, - Debug, - Default, - ::pilota::serde::Serialize, - ::pilota::serde::Deserialize, - Clone, - PartialEq, -)] -pub struct GetAuthorResponse { - pub author: ::common::author::Author, -} -impl ::pilota::thrift::Message for GetAuthorResponse { - 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: "GetAuthorResponse", - }; - - __protocol.write_struct_begin(&struct_ident)?; - __protocol.write_struct_field(1, &self.author, ::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 `GetAuthorResponse` 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 author is required".to_string(), - )); - }; - - let data = Self { author: 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(<::common::author::Author as ::pilota::thrift::Message>::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 `GetAuthorResponse` 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 author is required".to_string(), - )); - }; - - let data = Self { author: 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: "GetAuthorResponse", - }) + __protocol.struct_field_len(Some(1), &self.author) - + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/rpc_author/src/author/mod.rs b/tests/code-generation-workspace-split/rpc_author/src/author/mod.rs deleted file mode 100644 index 10632057..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/author/mod.rs +++ /dev/null @@ -1,8 +0,0 @@ -include!("enum_AuthorServiceGetAuthorResultSend.rs"); -include!("message_GetAuthorResponse.rs"); -include!("message_AuthorServiceGetAuthorArgsRecv.rs"); -include!("message_AuthorServiceGetAuthorArgsSend.rs"); -include!("message_GetAuthorRequest.rs"); -include!("service_AuthorService.rs"); -include!("enum_AuthorServiceGetAuthorResultRecv.rs"); -include!("message_Author.rs"); diff --git a/tests/code-generation-workspace-split/rpc_author/src/author/service_AuthorService.rs b/tests/code-generation-workspace-split/rpc_author/src/author/service_AuthorService.rs deleted file mode 100644 index e7289465..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/author/service_AuthorService.rs +++ /dev/null @@ -1,10 +0,0 @@ - -pub trait AuthorService { - fn get_author( - &self, - req: GetAuthorRequest, - ) -> impl ::std::future::Future< - Output = ::core::result::Result, - > + Send; -} -include!("AuthorService/mod.rs"); diff --git a/tests/code-generation-workspace-split/rpc_author/src/common/message_CommonData.rs b/tests/code-generation-workspace-split/rpc_author/src/common/message_CommonData.rs deleted file mode 100644 index 501acfed..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/common/message_CommonData.rs +++ /dev/null @@ -1 +0,0 @@ -pub use ::common::common::CommonData; diff --git a/tests/code-generation-workspace-split/rpc_author/src/common/mod.rs b/tests/code-generation-workspace-split/rpc_author/src/common/mod.rs deleted file mode 100644 index 5e2006a4..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/common/mod.rs +++ /dev/null @@ -1 +0,0 @@ -include!("message_CommonData.rs"); diff --git a/tests/code-generation-workspace-split/rpc_author/src/gen.rs b/tests/code-generation-workspace-split/rpc_author/src/gen.rs deleted file mode 100644 index baf10c7e..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/gen.rs +++ /dev/null @@ -1,23 +0,0 @@ -pub mod gen { - #![allow(warnings, clippy::all)] - - pub mod article { - - pub mod image { - include!("article/image/mod.rs"); - - pub mod cdn { - include!("article/image/cdn/mod.rs"); - } - } - } - - pub mod author { - include!("author/mod.rs"); - } - - pub mod common { - include!("common/mod.rs"); - } - pub use author::*; -} diff --git a/tests/code-generation-workspace-split/rpc_author/src/lib.rs b/tests/code-generation-workspace-split/rpc_author/src/lib.rs deleted file mode 100644 index 3a85e855..00000000 --- a/tests/code-generation-workspace-split/rpc_author/src/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -include!("gen.rs"); -pub use gen::*; diff --git a/tests/code-generation-workspace-split/rpc_image/Cargo.toml b/tests/code-generation-workspace-split/rpc_image/Cargo.toml deleted file mode 100644 index dc390210..00000000 --- a/tests/code-generation-workspace-split/rpc_image/Cargo.toml +++ /dev/null @@ -1,31 +0,0 @@ -[dependencies.anyhow] -workspace = true - -[dependencies.async-trait] -workspace = true - -[dependencies.common] -path = "../common" - -[dependencies.lazy_static] -workspace = true - -[dependencies.pilota] -workspace = true - -[dependencies.serde] -workspace = true - -[dependencies.volo] -workspace = true - -[dependencies.volo-build] -workspace = true - -[dependencies.volo-thrift] -workspace = true - -[package] -edition = "2021" -name = "rpc_image" -version = "0.1.0" diff --git a/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/enum_ImageServiceRequestRecv.rs b/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/enum_ImageServiceRequestRecv.rs deleted file mode 100644 index 3e78f208..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/enum_ImageServiceRequestRecv.rs +++ /dev/null @@ -1,58 +0,0 @@ -#[derive(Debug, Clone)] -pub enum ImageServiceRequestRecv { - GetImage(ImageServiceGetImageArgsRecv), -} - -impl ::volo_thrift::EntryMessage for ImageServiceRequestRecv { - fn encode( - &self, - __protocol: &mut T, - ) -> ::core::result::Result<(), ::pilota::thrift::ThriftException> { - match self { - Self::GetImage(value) => { - ::pilota::thrift::Message::encode(value, __protocol).map_err(|err| err.into()) - } - } - } - - fn decode( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetImage" => Self::GetImage(::pilota::thrift::Message::decode(__protocol)?), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - async fn decode_async( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetImage" => Self::GetImage( - ::decode_async( - __protocol, - ) - .await?, - ), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - fn size(&self, __protocol: &mut T) -> usize { - match self { - Self::GetImage(value) => ::volo_thrift::Message::size(value, __protocol), - } - } -} diff --git a/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/enum_ImageServiceRequestSend.rs b/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/enum_ImageServiceRequestSend.rs deleted file mode 100644 index c85b1325..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/enum_ImageServiceRequestSend.rs +++ /dev/null @@ -1,58 +0,0 @@ -#[derive(Debug, Clone)] -pub enum ImageServiceRequestSend { - GetImage(ImageServiceGetImageArgsSend), -} - -impl ::volo_thrift::EntryMessage for ImageServiceRequestSend { - fn encode( - &self, - __protocol: &mut T, - ) -> ::core::result::Result<(), ::pilota::thrift::ThriftException> { - match self { - Self::GetImage(value) => { - ::pilota::thrift::Message::encode(value, __protocol).map_err(|err| err.into()) - } - } - } - - fn decode( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetImage" => Self::GetImage(::pilota::thrift::Message::decode(__protocol)?), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - async fn decode_async( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetImage" => Self::GetImage( - ::decode_async( - __protocol, - ) - .await?, - ), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - fn size(&self, __protocol: &mut T) -> usize { - match self { - Self::GetImage(value) => ::volo_thrift::Message::size(value, __protocol), - } - } -} diff --git a/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/enum_ImageServiceResponseRecv.rs b/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/enum_ImageServiceResponseRecv.rs deleted file mode 100644 index e92c313f..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/enum_ImageServiceResponseRecv.rs +++ /dev/null @@ -1,57 +0,0 @@ -#[derive(Debug, Clone)] -pub enum ImageServiceResponseRecv { - GetImage(ImageServiceGetImageResultRecv), -} -impl ::volo_thrift::EntryMessage for ImageServiceResponseRecv { - fn encode( - &self, - __protocol: &mut T, - ) -> ::core::result::Result<(), ::pilota::thrift::ThriftException> { - match self { - Self::GetImage(value) => { - ::pilota::thrift::Message::encode(value, __protocol).map_err(|err| err.into()) - } - } - } - - fn decode( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetImage" => Self::GetImage(::pilota::thrift::Message::decode(__protocol)?), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - async fn decode_async( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetImage" => Self::GetImage( - ::decode_async( - __protocol, - ) - .await?, - ), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - fn size(&self, __protocol: &mut T) -> usize { - match self { - Self::GetImage(value) => ::volo_thrift::Message::size(value, __protocol), - } - } -} diff --git a/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/enum_ImageServiceResponseSend.rs b/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/enum_ImageServiceResponseSend.rs deleted file mode 100644 index b7f02bb2..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/enum_ImageServiceResponseSend.rs +++ /dev/null @@ -1,58 +0,0 @@ -#[derive(Debug, Clone)] -pub enum ImageServiceResponseSend { - GetImage(ImageServiceGetImageResultSend), -} - -impl ::volo_thrift::EntryMessage for ImageServiceResponseSend { - fn encode( - &self, - __protocol: &mut T, - ) -> ::core::result::Result<(), ::pilota::thrift::ThriftException> { - match self { - Self::GetImage(value) => { - ::pilota::thrift::Message::encode(value, __protocol).map_err(|err| err.into()) - } - } - } - - fn decode( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetImage" => Self::GetImage(::pilota::thrift::Message::decode(__protocol)?), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - async fn decode_async( - __protocol: &mut T, - msg_ident: &::pilota::thrift::TMessageIdentifier, - ) -> ::core::result::Result { - ::std::result::Result::Ok(match &*msg_ident.name { - "GetImage" => Self::GetImage( - ::decode_async( - __protocol, - ) - .await?, - ), - _ => { - return ::std::result::Result::Err(::pilota::thrift::new_application_exception( - ::pilota::thrift::ApplicationExceptionKind::UNKNOWN_METHOD, - format!("unknown method {}", msg_ident.name), - )); - } - }) - } - - fn size(&self, __protocol: &mut T) -> usize { - match self { - Self::GetImage(value) => ::volo_thrift::Message::size(value, __protocol), - } - } -} diff --git a/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/mod.rs b/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/mod.rs deleted file mode 100644 index c53c1f58..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -include!("service_ImageServiceServer.rs"); -include!("service_ImageServiceClient.rs"); -include!("enum_ImageServiceRequestRecv.rs"); -include!("enum_ImageServiceResponseRecv.rs"); -include!("enum_ImageServiceRequestSend.rs"); -include!("enum_ImageServiceResponseSend.rs"); diff --git a/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/service_ImageServiceClient.rs b/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/service_ImageServiceClient.rs deleted file mode 100644 index e9e9b6b4..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/service_ImageServiceClient.rs +++ /dev/null @@ -1,127 +0,0 @@ -pub struct MkImageServiceGenericClient; - -pub type ImageServiceClient = ImageServiceGenericClient< - ::volo::service::BoxCloneService< - ::volo_thrift::context::ClientContext, - ImageServiceRequestSend, - ::std::option::Option, - ::volo_thrift::ClientError, - >, ->; - -impl ::volo::client::MkClient<::volo_thrift::Client> for MkImageServiceGenericClient { - type Target = ImageServiceGenericClient; - fn mk_client(&self, service: ::volo_thrift::Client) -> Self::Target { - ImageServiceGenericClient(service) - } -} - -#[derive(Clone)] -pub struct ImageServiceGenericClient(pub ::volo_thrift::Client); - -pub struct ImageServiceOneShotClient(pub ::volo_thrift::Client); - -impl< - S: ::volo::service::Service< - ::volo_thrift::context::ClientContext, - ImageServiceRequestSend, - Response = ::std::option::Option, - Error = ::volo_thrift::ClientError, - > + Send - + Sync - + 'static, - > ImageServiceGenericClient -{ - pub fn with_callopt>( - self, - opt: Opt, - ) -> ImageServiceOneShotClient<::volo::client::WithOptService> { - ImageServiceOneShotClient(self.0.with_opt(opt)) - } - - pub async fn get_image( - &self, - req: GetImageRequest, - ) -> ::std::result::Result { - let req = ImageServiceRequestSend::GetImage(ImageServiceGetImageArgsSend { req }); - let mut cx = self.0.make_cx("GetImage", false); - #[allow(unreachable_patterns)] - let resp = match ::volo::service::Service::call(&self.0, &mut cx, req).await? { - Some(ImageServiceResponseRecv::GetImage(ImageServiceGetImageResultRecv::Ok(resp))) => { - ::std::result::Result::Ok(resp) - } - None => unreachable!(), - _ => unreachable!(), - }; - ::volo_thrift::context::CLIENT_CONTEXT_CACHE.with(|cache| { - let mut cache = cache.borrow_mut(); - if cache.len() < cache.capacity() { - cache.push(cx); - } - }); - resp - } -} - -impl< - S: ::volo::client::OneShotService< - ::volo_thrift::context::ClientContext, - ImageServiceRequestSend, - Response = ::std::option::Option, - Error = ::volo_thrift::ClientError, - > + Send - + Sync - + 'static, - > ImageServiceOneShotClient -{ - pub async fn get_image( - self, - req: GetImageRequest, - ) -> ::std::result::Result { - let req = ImageServiceRequestSend::GetImage(ImageServiceGetImageArgsSend { req }); - let mut cx = self.0.make_cx("GetImage", false); - #[allow(unreachable_patterns)] - let resp = match ::volo::client::OneShotService::call(self.0, &mut cx, req).await? { - Some(ImageServiceResponseRecv::GetImage(ImageServiceGetImageResultRecv::Ok(resp))) => { - ::std::result::Result::Ok(resp) - } - None => unreachable!(), - _ => unreachable!(), - }; - ::volo_thrift::context::CLIENT_CONTEXT_CACHE.with(|cache| { - let mut cache = cache.borrow_mut(); - if cache.len() < cache.capacity() { - cache.push(cx); - } - }); - resp - } -} - -pub struct ImageServiceClientBuilder {} - -impl ImageServiceClientBuilder { - pub fn new( - service_name: impl AsRef, - ) -> ::volo_thrift::client::ClientBuilder< - ::volo::layer::Identity, - ::volo::layer::Identity, - MkImageServiceGenericClient, - ImageServiceRequestSend, - ImageServiceResponseRecv, - ::volo::net::dial::DefaultMakeTransport, - ::volo_thrift::codec::default::DefaultMakeCodec< - ::volo_thrift::codec::default::ttheader::MakeTTHeaderCodec< - ::volo_thrift::codec::default::framed::MakeFramedCodec< - ::volo_thrift::codec::default::thrift::MakeThriftCodec, - >, - >, - >, - ::volo::loadbalance::LbConfig< - ::volo::loadbalance::random::WeightedRandomBalance<()>, - ::volo::discovery::DummyDiscover, - >, - > { - ::volo_thrift::client::ClientBuilder::new(service_name, MkImageServiceGenericClient) - } -} diff --git a/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/service_ImageServiceServer.rs b/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/service_ImageServiceServer.rs deleted file mode 100644 index bdac6f78..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/article/image/ImageService/service_ImageServiceServer.rs +++ /dev/null @@ -1,50 +0,0 @@ -pub struct ImageServiceServer { - inner: S, // handler -} - -impl ImageServiceServer -where - S: ImageService + ::core::marker::Send + ::core::marker::Sync + 'static, -{ - pub fn new( - inner: S, - ) -> ::volo_thrift::server::Server< - Self, - ::volo::layer::Identity, - ImageServiceRequestRecv, - ::volo_thrift::codec::default::DefaultMakeCodec< - ::volo_thrift::codec::default::ttheader::MakeTTHeaderCodec< - ::volo_thrift::codec::default::framed::MakeFramedCodec< - ::volo_thrift::codec::default::thrift::MakeThriftCodec, - >, - >, - >, - ::volo_thrift::tracing::DefaultProvider, - > { - ::volo_thrift::server::Server::new(Self { inner }) - } -} - -impl ::volo::service::Service<::volo_thrift::context::ServerContext, ImageServiceRequestRecv> - for ImageServiceServer -where - T: ImageService + Send + Sync + 'static, -{ - type Response = ImageServiceResponseSend; - type Error = ::volo_thrift::ServerError; - - async fn call<'s, 'cx>( - &'s self, - _cx: &'cx mut ::volo_thrift::context::ServerContext, - req: ImageServiceRequestRecv, - ) -> ::std::result::Result { - match req { - ImageServiceRequestRecv::GetImage(args) => ::std::result::Result::Ok( - ImageServiceResponseSend::GetImage(match self.inner.get_image(args.req).await { - ::std::result::Result::Ok(resp) => ImageServiceGetImageResultSend::Ok(resp), - ::std::result::Result::Err(err) => return ::std::result::Result::Err(err), - }), - ), - } - } -} diff --git a/tests/code-generation-workspace-split/rpc_image/src/article/image/cdn/message_CDN.rs b/tests/code-generation-workspace-split/rpc_image/src/article/image/cdn/message_CDN.rs deleted file mode 100644 index 0f1acce9..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/article/image/cdn/message_CDN.rs +++ /dev/null @@ -1 +0,0 @@ -pub use ::common::article::image::cdn::Cdn; diff --git a/tests/code-generation-workspace-split/rpc_image/src/article/image/cdn/mod.rs b/tests/code-generation-workspace-split/rpc_image/src/article/image/cdn/mod.rs deleted file mode 100644 index bdf630b1..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/article/image/cdn/mod.rs +++ /dev/null @@ -1 +0,0 @@ -include!("message_CDN.rs"); diff --git a/tests/code-generation-workspace-split/rpc_image/src/article/image/enum_ImageServiceGetImageResultRecv.rs b/tests/code-generation-workspace-split/rpc_image/src/article/image/enum_ImageServiceGetImageResultRecv.rs deleted file mode 100644 index 205bb508..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/article/image/enum_ImageServiceGetImageResultRecv.rs +++ /dev/null @@ -1,144 +0,0 @@ -#[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] -#[derivative(Default)] -#[derive(::pilota::serde::Serialize, ::pilota::serde::Deserialize, Clone, PartialEq)] -pub enum ImageServiceGetImageResultRecv { - #[derivative(Default)] - Ok(GetImageResponse), -} - -impl ::pilota::thrift::Message for ImageServiceGetImageResultRecv { - 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: "ImageServiceGetImageResultRecv", - })?; - match self { - ImageServiceGetImageResultRecv::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(ImageServiceGetImageResultRecv::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(ImageServiceGetImageResultRecv::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: "ImageServiceGetImageResultRecv", - }) + match self { - ImageServiceGetImageResultRecv::Ok(ref value) => { - __protocol.struct_field_len(Some(0), value) - } - } + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/rpc_image/src/article/image/enum_ImageServiceGetImageResultSend.rs b/tests/code-generation-workspace-split/rpc_image/src/article/image/enum_ImageServiceGetImageResultSend.rs deleted file mode 100644 index 690496ed..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/article/image/enum_ImageServiceGetImageResultSend.rs +++ /dev/null @@ -1,144 +0,0 @@ -#[derive(PartialOrd, Hash, Eq, Ord, Debug, ::pilota::derivative::Derivative)] -#[derivative(Default)] -#[derive(::pilota::serde::Serialize, ::pilota::serde::Deserialize, Clone, PartialEq)] -pub enum ImageServiceGetImageResultSend { - #[derivative(Default)] - Ok(GetImageResponse), -} - -impl ::pilota::thrift::Message for ImageServiceGetImageResultSend { - 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: "ImageServiceGetImageResultSend", - })?; - match self { - ImageServiceGetImageResultSend::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(ImageServiceGetImageResultSend::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(ImageServiceGetImageResultSend::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: "ImageServiceGetImageResultSend", - }) + match self { - ImageServiceGetImageResultSend::Ok(ref value) => { - __protocol.struct_field_len(Some(0), value) - } - } + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/rpc_image/src/article/image/message_GetImageRequest.rs b/tests/code-generation-workspace-split/rpc_image/src/article/image/message_GetImageRequest.rs deleted file mode 100644 index 90986db7..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/article/image/message_GetImageRequest.rs +++ /dev/null @@ -1,160 +0,0 @@ -#[derive( - PartialOrd, - Hash, - Eq, - Ord, - Debug, - Default, - ::pilota::serde::Serialize, - ::pilota::serde::Deserialize, - Clone, - PartialEq, -)] -pub struct GetImageRequest { - pub id: i64, -} -impl ::pilota::thrift::Message for GetImageRequest { - 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: "GetImageRequest", - }; - - __protocol.write_struct_begin(&struct_ident)?; - __protocol.write_i64_field(1, *&self.id)?; - __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::I64 => { - var_1 = Some(__protocol.read_i64()?); - } - _ => { - __protocol.skip(field_ident.field_type)?; - } - } - - __protocol.read_field_end()?; - __protocol.field_end_len(); - } - ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) - })() { - if let Some(field_id) = __pilota_decoding_field_id { - err.prepend_msg(&format!( - "decode struct `GetImageRequest` 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 data = Self { id: 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::I64 => { - var_1 = Some(__protocol.read_i64().await?); - } - _ => { - __protocol.skip(field_ident.field_type).await?; - } - } - - __protocol.read_field_end().await?; - } - ::std::result::Result::Ok::<_, ::pilota::thrift::ThriftException>(()) - } - .await - { - if let Some(field_id) = __pilota_decoding_field_id { - err.prepend_msg(&format!( - "decode struct `GetImageRequest` 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 data = Self { id: 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: "GetImageRequest", - }) + __protocol.i64_field_len(Some(1), *&self.id) - + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/rpc_image/src/article/image/message_GetImageResponse.rs b/tests/code-generation-workspace-split/rpc_image/src/article/image/message_GetImageResponse.rs deleted file mode 100644 index adf83b1a..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/article/image/message_GetImageResponse.rs +++ /dev/null @@ -1,163 +0,0 @@ -#[derive( - PartialOrd, - Hash, - Eq, - Ord, - Debug, - Default, - ::pilota::serde::Serialize, - ::pilota::serde::Deserialize, - Clone, - PartialEq, -)] -pub struct GetImageResponse { - pub image: ::common::article::image::Image, -} -impl ::pilota::thrift::Message for GetImageResponse { - 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: "GetImageResponse", - }; - - __protocol.write_struct_begin(&struct_ident)?; - __protocol.write_struct_field(1, &self.image, ::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 `GetImageResponse` 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 image is required".to_string(), - )); - }; - - let data = Self { image: 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(<::common::article::image::Image as ::pilota::thrift::Message>::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 `GetImageResponse` 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 image is required".to_string(), - )); - }; - - let data = Self { image: 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: "GetImageResponse", - }) + __protocol.struct_field_len(Some(1), &self.image) - + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/rpc_image/src/article/image/message_Image.rs b/tests/code-generation-workspace-split/rpc_image/src/article/image/message_Image.rs deleted file mode 100644 index 3e028164..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/article/image/message_Image.rs +++ /dev/null @@ -1 +0,0 @@ -pub use ::common::article::image::Image; diff --git a/tests/code-generation-workspace-split/rpc_image/src/article/image/message_ImageServiceGetImageArgsRecv.rs b/tests/code-generation-workspace-split/rpc_image/src/article/image/message_ImageServiceGetImageArgsRecv.rs deleted file mode 100644 index 4d19fabf..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/article/image/message_ImageServiceGetImageArgsRecv.rs +++ /dev/null @@ -1,162 +0,0 @@ -#[derive( - PartialOrd, - Hash, - Eq, - Ord, - Debug, - Default, - ::pilota::serde::Serialize, - ::pilota::serde::Deserialize, - Clone, - PartialEq, -)] -pub struct ImageServiceGetImageArgsRecv { - pub req: GetImageRequest, -} -impl ::pilota::thrift::Message for ImageServiceGetImageArgsRecv { - 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: "ImageServiceGetImageArgsRecv", - }; - - __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 `ImageServiceGetImageArgsRecv` 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 `ImageServiceGetImageArgsRecv` 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: "ImageServiceGetImageArgsRecv", - }) + __protocol.struct_field_len(Some(1), &self.req) - + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/rpc_image/src/article/image/message_ImageServiceGetImageArgsSend.rs b/tests/code-generation-workspace-split/rpc_image/src/article/image/message_ImageServiceGetImageArgsSend.rs deleted file mode 100644 index 57ec51ab..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/article/image/message_ImageServiceGetImageArgsSend.rs +++ /dev/null @@ -1,162 +0,0 @@ -#[derive( - PartialOrd, - Hash, - Eq, - Ord, - Debug, - Default, - ::pilota::serde::Serialize, - ::pilota::serde::Deserialize, - Clone, - PartialEq, -)] -pub struct ImageServiceGetImageArgsSend { - pub req: GetImageRequest, -} -impl ::pilota::thrift::Message for ImageServiceGetImageArgsSend { - 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: "ImageServiceGetImageArgsSend", - }; - - __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 `ImageServiceGetImageArgsSend` 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 `ImageServiceGetImageArgsSend` 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: "ImageServiceGetImageArgsSend", - }) + __protocol.struct_field_len(Some(1), &self.req) - + __protocol.field_stop_len() - + __protocol.struct_end_len() - } -} diff --git a/tests/code-generation-workspace-split/rpc_image/src/article/image/mod.rs b/tests/code-generation-workspace-split/rpc_image/src/article/image/mod.rs deleted file mode 100644 index 2b2758a5..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/article/image/mod.rs +++ /dev/null @@ -1,8 +0,0 @@ -include!("message_ImageServiceGetImageArgsSend.rs"); -include!("message_GetImageRequest.rs"); -include!("service_ImageService.rs"); -include!("enum_ImageServiceGetImageResultRecv.rs"); -include!("message_ImageServiceGetImageArgsRecv.rs"); -include!("enum_ImageServiceGetImageResultSend.rs"); -include!("message_GetImageResponse.rs"); -include!("message_Image.rs"); diff --git a/tests/code-generation-workspace-split/rpc_image/src/article/image/service_ImageService.rs b/tests/code-generation-workspace-split/rpc_image/src/article/image/service_ImageService.rs deleted file mode 100644 index cc27a154..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/article/image/service_ImageService.rs +++ /dev/null @@ -1,10 +0,0 @@ - -pub trait ImageService { - fn get_image( - &self, - req: GetImageRequest, - ) -> impl ::std::future::Future< - Output = ::core::result::Result, - > + Send; -} -include!("ImageService/mod.rs"); diff --git a/tests/code-generation-workspace-split/rpc_image/src/common/message_CommonData.rs b/tests/code-generation-workspace-split/rpc_image/src/common/message_CommonData.rs deleted file mode 100644 index 501acfed..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/common/message_CommonData.rs +++ /dev/null @@ -1 +0,0 @@ -pub use ::common::common::CommonData; diff --git a/tests/code-generation-workspace-split/rpc_image/src/common/mod.rs b/tests/code-generation-workspace-split/rpc_image/src/common/mod.rs deleted file mode 100644 index 5e2006a4..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/common/mod.rs +++ /dev/null @@ -1 +0,0 @@ -include!("message_CommonData.rs"); diff --git a/tests/code-generation-workspace-split/rpc_image/src/gen.rs b/tests/code-generation-workspace-split/rpc_image/src/gen.rs deleted file mode 100644 index ae7ab893..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/gen.rs +++ /dev/null @@ -1,19 +0,0 @@ -pub mod gen { - #![allow(warnings, clippy::all)] - - pub mod article { - - pub mod image { - include!("article/image/mod.rs"); - - pub mod cdn { - include!("article/image/cdn/mod.rs"); - } - } - } - - pub mod common { - include!("common/mod.rs"); - } - pub use article::image::*; -} diff --git a/tests/code-generation-workspace-split/rpc_image/src/lib.rs b/tests/code-generation-workspace-split/rpc_image/src/lib.rs deleted file mode 100644 index 3a85e855..00000000 --- a/tests/code-generation-workspace-split/rpc_image/src/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -include!("gen.rs"); -pub use gen::*;