-
Notifications
You must be signed in to change notification settings - Fork 507
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(prost-build): Generate less boxed if nested type is boxed man…
…ually
- Loading branch information
Showing
7 changed files
with
310 additions
and
14 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
syntax = "proto2"; | ||
|
||
package nesting_complex; | ||
|
||
// ----- Directly nested | ||
message Foo { | ||
optional Bar bar = 1; | ||
} | ||
|
||
message Bar { | ||
optional Foo foo = 1; | ||
} | ||
|
||
// ----- Transitively nested | ||
message BazA { | ||
optional BazB baz_b = 1; | ||
} | ||
|
||
message BazB { | ||
optional BazC baz_c = 1; | ||
} | ||
|
||
message BazC { | ||
optional BazA baz_a = 1; | ||
} | ||
|
||
// ----- Transitively nested in two chain | ||
message BakA { | ||
optional BakB bak_b = 1; | ||
} | ||
|
||
message BakB { | ||
optional BakC bak_c = 1; | ||
optional BakE bak_e = 2; | ||
} | ||
|
||
message BakC { | ||
optional BakD bak_d = 1; | ||
} | ||
|
||
message BakD { | ||
optional BakA bak_a = 1; | ||
} | ||
|
||
message BakE { | ||
optional BakA bak_a = 1; | ||
} |
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,56 @@ | ||
// This file is @generated by prost-build. | ||
/// ----- Directly nested | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct Foo { | ||
#[prost(message, optional, boxed, tag = "1")] | ||
pub bar: ::core::option::Option<::prost::alloc::boxed::Box<Bar>>, | ||
} | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct Bar { | ||
#[prost(message, optional, tag = "1")] | ||
pub foo: ::core::option::Option<Foo>, | ||
} | ||
/// ----- Transitively nested | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct BazA { | ||
#[prost(message, optional, tag = "1")] | ||
pub baz_b: ::core::option::Option<BazB>, | ||
} | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct BazB { | ||
#[prost(message, optional, boxed, tag = "1")] | ||
pub baz_c: ::core::option::Option<::prost::alloc::boxed::Box<BazC>>, | ||
} | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct BazC { | ||
#[prost(message, optional, tag = "1")] | ||
pub baz_a: ::core::option::Option<BazA>, | ||
} | ||
/// ----- Transitively nested in two chain | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct BakA { | ||
#[prost(message, optional, boxed, tag = "1")] | ||
pub bak_b: ::core::option::Option<::prost::alloc::boxed::Box<BakB>>, | ||
} | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct BakB { | ||
#[prost(message, optional, tag = "1")] | ||
pub bak_c: ::core::option::Option<BakC>, | ||
#[prost(message, optional, boxed, tag = "2")] | ||
pub bak_e: ::core::option::Option<::prost::alloc::boxed::Box<BakE>>, | ||
} | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct BakC { | ||
#[prost(message, optional, boxed, tag = "1")] | ||
pub bak_d: ::core::option::Option<::prost::alloc::boxed::Box<BakD>>, | ||
} | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct BakD { | ||
#[prost(message, optional, tag = "1")] | ||
pub bak_a: ::core::option::Option<BakA>, | ||
} | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct BakE { | ||
#[prost(message, optional, boxed, tag = "1")] | ||
pub bak_a: ::core::option::Option<::prost::alloc::boxed::Box<BakA>>, | ||
} |
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,56 @@ | ||
// This file is @generated by prost-build. | ||
/// ----- Directly nested | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct Foo { | ||
#[prost(message, optional, boxed, tag = "1")] | ||
pub bar: ::core::option::Option<::prost::alloc::boxed::Box<Bar>>, | ||
} | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct Bar { | ||
#[prost(message, optional, boxed, tag = "1")] | ||
pub foo: ::core::option::Option<::prost::alloc::boxed::Box<Foo>>, | ||
} | ||
/// ----- Transitively nested | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct BazA { | ||
#[prost(message, optional, boxed, tag = "1")] | ||
pub baz_b: ::core::option::Option<::prost::alloc::boxed::Box<BazB>>, | ||
} | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct BazB { | ||
#[prost(message, optional, boxed, tag = "1")] | ||
pub baz_c: ::core::option::Option<::prost::alloc::boxed::Box<BazC>>, | ||
} | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct BazC { | ||
#[prost(message, optional, boxed, tag = "1")] | ||
pub baz_a: ::core::option::Option<::prost::alloc::boxed::Box<BazA>>, | ||
} | ||
/// ----- Transitively nested in two chain | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct BakA { | ||
#[prost(message, optional, boxed, tag = "1")] | ||
pub bak_b: ::core::option::Option<::prost::alloc::boxed::Box<BakB>>, | ||
} | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct BakB { | ||
#[prost(message, optional, boxed, tag = "1")] | ||
pub bak_c: ::core::option::Option<::prost::alloc::boxed::Box<BakC>>, | ||
#[prost(message, optional, boxed, tag = "2")] | ||
pub bak_e: ::core::option::Option<::prost::alloc::boxed::Box<BakE>>, | ||
} | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct BakC { | ||
#[prost(message, optional, boxed, tag = "1")] | ||
pub bak_d: ::core::option::Option<::prost::alloc::boxed::Box<BakD>>, | ||
} | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct BakD { | ||
#[prost(message, optional, boxed, tag = "1")] | ||
pub bak_a: ::core::option::Option<::prost::alloc::boxed::Box<BakA>>, | ||
} | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct BakE { | ||
#[prost(message, optional, boxed, tag = "1")] | ||
pub bak_a: ::core::option::Option<::prost::alloc::boxed::Box<BakA>>, | ||
} |