File tree Expand file tree Collapse file tree
micropb-gen/src/generator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -146,12 +146,13 @@ pub(crate) enum TypeSpec {
146146 Double ,
147147 Bool ,
148148 Int ( PbInt , IntSize ) ,
149+ // Box the syn::Type fields since they're taking up too much space
149150 String {
150- type_path : syn:: Type ,
151+ type_path : Box < syn:: Type > ,
151152 max_bytes : Option < u32 > ,
152153 } ,
153154 Bytes {
154- type_path : syn:: Type ,
155+ type_path : Box < syn:: Type > ,
155156 max_bytes : Option < u32 > ,
156157 } ,
157158}
@@ -214,15 +215,17 @@ impl TypeSpec {
214215 Type :: Float => TypeSpec :: Float ,
215216 Type :: Bool => TypeSpec :: Bool ,
216217 Type :: String => TypeSpec :: String {
217- type_path : conf
218- . string_type_parsed ( conf. max_bytes ) ?
219- . ok_or_else ( || "string_type not configured for string field" . to_owned ( ) ) ?,
218+ type_path : Box :: new (
219+ conf. string_type_parsed ( conf. max_bytes ) ?
220+ . ok_or_else ( || "string_type not configured for string field" . to_owned ( ) ) ?,
221+ ) ,
220222 max_bytes : conf. max_bytes ,
221223 } ,
222224 Type :: Bytes => TypeSpec :: Bytes {
223- type_path : conf
224- . bytes_type_parsed ( conf. max_bytes ) ?
225- . ok_or_else ( || "bytes_type not configured for bytes field" . to_owned ( ) ) ?,
225+ type_path : Box :: new (
226+ conf. bytes_type_parsed ( conf. max_bytes ) ?
227+ . ok_or_else ( || "bytes_type not configured for bytes field" . to_owned ( ) ) ?,
228+ ) ,
226229 max_bytes : conf. max_bytes ,
227230 } ,
228231 Type :: Message => {
Original file line number Diff line number Diff line change @@ -1472,7 +1472,7 @@ mod tests {
14721472 }
14731473 #[ test]
14741474 fn proptest_fixedarray( data in bytes_strat( 4 ..32 ) ) {
1475- check_bytes( FixedLenArray :: < u8 , 16 > :: default ( ) , data) ;
1475+ check_bytes( [ u8 ; 16 ] , data) ;
14761476 }
14771477 }
14781478 }
You can’t perform that action at this time.
0 commit comments