File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -570,11 +570,30 @@ impl Display for Arguments<'_> {
570570/// There are a number of helper methods on the [`Formatter`] struct to help you with manual
571571/// implementations, such as [`debug_struct`].
572572///
573+ /// [`debug_struct`]: Formatter::debug_struct
574+ ///
575+ /// Types that do not wish to use the standard suite of debug representations
576+ /// provided by the `Formatter` trait (`debug_struct`, `debug_tuple`,
577+ /// `debut_list`, `debug_set`, `debug_map`) can do something totally custom by
578+ /// manually writing an arbitrary representation to the `Formatter`.
579+ ///
580+ /// ```
581+ /// # use std::fmt;
582+ /// # struct Point {
583+ /// # x: i32,
584+ /// # y: i32,
585+ /// # }
586+ /// #
587+ /// impl fmt::Debug for Point {
588+ /// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
589+ /// write!(f, "Point [{} {}]", self.x, self.y)
590+ /// }
591+ /// }
592+ /// ```
593+ ///
573594/// `Debug` implementations using either `derive` or the debug builder API
574595/// on [`Formatter`] support pretty-printing using the alternate flag: `{:#?}`.
575596///
576- /// [`debug_struct`]: Formatter::debug_struct
577- ///
578597/// Pretty-printing with `#?`:
579598///
580599/// ```
You can’t perform that action at this time.
0 commit comments