diff --git a/pb-test/gen/pb-jelly/proto_google/src/lib.rs.expected b/pb-test/gen/pb-jelly/proto_google/src/lib.rs.expected index 807c2f0..545fc3d 100644 --- a/pb-test/gen/pb-jelly/proto_google/src/lib.rs.expected +++ b/pb-test/gen/pb-jelly/proto_google/src/lib.rs.expected @@ -24,4 +24,4 @@ #[macro_use] extern crate lazy_static; -pub mod empty; +pub mod protobuf; diff --git a/pb-test/gen/pb-jelly/proto_google/src/empty.rs.expected b/pb-test/gen/pb-jelly/proto_google/src/protobuf/empty.rs.expected similarity index 100% rename from pb-test/gen/pb-jelly/proto_google/src/empty.rs.expected rename to pb-test/gen/pb-jelly/proto_google/src/protobuf/empty.rs.expected diff --git a/pb-test/gen/pb-jelly/proto_google/src/protobuf/mod.rs.expected b/pb-test/gen/pb-jelly/proto_google/src/protobuf/mod.rs.expected new file mode 100644 index 0000000..f4dd65b --- /dev/null +++ b/pb-test/gen/pb-jelly/proto_google/src/protobuf/mod.rs.expected @@ -0,0 +1,3 @@ +// @generated, do not edit + +pub mod empty; diff --git a/pb-test/gen/pb-jelly/proto_pbtest/src/pbtest2.rs.expected b/pb-test/gen/pb-jelly/proto_pbtest/src/pbtest2.rs.expected index 603713d..8f31405 100644 --- a/pb-test/gen/pb-jelly/proto_pbtest/src/pbtest2.rs.expected +++ b/pb-test/gen/pb-jelly/proto_pbtest/src/pbtest2.rs.expected @@ -4000,7 +4000,7 @@ impl ::pb_jelly::Message for TestMessage { size += bool6_size; let mut a_size = 0; if let TestMessage_OneofEmptyField::A = self.oneof_empty_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); let l = ::pb_jelly::Message::compute_size(val); a_size += ::pb_jelly::wire_format::serialized_length(70); a_size += ::pb_jelly::varint::serialized_length(l as u64); @@ -4009,7 +4009,7 @@ impl ::pb_jelly::Message for TestMessage { size += a_size; let mut b_size = 0; if let TestMessage_OneofEmptyField::B = self.oneof_empty_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); let l = ::pb_jelly::Message::compute_size(val); b_size += ::pb_jelly::wire_format::serialized_length(71); b_size += ::pb_jelly::varint::serialized_length(l as u64); @@ -4189,11 +4189,11 @@ impl ::pb_jelly::Message for TestMessage { size += ::pb_jelly::Message::compute_grpc_slices_size(val); } if let TestMessage_OneofEmptyField::A = self.oneof_empty_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); size += ::pb_jelly::Message::compute_grpc_slices_size(val); } if let TestMessage_OneofEmptyField::B = self.oneof_empty_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); size += ::pb_jelly::Message::compute_grpc_slices_size(val); } if let TestMessage_OneofEmptyField::C(ref val) = self.oneof_empty_field { @@ -4424,14 +4424,14 @@ impl ::pb_jelly::Message for TestMessage { ::pb_jelly::Message::serialize(val, w)?; } if let TestMessage_OneofEmptyField::A = self.oneof_empty_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); ::pb_jelly::wire_format::write(70, ::pb_jelly::wire_format::Type::LengthDelimited, w)?; let l = ::pb_jelly::Message::compute_size(val); ::pb_jelly::varint::write(l as u64, w)?; ::pb_jelly::Message::serialize(val, w)?; } if let TestMessage_OneofEmptyField::B = self.oneof_empty_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); ::pb_jelly::wire_format::write(71, ::pb_jelly::wire_format::Type::LengthDelimited, w)?; let l = ::pb_jelly::Message::compute_size(val); ::pb_jelly::varint::write(l as u64, w)?; @@ -4934,7 +4934,7 @@ impl ::pb_jelly::Message for TestMessage { ::pb_jelly::ensure_wire_format(typ, ::pb_jelly::wire_format::Type::LengthDelimited, "TestMessage", 70)?; let len = ::pb_jelly::varint::ensure_read(&mut buf)?; let mut next = ::pb_jelly::ensure_split(buf, len as usize)?; - let mut val: ::proto_google::empty::Empty = ::std::default::Default::default(); + let mut val: ::proto_google::protobuf::empty::Empty = ::std::default::Default::default(); ::pb_jelly::Message::deserialize(&mut val, &mut next)?; oneof_oneof_empty_field = Some(TestMessage_OneofEmptyField::A); } @@ -4942,7 +4942,7 @@ impl ::pb_jelly::Message for TestMessage { ::pb_jelly::ensure_wire_format(typ, ::pb_jelly::wire_format::Type::LengthDelimited, "TestMessage", 71)?; let len = ::pb_jelly::varint::ensure_read(&mut buf)?; let mut next = ::pb_jelly::ensure_split(buf, len as usize)?; - let mut val: ::proto_google::empty::Empty = ::std::default::Default::default(); + let mut val: ::proto_google::protobuf::empty::Empty = ::std::default::Default::default(); ::pb_jelly::Message::deserialize(&mut val, &mut next)?; oneof_oneof_empty_field = Some(TestMessage_OneofEmptyField::B); } @@ -5041,11 +5041,11 @@ impl ::pb_jelly::Reflection for TestMessage { } "oneof_empty_field" => { if let TestMessage_OneofEmptyField::A = self.oneof_empty_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); return Some("a"); } if let TestMessage_OneofEmptyField::B = self.oneof_empty_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); return Some("b"); } if let TestMessage_OneofEmptyField::C(ref val) = self.oneof_empty_field { diff --git a/pb-test/gen/pb-jelly/proto_pbtest/src/pbtest3.rs.expected b/pb-test/gen/pb-jelly/proto_pbtest/src/pbtest3.rs.expected index 877b22e..d643a03 100644 --- a/pb-test/gen/pb-jelly/proto_pbtest/src/pbtest3.rs.expected +++ b/pb-test/gen/pb-jelly/proto_pbtest/src/pbtest3.rs.expected @@ -3682,7 +3682,7 @@ impl ::pb_jelly::Message for TestMessage3 { size += bool6_size; let mut a_size = 0; if let TestMessage3_OneofEmptyField::A = self.oneof_empty_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); let l = ::pb_jelly::Message::compute_size(val); a_size += ::pb_jelly::wire_format::serialized_length(70); a_size += ::pb_jelly::varint::serialized_length(l as u64); @@ -3691,7 +3691,7 @@ impl ::pb_jelly::Message for TestMessage3 { size += a_size; let mut b_size = 0; if let TestMessage3_OneofEmptyField::B = self.oneof_empty_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); let l = ::pb_jelly::Message::compute_size(val); b_size += ::pb_jelly::wire_format::serialized_length(71); b_size += ::pb_jelly::varint::serialized_length(l as u64); @@ -3933,11 +3933,11 @@ impl ::pb_jelly::Message for TestMessage3 { size += ::pb_jelly::Message::compute_grpc_slices_size(val); } if let TestMessage3_OneofEmptyField::A = self.oneof_empty_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); size += ::pb_jelly::Message::compute_grpc_slices_size(val); } if let TestMessage3_OneofEmptyField::B = self.oneof_empty_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); size += ::pb_jelly::Message::compute_grpc_slices_size(val); } if let TestMessage3_OneofEmptyField::C(ref val) = self.oneof_empty_field { @@ -4307,14 +4307,14 @@ impl ::pb_jelly::Message for TestMessage3 { ::pb_jelly::Message::serialize(val, w)?; } if let TestMessage3_OneofEmptyField::A = self.oneof_empty_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); ::pb_jelly::wire_format::write(70, ::pb_jelly::wire_format::Type::LengthDelimited, w)?; let l = ::pb_jelly::Message::compute_size(val); ::pb_jelly::varint::write(l as u64, w)?; ::pb_jelly::Message::serialize(val, w)?; } if let TestMessage3_OneofEmptyField::B = self.oneof_empty_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); ::pb_jelly::wire_format::write(71, ::pb_jelly::wire_format::Type::LengthDelimited, w)?; let l = ::pb_jelly::Message::compute_size(val); ::pb_jelly::varint::write(l as u64, w)?; @@ -4874,7 +4874,7 @@ impl ::pb_jelly::Message for TestMessage3 { ::pb_jelly::ensure_wire_format(typ, ::pb_jelly::wire_format::Type::LengthDelimited, "TestMessage3", 70)?; let len = ::pb_jelly::varint::ensure_read(&mut buf)?; let mut next = ::pb_jelly::ensure_split(buf, len as usize)?; - let mut val: ::proto_google::empty::Empty = ::std::default::Default::default(); + let mut val: ::proto_google::protobuf::empty::Empty = ::std::default::Default::default(); ::pb_jelly::Message::deserialize(&mut val, &mut next)?; oneof_oneof_empty_field = Some(TestMessage3_OneofEmptyField::A); } @@ -4882,7 +4882,7 @@ impl ::pb_jelly::Message for TestMessage3 { ::pb_jelly::ensure_wire_format(typ, ::pb_jelly::wire_format::Type::LengthDelimited, "TestMessage3", 71)?; let len = ::pb_jelly::varint::ensure_read(&mut buf)?; let mut next = ::pb_jelly::ensure_split(buf, len as usize)?; - let mut val: ::proto_google::empty::Empty = ::std::default::Default::default(); + let mut val: ::proto_google::protobuf::empty::Empty = ::std::default::Default::default(); ::pb_jelly::Message::deserialize(&mut val, &mut next)?; oneof_oneof_empty_field = Some(TestMessage3_OneofEmptyField::B); } @@ -5019,11 +5019,11 @@ impl ::pb_jelly::Reflection for TestMessage3 { } "oneof_empty_field" => { if let TestMessage3_OneofEmptyField::A = self.oneof_empty_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); return Some("a"); } if let TestMessage3_OneofEmptyField::B = self.oneof_empty_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); return Some("b"); } if let TestMessage3_OneofEmptyField::C(ref val) = self.oneof_empty_field { @@ -6226,7 +6226,7 @@ impl ::pb_jelly::Reflection for TestMessage3ErrIfDefaultEnum { #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct TestMessage3ErrIfDefaultEnumOneof { - pub nothing: ::std::option::Option<::proto_google::empty::Empty>, + pub nothing: ::std::option::Option<::proto_google::protobuf::empty::Empty>, pub maybe: ::std::option::Option, } #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] @@ -6331,7 +6331,7 @@ impl ::pb_jelly::Message for TestMessage3ErrIfDefaultEnumOneof { ::pb_jelly::ensure_wire_format(typ, ::pb_jelly::wire_format::Type::LengthDelimited, "TestMessage3ErrIfDefaultEnumOneof", 2)?; let len = ::pb_jelly::varint::ensure_read(&mut buf)?; let mut next = ::pb_jelly::ensure_split(buf, len as usize)?; - let mut val: ::proto_google::empty::Empty = ::std::default::Default::default(); + let mut val: ::proto_google::protobuf::empty::Empty = ::std::default::Default::default(); ::pb_jelly::Message::deserialize(&mut val, &mut next)?; self.nothing = Some(val); } @@ -9043,7 +9043,7 @@ pub struct RecursiveOneof { pub enum RecursiveOneof_OneofField { Field(::std::boxed::Box), Empty, - BoxedEmpty(::std::boxed::Box<::proto_google::empty::Empty>), + BoxedEmpty(::std::boxed::Box<::proto_google::protobuf::empty::Empty>), NotBoxed(ForeignMessage3), Boxed(::std::boxed::Box), } @@ -9129,7 +9129,7 @@ impl ::pb_jelly::Message for RecursiveOneof { size += field_size; let mut empty_size = 0; if let Some(RecursiveOneof_OneofField::Empty) = self.oneof_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); let l = ::pb_jelly::Message::compute_size(val); empty_size += ::pb_jelly::wire_format::serialized_length(2); empty_size += ::pb_jelly::varint::serialized_length(l as u64); @@ -9138,7 +9138,7 @@ impl ::pb_jelly::Message for RecursiveOneof { size += empty_size; let mut boxed_empty_size = 0; if let Some(RecursiveOneof_OneofField::BoxedEmpty(ref val)) = self.oneof_field { - let val: &::proto_google::empty::Empty = &**val; + let val: &::proto_google::protobuf::empty::Empty = &**val; let l = ::pb_jelly::Message::compute_size(val); boxed_empty_size += ::pb_jelly::wire_format::serialized_length(3); boxed_empty_size += ::pb_jelly::varint::serialized_length(l as u64); @@ -9171,11 +9171,11 @@ impl ::pb_jelly::Message for RecursiveOneof { size += ::pb_jelly::Message::compute_grpc_slices_size(val); } if let Some(RecursiveOneof_OneofField::Empty) = self.oneof_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); size += ::pb_jelly::Message::compute_grpc_slices_size(val); } if let Some(RecursiveOneof_OneofField::BoxedEmpty(ref val)) = self.oneof_field { - let val: &::proto_google::empty::Empty = &**val; + let val: &::proto_google::protobuf::empty::Empty = &**val; size += ::pb_jelly::Message::compute_grpc_slices_size(val); } if let Some(RecursiveOneof_OneofField::NotBoxed(ref val)) = self.oneof_field { @@ -9196,14 +9196,14 @@ impl ::pb_jelly::Message for RecursiveOneof { ::pb_jelly::Message::serialize(val, w)?; } if let Some(RecursiveOneof_OneofField::Empty) = self.oneof_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); ::pb_jelly::wire_format::write(2, ::pb_jelly::wire_format::Type::LengthDelimited, w)?; let l = ::pb_jelly::Message::compute_size(val); ::pb_jelly::varint::write(l as u64, w)?; ::pb_jelly::Message::serialize(val, w)?; } if let Some(RecursiveOneof_OneofField::BoxedEmpty(ref val)) = self.oneof_field { - let val: &::proto_google::empty::Empty = &**val; + let val: &::proto_google::protobuf::empty::Empty = &**val; ::pb_jelly::wire_format::write(3, ::pb_jelly::wire_format::Type::LengthDelimited, w)?; let l = ::pb_jelly::Message::compute_size(val); ::pb_jelly::varint::write(l as u64, w)?; @@ -9239,7 +9239,7 @@ impl ::pb_jelly::Message for RecursiveOneof { ::pb_jelly::ensure_wire_format(typ, ::pb_jelly::wire_format::Type::LengthDelimited, "RecursiveOneof", 2)?; let len = ::pb_jelly::varint::ensure_read(&mut buf)?; let mut next = ::pb_jelly::ensure_split(buf, len as usize)?; - let mut val: ::proto_google::empty::Empty = ::std::default::Default::default(); + let mut val: ::proto_google::protobuf::empty::Empty = ::std::default::Default::default(); ::pb_jelly::Message::deserialize(&mut val, &mut next)?; self.oneof_field = Some(RecursiveOneof_OneofField::Empty); } @@ -9247,7 +9247,7 @@ impl ::pb_jelly::Message for RecursiveOneof { ::pb_jelly::ensure_wire_format(typ, ::pb_jelly::wire_format::Type::LengthDelimited, "RecursiveOneof", 3)?; let len = ::pb_jelly::varint::ensure_read(&mut buf)?; let mut next = ::pb_jelly::ensure_split(buf, len as usize)?; - let mut val: ::proto_google::empty::Empty = ::std::default::Default::default(); + let mut val: ::proto_google::protobuf::empty::Empty = ::std::default::Default::default(); ::pb_jelly::Message::deserialize(&mut val, &mut next)?; self.oneof_field = Some(RecursiveOneof_OneofField::BoxedEmpty(Box::new(val))); } @@ -9284,11 +9284,11 @@ impl ::pb_jelly::Reflection for RecursiveOneof { return Some("field"); } if let Some(RecursiveOneof_OneofField::Empty) = self.oneof_field { - let val: &::proto_google::empty::Empty = &::std::default::Default::default(); + let val: &::proto_google::protobuf::empty::Empty = &::std::default::Default::default(); return Some("empty"); } if let Some(RecursiveOneof_OneofField::BoxedEmpty(ref val)) = self.oneof_field { - let val: &::proto_google::empty::Empty = &**val; + let val: &::proto_google::protobuf::empty::Empty = &**val; return Some("boxed_empty"); } if let Some(RecursiveOneof_OneofField::NotBoxed(ref val)) = self.oneof_field { diff --git a/pb-test/proto/packages/google/empty.proto b/pb-test/proto/packages/google/protobuf/empty.proto similarity index 100% rename from pb-test/proto/packages/google/empty.proto rename to pb-test/proto/packages/google/protobuf/empty.proto diff --git a/pb-test/proto/packages/pbtest/pbtest2.proto b/pb-test/proto/packages/pbtest/pbtest2.proto index c15267e..3b5c464 100644 --- a/pb-test/proto/packages/pbtest/pbtest2.proto +++ b/pb-test/proto/packages/pbtest/pbtest2.proto @@ -1,6 +1,6 @@ syntax="proto2"; -import "google/empty.proto"; +import "google/protobuf/empty.proto"; import "rust/extensions.proto"; package pbtest; diff --git a/pb-test/proto/packages/pbtest/pbtest3.proto b/pb-test/proto/packages/pbtest/pbtest3.proto index ab620a8..9ddfb98 100644 --- a/pb-test/proto/packages/pbtest/pbtest3.proto +++ b/pb-test/proto/packages/pbtest/pbtest3.proto @@ -1,6 +1,6 @@ syntax="proto3"; -import "google/empty.proto"; +import "google/protobuf/empty.proto"; import "pbtest/pbtest2.proto"; import "rust/extensions.proto"; diff --git a/pb-test/src/verify_generated_files.rs b/pb-test/src/verify_generated_files.rs index 8a85b02..8a8d2d6 100644 --- a/pb-test/src/verify_generated_files.rs +++ b/pb-test/src/verify_generated_files.rs @@ -23,7 +23,7 @@ fn verify_generated_files() { // Assert the correct number of pb-test generated files // Developers - please change this number if the change is intentional - assert_eq!(proto_files.len(), 12); + assert_eq!(proto_files.len(), 13); // Assert contents of the generated files for proto_file in proto_files {