@@ -308,6 +308,16 @@ static USIZE_MARKER: fn(&usize, &mut Formatter<'_>) -> Result = |ptr, _| {
308308 loop { }
309309} ;
310310
311+ macro_rules! arg_new {
312+ ( $f: ident, $t: ident) => {
313+ #[ doc( hidden) ]
314+ #[ unstable( feature = "fmt_internals" , reason = "internal to format_args!" , issue = "none" ) ]
315+ pub fn $f<' b, T : $t>( x: & ' b T ) -> ArgumentV1 <' _> {
316+ Self :: new( x, $t:: fmt)
317+ }
318+ } ;
319+ }
320+
311321impl < ' a > ArgumentV1 < ' a > {
312322 #[ doc( hidden) ]
313323 #[ unstable( feature = "fmt_internals" , reason = "internal to format_args!" , issue = "none" ) ]
@@ -323,6 +333,16 @@ impl<'a> ArgumentV1<'a> {
323333 unsafe { ArgumentV1 { formatter : mem:: transmute ( f) , value : mem:: transmute ( x) } }
324334 }
325335
336+ arg_new ! ( new_display, Display ) ;
337+ arg_new ! ( new_debug, Debug ) ;
338+ arg_new ! ( new_octal, Octal ) ;
339+ arg_new ! ( new_lower_hex, LowerHex ) ;
340+ arg_new ! ( new_upper_hex, UpperHex ) ;
341+ arg_new ! ( new_pointer, Pointer ) ;
342+ arg_new ! ( new_binary, Binary ) ;
343+ arg_new ! ( new_lower_exp, LowerExp ) ;
344+ arg_new ! ( new_upper_exp, UpperExp ) ;
345+
326346 #[ doc( hidden) ]
327347 #[ unstable( feature = "fmt_internals" , reason = "internal to format_args!" , issue = "none" ) ]
328348 pub fn from_usize ( x : & usize ) -> ArgumentV1 < ' _ > {
0 commit comments