-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: deduplicate generated file with case-sensitive names in split m…
…ode (#280) * Deduplicate generated file with case-sensitive names in split mode * Move `thrift_with_split_case_sensitive` to `thrift_with_split` * Add a note about macOS * Use AHashSet instead of HashSet * Fix lint
- Loading branch information
1 parent
9aca81f
commit b1078bc
Showing
12 changed files
with
625 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
140 changes: 140 additions & 0 deletions
140
pilota-build/test_data/thrift_with_split/wrapper_arc/enum_testServiceTestResultRecv_2.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
#[derive(Debug, ::pilota::derivative::Derivative)] | ||
#[derivative(Default)] | ||
#[derive(Clone, PartialEq)] | ||
pub enum testServiceTestResultRecv { | ||
#[derivative(Default)] | ||
Ok(Test), | ||
} | ||
|
||
impl ::pilota::thrift::Message for testServiceTestResultRecv { | ||
fn encode<T: ::pilota::thrift::TOutputProtocol>( | ||
&self, | ||
__protocol: &mut T, | ||
) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { | ||
#[allow(unused_imports)] | ||
use ::pilota::thrift::TOutputProtocolExt; | ||
__protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { | ||
name: "testServiceTestResultRecv", | ||
})?; | ||
match self { | ||
testServiceTestResultRecv::Ok(ref value) => { | ||
__protocol.write_struct_field(0, value, ::pilota::thrift::TType::Struct)?; | ||
} | ||
} | ||
__protocol.write_field_stop()?; | ||
__protocol.write_struct_end()?; | ||
::std::result::Result::Ok(()) | ||
} | ||
|
||
fn decode<T: ::pilota::thrift::TInputProtocol>( | ||
__protocol: &mut T, | ||
) -> ::std::result::Result<Self, ::pilota::thrift::ThriftException> { | ||
#[allow(unused_imports)] | ||
use ::pilota::{thrift::TLengthProtocolExt, Buf}; | ||
let mut ret = None; | ||
__protocol.read_struct_begin()?; | ||
loop { | ||
let field_ident = __protocol.read_field_begin()?; | ||
if field_ident.field_type == ::pilota::thrift::TType::Stop { | ||
__protocol.field_stop_len(); | ||
break; | ||
} else { | ||
__protocol.field_begin_len(field_ident.field_type, field_ident.id); | ||
} | ||
match field_ident.id { | ||
Some(0) => { | ||
if ret.is_none() { | ||
let field_ident = ::pilota::thrift::Message::decode(__protocol)?; | ||
__protocol.struct_len(&field_ident); | ||
ret = Some(testServiceTestResultRecv::Ok(field_ident)); | ||
} else { | ||
return ::std::result::Result::Err( | ||
::pilota::thrift::new_protocol_exception( | ||
::pilota::thrift::ProtocolExceptionKind::InvalidData, | ||
"received multiple fields for union from remote Message", | ||
), | ||
); | ||
} | ||
} | ||
_ => { | ||
__protocol.skip(field_ident.field_type)?; | ||
} | ||
} | ||
} | ||
__protocol.read_field_end()?; | ||
__protocol.read_struct_end()?; | ||
if let Some(ret) = ret { | ||
::std::result::Result::Ok(ret) | ||
} else { | ||
::std::result::Result::Err(::pilota::thrift::new_protocol_exception( | ||
::pilota::thrift::ProtocolExceptionKind::InvalidData, | ||
"received empty union from remote Message", | ||
)) | ||
} | ||
} | ||
|
||
fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( | ||
__protocol: &'a mut T, | ||
) -> ::std::pin::Pin< | ||
::std::boxed::Box< | ||
dyn ::std::future::Future< | ||
Output = ::std::result::Result<Self, ::pilota::thrift::ThriftException>, | ||
> + 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 = | ||
<Test as ::pilota::thrift::Message>::decode_async(__protocol) | ||
.await?; | ||
|
||
ret = Some(testServiceTestResultRecv::Ok(field_ident)); | ||
} else { | ||
return ::std::result::Result::Err( | ||
::pilota::thrift::new_protocol_exception( | ||
::pilota::thrift::ProtocolExceptionKind::InvalidData, | ||
"received multiple fields for union from remote Message", | ||
), | ||
); | ||
} | ||
} | ||
_ => { | ||
__protocol.skip(field_ident.field_type).await?; | ||
} | ||
} | ||
} | ||
__protocol.read_field_end().await?; | ||
__protocol.read_struct_end().await?; | ||
if let Some(ret) = ret { | ||
::std::result::Result::Ok(ret) | ||
} else { | ||
::std::result::Result::Err(::pilota::thrift::new_protocol_exception( | ||
::pilota::thrift::ProtocolExceptionKind::InvalidData, | ||
"received empty union from remote Message", | ||
)) | ||
} | ||
}) | ||
} | ||
|
||
fn size<T: ::pilota::thrift::TLengthProtocol>(&self, __protocol: &mut T) -> usize { | ||
#[allow(unused_imports)] | ||
use ::pilota::thrift::TLengthProtocolExt; | ||
__protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { | ||
name: "testServiceTestResultRecv", | ||
}) + match self { | ||
testServiceTestResultRecv::Ok(ref value) => __protocol.struct_field_len(Some(0), value), | ||
} + __protocol.field_stop_len() | ||
+ __protocol.struct_end_len() | ||
} | ||
} |
142 changes: 142 additions & 0 deletions
142
pilota-build/test_data/thrift_with_split/wrapper_arc/enum_testServiceTestResultSend.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
#[derive(Debug, ::pilota::derivative::Derivative)] | ||
#[derivative(Default)] | ||
#[derive(Clone, PartialEq)] | ||
pub enum testServiceTestResultSend { | ||
#[derivative(Default)] | ||
Ok(::std::sync::Arc<Test>), | ||
} | ||
|
||
impl ::pilota::thrift::Message for testServiceTestResultSend { | ||
fn encode<T: ::pilota::thrift::TOutputProtocol>( | ||
&self, | ||
__protocol: &mut T, | ||
) -> ::std::result::Result<(), ::pilota::thrift::ThriftException> { | ||
#[allow(unused_imports)] | ||
use ::pilota::thrift::TOutputProtocolExt; | ||
__protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier { | ||
name: "testServiceTestResultSend", | ||
})?; | ||
match self { | ||
testServiceTestResultSend::Ok(ref value) => { | ||
__protocol.write_struct_field(0, value, ::pilota::thrift::TType::Struct)?; | ||
} | ||
} | ||
__protocol.write_field_stop()?; | ||
__protocol.write_struct_end()?; | ||
::std::result::Result::Ok(()) | ||
} | ||
|
||
fn decode<T: ::pilota::thrift::TInputProtocol>( | ||
__protocol: &mut T, | ||
) -> ::std::result::Result<Self, ::pilota::thrift::ThriftException> { | ||
#[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 = | ||
::std::sync::Arc::new(::pilota::thrift::Message::decode(__protocol)?); | ||
__protocol.struct_len(&field_ident); | ||
ret = Some(testServiceTestResultSend::Ok(field_ident)); | ||
} else { | ||
return ::std::result::Result::Err( | ||
::pilota::thrift::new_protocol_exception( | ||
::pilota::thrift::ProtocolExceptionKind::InvalidData, | ||
"received multiple fields for union from remote Message", | ||
), | ||
); | ||
} | ||
} | ||
_ => { | ||
__protocol.skip(field_ident.field_type)?; | ||
} | ||
} | ||
} | ||
__protocol.read_field_end()?; | ||
__protocol.read_struct_end()?; | ||
if let Some(ret) = ret { | ||
::std::result::Result::Ok(ret) | ||
} else { | ||
::std::result::Result::Err(::pilota::thrift::new_protocol_exception( | ||
::pilota::thrift::ProtocolExceptionKind::InvalidData, | ||
"received empty union from remote Message", | ||
)) | ||
} | ||
} | ||
|
||
fn decode_async<'a, T: ::pilota::thrift::TAsyncInputProtocol>( | ||
__protocol: &'a mut T, | ||
) -> ::std::pin::Pin< | ||
::std::boxed::Box< | ||
dyn ::std::future::Future< | ||
Output = ::std::result::Result<Self, ::pilota::thrift::ThriftException>, | ||
> + 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 = ::std::sync::Arc::new( | ||
<Test as ::pilota::thrift::Message>::decode_async(__protocol) | ||
.await?, | ||
); | ||
|
||
ret = Some(testServiceTestResultSend::Ok(field_ident)); | ||
} else { | ||
return ::std::result::Result::Err( | ||
::pilota::thrift::new_protocol_exception( | ||
::pilota::thrift::ProtocolExceptionKind::InvalidData, | ||
"received multiple fields for union from remote Message", | ||
), | ||
); | ||
} | ||
} | ||
_ => { | ||
__protocol.skip(field_ident.field_type).await?; | ||
} | ||
} | ||
} | ||
__protocol.read_field_end().await?; | ||
__protocol.read_struct_end().await?; | ||
if let Some(ret) = ret { | ||
::std::result::Result::Ok(ret) | ||
} else { | ||
::std::result::Result::Err(::pilota::thrift::new_protocol_exception( | ||
::pilota::thrift::ProtocolExceptionKind::InvalidData, | ||
"received empty union from remote Message", | ||
)) | ||
} | ||
}) | ||
} | ||
|
||
fn size<T: ::pilota::thrift::TLengthProtocol>(&self, __protocol: &mut T) -> usize { | ||
#[allow(unused_imports)] | ||
use ::pilota::thrift::TLengthProtocolExt; | ||
__protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier { | ||
name: "testServiceTestResultSend", | ||
}) + match self { | ||
testServiceTestResultSend::Ok(ref value) => __protocol.struct_field_len(Some(0), value), | ||
} + __protocol.field_stop_len() | ||
+ __protocol.struct_end_len() | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.