mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Touch up Debug example from PR 92322
This commit is contained in:
parent
1773e8318f
commit
4df1a5561a
@ -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)
|
||||
/// }
|
||||
/// }
|
||||
|
Loading…
Reference in New Issue
Block a user