File tree 1 file changed +17
-0
lines changed
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;
633
633
/// [tostring]: ../../std/string/trait.ToString.html
634
634
/// [tostring_function]: ../../std/string/trait.ToString.html#tymethod.to_string
635
635
///
636
+ /// # Internationalization
637
+ ///
638
+ /// Because a type can only have 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
+ ///
636
653
/// # Examples
637
654
///
638
655
/// Implementing `Display` on a type:
You can’t perform that action at this time.
0 commit comments