File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -1179,10 +1179,28 @@ impl PartialEq for ParseError {
11791179#[ stable( feature = "str_parse_error" , since = "1.5.0" ) ]
11801180impl Eq for ParseError { }
11811181
1182- /// A generic trait for converting a value to a string
1182+ /// A trait for converting a value to a `String`.
1183+ ///
1184+ /// This trait is automatically implemented for any type which implements the
1185+ /// [`Display`] trait. As such, `ToString` shouldn't be implemented directly:
1186+ /// [`Display`] should be implemented instead, and you get the `ToString`
1187+ /// implementation for free.
1188+ ///
1189+ /// [`Display`]: ../fmt/trait.Display.html
11831190#[ stable( feature = "rust1" , since = "1.0.0" ) ]
11841191pub trait ToString {
1185- /// Converts the value of `self` to an owned string
1192+ /// Converts the given value to a `String`.
1193+ ///
1194+ /// # Examples
1195+ ///
1196+ /// Basic usage:
1197+ ///
1198+ /// ```
1199+ /// let i = 5;
1200+ /// let five = String::from("5");
1201+ ///
1202+ /// assert_eq!(five, i.to_string());
1203+ /// ```
11861204 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
11871205 fn to_string ( & self ) -> String ;
11881206}
You can’t perform that action at this time.
0 commit comments