File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -570,11 +570,26 @@ 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+ /// For custom cases, it's also possible to implement `Debug` using the [`write!`] macro:
576+ /// ```
577+ /// # use std::fmt;
578+ /// # struct Point {
579+ /// # x: i32,
580+ /// # y: i32,
581+ /// # }
582+ ///
583+ /// impl fmt::Debug for Point {
584+ /// fn fmt(&self, f: &mut fmt::Formatter <'_>) -> fmt::Result {
585+ /// write!(f, "Point [{} {}]", self.x, self.y)
586+ /// }
587+ /// }
588+ /// ```
589+ ///
573590/// `Debug` implementations using either `derive` or the debug builder API
574591/// on [`Formatter`] support pretty-printing using the alternate flag: `{:#?}`.
575592///
576- /// [`debug_struct`]: Formatter::debug_struct
577- ///
578593/// Pretty-printing with `#?`:
579594///
580595/// ```
You can’t perform that action at this time.
0 commit comments