File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -335,6 +335,18 @@ pub mod builtin {
335
335
/// proxied through this one. `format_args!`, unlike its derived macros, avoids
336
336
/// heap allocations.
337
337
///
338
+ /// You can use the [`fmt::Arguments`] value that `format_args!` returns
339
+ /// in `Debug` and `Display` contexts as seen below. The example also shows
340
+ /// that `Debug` and `Display` format to the same thing: the interpolated
341
+ /// format string in `format_args!`.
342
+ ///
343
+ /// ```rust
344
+ /// let display = format!("{:?}", format_args!("{} foo {:?}", 1, 2));
345
+ /// let debug = format!("{}", format_args!("{} foo {:?}", 1, 2));
346
+ /// assert_eq!("1 foo 2", display);
347
+ /// assert_eq!(display, debug);
348
+ /// ```
349
+ ///
338
350
/// For more information, see the documentation in [`std::fmt`].
339
351
///
340
352
/// [`Display`]: ../std/fmt/trait.Display.html
You can’t perform that action at this time.
0 commit comments