@@ -2207,7 +2207,7 @@ impl<'a> From<&'a str> for String {
22072207#[ stable( feature = "string_from_box" , since = "1.18.0" ) ]
22082208impl From < Box < str > > for String {
22092209 /// Converts the given boxed `str` slice to a `String`.
2210- /// It is notable that the `str` slice must be owned.
2210+ /// It is notable that the `str` slice is owned.
22112211 ///
22122212 /// # Examples
22132213 ///
@@ -2227,6 +2227,19 @@ impl From<Box<str>> for String {
22272227
22282228#[ stable( feature = "box_from_str" , since = "1.20.0" ) ]
22292229impl From < String > for Box < str > {
2230+ /// Converts the given `String` to a boxed `str` slice that is owned.
2231+ ///
2232+ /// # Examples
2233+ ///
2234+ /// Basic usage:
2235+ ///
2236+ /// ```
2237+ /// let s1 = String::from("hello world");
2238+ /// let s2 : Box<str> = Box::from(s1);
2239+ /// let s3 : String = String::from(s2);
2240+ ///
2241+ /// assert_eq!("hello world", s3)
2242+ /// ```
22302243 fn from ( s : String ) -> Box < str > {
22312244 s. into_boxed_str ( )
22322245 }
@@ -2286,6 +2299,20 @@ impl<'a> FromIterator<String> for Cow<'a, str> {
22862299
22872300#[ stable( feature = "from_string_for_vec_u8" , since = "1.14.0" ) ]
22882301impl From < String > for Vec < u8 > {
2302+ /// Converts the given `String` to a vector `Vec` that holds values of type `u8`.
2303+ ///
2304+ /// # Examples
2305+ ///
2306+ /// Basic usage:
2307+ ///
2308+ /// ```
2309+ /// let s1 = String::from("hello world");
2310+ /// let v1 = Vec::from(s1);
2311+ ///
2312+ /// for b in v1 {
2313+ /// println!("{}", b);
2314+ /// }
2315+ /// ```
22892316 fn from ( string : String ) -> Vec < u8 > {
22902317 string. into_bytes ( )
22912318 }
0 commit comments