@@ -573,13 +573,25 @@ impl<'b> CodeGenerator<'_, 'b> {
573573 ) ) ;
574574 self . append_field_attributes ( fq_message_name, field. descriptor . name ( ) ) ;
575575 self . push_indent ( ) ;
576- self . buf . push_str ( & format ! (
577- "pub {}: {}<{}, {}>,\n " ,
578- field. rust_name( ) ,
579- map_type. rust_type( ) ,
580- key_ty,
581- value_ty
582- ) ) ;
576+ match map_type {
577+ crate :: MapType :: HashMap => {
578+ self . buf . push_str ( & format ! (
579+ "pub {}: ::std::collections::HashMap<{}, {}>,\n " ,
580+ field. rust_name( ) ,
581+ key_ty,
582+ value_ty
583+ ) ) ;
584+ }
585+ crate :: MapType :: BTreeMap => {
586+ self . buf . push_str ( & format ! (
587+ "pub {}: {}::alloc::collections::BTreeMap<{}, {}>,\n " ,
588+ field. rust_name( ) ,
589+ self . context. prost_path( ) ,
590+ key_ty,
591+ value_ty
592+ ) ) ;
593+ }
594+ }
583595 }
584596
585597 fn append_oneof_field (
@@ -685,8 +697,9 @@ impl<'b> CodeGenerator<'_, 'b> {
685697
686698 if boxed {
687699 self . buf . push_str ( & format ! (
688- "{}(::prost ::alloc::boxed::Box<{}>),\n " ,
700+ "{}({} ::alloc::boxed::Box<{}>),\n " ,
689701 to_upper_camel( field. descriptor. name( ) ) ,
702+ self . context. prost_path( ) ,
690703 ty
691704 ) ) ;
692705 } else {
@@ -983,11 +996,12 @@ impl<'b> CodeGenerator<'_, 'b> {
983996 Type :: Int64 | Type :: Sfixed64 | Type :: Sint64 => String :: from ( "i64" ) ,
984997 Type :: Bool => String :: from ( "bool" ) ,
985998 Type :: String => format ! ( "{}::alloc::string::String" , self . context. prost_path( ) ) ,
986- Type :: Bytes => self
987- . context
988- . bytes_type ( fq_message_name, field. name ( ) )
989- . rust_type ( )
990- . to_owned ( ) ,
999+ Type :: Bytes => match self . context . bytes_type ( fq_message_name, field. name ( ) ) {
1000+ crate :: BytesType :: Vec => {
1001+ format ! ( "{}::alloc::vec::Vec<u8>" , self . context. prost_path( ) )
1002+ }
1003+ crate :: BytesType :: Bytes => format ! ( "{}::bytes::Bytes" , self . context. prost_path( ) ) ,
1004+ } ,
9911005 Type :: Group | Type :: Message => self . resolve_ident ( field. type_name ( ) ) ,
9921006 }
9931007 }
0 commit comments