This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -633,6 +633,23 @@ pub use macros::Debug;
633633/// [tostring]: ../../std/string/trait.ToString.html
634634/// [tostring_function]: ../../std/string/trait.ToString.html#tymethod.to_string
635635///
636+ /// # Internationalization
637+ ///
638+ /// Because a type only has one `Display` implementation, it is often preferable
639+ /// to only implement `Display` when there is a single most "obvious" way that
640+ /// values can be formatted as text. This could mean formatting according to the
641+ /// "invariant" culture and "undefined" locale, or it could mean that the type
642+ /// display is designed for a specific culture/locale, such as developer logs.
643+ ///
644+ /// If not all values have a justifiably canonical textual format or if you want
645+ /// to support alternative formats not covered by the standard set of possible
646+ /// [formatting traits], the most flexible approach is display adapters: methods
647+ /// like [`str::escape_default`] or [`Path::display`] which create a wrapper
648+ /// implementing `Display` to output the specific display format.
649+ ///
650+ /// [formatting traits]: ../../std/fmt/index.html#formatting-traits
651+ /// [`Path::display`]: ../../std/path/struct.Path.html#method.display
652+ ///
636653/// # Examples
637654///
638655/// Implementing `Display` on a type:
You can’t perform that action at this time.
0 commit comments