]> git.lizzy.rs Git - rust.git/commitdiff
Make # format easier to discover
authorAndrew Lamb <andrew@nerdnetworks.org>
Mon, 22 Mar 2021 19:14:24 +0000 (15:14 -0400)
committerAndrew Lamb <andrew@nerdnetworks.org>
Mon, 22 Mar 2021 19:14:24 +0000 (15:14 -0400)
library/alloc/src/fmt.rs

index f9424b1d74744a21279ca290bbbd7e2054dc099c..8453f694e1e477fd6983eb18a647e959e9d63ffc 100644 (file)
 //! format!("{value}", value=4);      // => "4"
 //! format!("{} {}", 1, 2);           // => "1 2"
 //! format!("{:04}", 42);             // => "0042" with leading zeros
+//! format!("{:#?}", (100, 200));     // => "(
+//!                                   //       100,
+//!                                   //       200,
+//!                                   //     )"
 //! ```
 //!
 //! From these, you can see that the first argument is a format string. It is
 //! * `-` - Currently not used
 //! * `#` - This flag indicates that the "alternate" form of printing should
 //!         be used. The alternate forms are:
-//!     * `#?` - pretty-print the [`Debug`] formatting
+//!     * `#?` - pretty-print the [`Debug`] formatting (newline and indent)
 //!     * `#x` - precedes the argument with a `0x`
 //!     * `#X` - precedes the argument with a `0x`
 //!     * `#b` - precedes the argument with a `0b`