@@ -130,13 +130,19 @@ impl PrintableToJson for f64 {
130
130
impl PrintableToJson for u64 {
131
131
fn print_to_json ( & self , w : & mut Printer ) -> PrintResult < ( ) > {
132
132
// 64-bit integers are quoted by default
133
+ if w. print_options . unquoted_64bit_integers {
134
+ return Ok ( write ! ( w. buf, "{}" , self ) ?) ;
135
+ }
133
136
Ok ( write ! ( w. buf, "\" {}\" " , self ) ?)
134
137
}
135
138
}
136
139
137
140
impl PrintableToJson for i64 {
138
141
fn print_to_json ( & self , w : & mut Printer ) -> PrintResult < ( ) > {
139
142
// 64-bit integers are quoted by default
143
+ if w. print_options . unquoted_64bit_integers {
144
+ return Ok ( write ! ( w. buf, "{}" , self ) ?) ;
145
+ }
140
146
Ok ( write ! ( w. buf, "\" {}\" " , self ) ?)
141
147
}
142
148
}
@@ -563,6 +569,8 @@ pub struct PrintOptions {
563
569
pub proto_field_name : bool ,
564
570
/// Output field default values.
565
571
pub always_output_default_values : bool ,
572
+ /// Do not quote 64-bit integers.
573
+ pub unquoted_64bit_integers : bool ,
566
574
/// Prevent initializing `PrintOptions` enumerating all field.
567
575
pub _future_options : ( ) ,
568
576
}
0 commit comments