Skip to content

Commit

Permalink
fix(pilota-build): empty union (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
PureWhiteWu authored Sep 25, 2023
1 parent c0564bb commit 541ffb0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pilota-build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pilota-build"
version = "0.8.3"
version = "0.8.4"
edition = "2021"
description = "Compile thrift and protobuf idl into rust code at compile-time."
documentation = "https://docs.rs/pilota-build"
Expand Down
20 changes: 14 additions & 6 deletions pilota-build/src/codegen/thrift/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,12 +577,20 @@ impl CodegenBackend for ThriftBackend {
protocol.write_struct_end()?;
Ok(())"#
},
format! {
r#"protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier {{
name: "{name_str}",
}}) + match self {{
{variants_size}
}} + protocol.field_stop_len() + protocol.struct_end_len()"#
if !e.variants.is_empty() {
format! {
r#"protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier {{
name: "{name_str}",
}}) + match self {{
{variants_size}
}} + protocol.field_stop_len() + protocol.struct_end_len()"#
}
} else {
format! {
r#"protocol.struct_begin_len(&::pilota::thrift::TStructIdentifier {{
name: "{name_str}",
}}) + protocol.field_stop_len() + protocol.struct_end_len()"#
}
},
|helper| {
let record_ptr = if keep && !helper.is_async {
Expand Down

0 comments on commit 541ffb0

Please sign in to comment.