@@ -130,13 +130,19 @@ impl PrintableToJson for f64 {
130130impl PrintableToJson for u64 {
131131 fn print_to_json ( & self , w : & mut Printer ) -> PrintResult < ( ) > {
132132 // 64-bit integers are quoted by default
133+ if w. print_options . unquoted_64bit_integers {
134+ return Ok ( write ! ( w. buf, "{}" , self ) ?) ;
135+ }
133136 Ok ( write ! ( w. buf, "\" {}\" " , self ) ?)
134137 }
135138}
136139
137140impl PrintableToJson for i64 {
138141 fn print_to_json ( & self , w : & mut Printer ) -> PrintResult < ( ) > {
139142 // 64-bit integers are quoted by default
143+ if w. print_options . unquoted_64bit_integers {
144+ return Ok ( write ! ( w. buf, "{}" , self ) ?) ;
145+ }
140146 Ok ( write ! ( w. buf, "\" {}\" " , self ) ?)
141147 }
142148}
@@ -563,6 +569,8 @@ pub struct PrintOptions {
563569 pub proto_field_name : bool ,
564570 /// Output field default values.
565571 pub always_output_default_values : bool ,
572+ /// Do not quote 64-bit integers.
573+ pub unquoted_64bit_integers : bool ,
566574 /// Prevent initializing `PrintOptions` enumerating all field.
567575 pub _future_options : ( ) ,
568576}
0 commit comments