@@ -5,7 +5,6 @@ mod iso8601;
55
66use core:: num:: NonZero ;
77use std:: io;
8- use std:: string:: ToString ;
98
109use num_conv:: prelude:: * ;
1110
@@ -142,7 +141,7 @@ pub(crate) fn format_float(
142141#[ inline]
143142pub ( crate ) fn format_number < const WIDTH : u8 > (
144143 output : & mut ( impl io:: Write + ?Sized ) ,
145- value : impl ToString + DigitCount + Copy ,
144+ value : impl itoa :: Integer + DigitCount + Copy ,
146145 padding : modifier:: Padding ,
147146) -> Result < usize , io:: Error > {
148147 match padding {
@@ -158,13 +157,13 @@ pub(crate) fn format_number<const WIDTH: u8>(
158157#[ inline]
159158pub ( crate ) fn format_number_pad_space < const WIDTH : u8 > (
160159 output : & mut ( impl io:: Write + ?Sized ) ,
161- value : impl ToString + DigitCount + Copy ,
160+ value : impl itoa :: Integer + DigitCount + Copy ,
162161) -> Result < usize , io:: Error > {
163162 let mut bytes = 0 ;
164163 for _ in 0 ..( WIDTH . saturating_sub ( value. num_digits ( ) ) ) {
165164 bytes += write ( output, b" " ) ?;
166165 }
167- bytes += write ( output, value . to_string ( ) . as_bytes ( ) ) ?;
166+ bytes += write ( output, itoa :: Buffer :: new ( ) . format ( value ) . as_bytes ( ) ) ?;
168167 Ok ( bytes)
169168}
170169
@@ -174,13 +173,13 @@ pub(crate) fn format_number_pad_space<const WIDTH: u8>(
174173#[ inline]
175174pub ( crate ) fn format_number_pad_zero < const WIDTH : u8 > (
176175 output : & mut ( impl io:: Write + ?Sized ) ,
177- value : impl ToString + DigitCount + Copy ,
176+ value : impl itoa :: Integer + DigitCount + Copy ,
178177) -> Result < usize , io:: Error > {
179178 let mut bytes = 0 ;
180179 for _ in 0 ..( WIDTH . saturating_sub ( value. num_digits ( ) ) ) {
181180 bytes += write ( output, b"0" ) ?;
182181 }
183- bytes += write ( output, value . to_string ( ) . as_bytes ( ) ) ?;
182+ bytes += write ( output, itoa :: Buffer :: new ( ) . format ( value ) . as_bytes ( ) ) ?;
184183 Ok ( bytes)
185184}
186185
@@ -190,9 +189,9 @@ pub(crate) fn format_number_pad_zero<const WIDTH: u8>(
190189#[ inline]
191190pub ( crate ) fn format_number_pad_none (
192191 output : & mut ( impl io:: Write + ?Sized ) ,
193- value : impl ToString + Copy ,
192+ value : impl itoa :: Integer + Copy ,
194193) -> Result < usize , io:: Error > {
195- write ( output, value . to_string ( ) . as_bytes ( ) )
194+ write ( output, itoa :: Buffer :: new ( ) . format ( value ) . as_bytes ( ) )
196195}
197196
198197/// Format the provided component into the designated output. An `Err` will be returned if the
0 commit comments