diff options
| author | Matthew Esposito <matt@matthew.science> | 2022-09-26 12:50:45 -0400 |
|---|---|---|
| committer | Matthew Esposito <matt@matthew.science> | 2022-09-26 13:03:59 -0400 |
| commit | 4fad063cbac1cbdbe831da23c0722487cebc81f3 (patch) | |
| tree | 3078f5e1ada623c79d7a08da895fcfa8c8e2cb3c | |
| parent | 84946fe2412194418b838c34815b79d36b22d4f8 (diff) | |
| download | rust-4fad063cbac1cbdbe831da23c0722487cebc81f3.tar.gz rust-4fad063cbac1cbdbe831da23c0722487cebc81f3.zip | |
Document that Display entails ToString
| -rw-r--r-- | library/core/src/fmt/mod.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index 905212eb372..372439f14ec 100644 --- a/library/core/src/fmt/mod.rs +++ b/library/core/src/fmt/mod.rs @@ -709,12 +709,19 @@ pub use macros::Debug; /// Format trait for an empty format, `{}`. /// +/// Implementing this trait for a type will automatically implement the +/// [`ToString`][tostring] trait for the type, allowing the usage +/// of the [`.to_string()`][tostring_function] method. Prefer implementing +/// the `Display` trait for a type, rather than [`ToString`][tostring]. +/// /// `Display` is similar to [`Debug`], but `Display` is for user-facing /// output, and so cannot be derived. /// /// For more information on formatters, see [the module-level documentation][module]. /// /// [module]: ../../std/fmt/index.html +/// [tostring]: ../../std/string/trait.ToString.html +/// [tostring_function]: ../../std/string/trait.ToString.html#tymethod.to_string /// /// # Examples /// |
