diff options
| author | David Tolnay <dtolnay@gmail.com> | 2022-01-04 14:25:20 -0800 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2022-01-04 14:28:28 -0800 |
| commit | 4df1a5561adc0ee6e1635df825d34026e04530b1 (patch) | |
| tree | 68b9240a9936e8060be6d45ecba8da09e54d3582 | |
| parent | 1773e8318f0ff7a928867df0d56c9d58b9b906e7 (diff) | |
| download | rust-4df1a5561adc0ee6e1635df825d34026e04530b1.tar.gz rust-4df1a5561adc0ee6e1635df825d34026e04530b1.zip | |
Touch up Debug example from PR 92322
| -rw-r--r-- | library/core/src/fmt/mod.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index 2d4f477ca01..8a2a64f8dc9 100644 --- a/library/core/src/fmt/mod.rs +++ b/library/core/src/fmt/mod.rs @@ -572,16 +572,20 @@ impl Display for Arguments<'_> { /// /// [`debug_struct`]: Formatter::debug_struct /// -/// For custom cases, it's also possible to implement `Debug` using the [`write!`] macro: +/// Types that do not wish to use the standard suite of debug representations +/// provided by the `Formatter` trait (`debug_struct`, `debug_tuple`, +/// `debut_list`, `debug_set`, `debug_map`) can do something totally custom by +/// manually writing an arbitrary representation to the `Formatter`. +/// /// ``` /// # use std::fmt; /// # struct Point { /// # x: i32, /// # y: i32, /// # } -/// +/// # /// impl fmt::Debug for Point { -/// fn fmt(&self, f: &mut fmt::Formatter <'_>) -> fmt::Result { +/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { /// write!(f, "Point [{} {}]", self.x, self.y) /// } /// } |
