@@ -2207,7 +2207,7 @@ impl<'a> From<&'a str> for String {
2207
2207
#[ stable( feature = "string_from_box" , since = "1.18.0" ) ]
2208
2208
impl From < Box < str > > for String {
2209
2209
/// 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.
2211
2211
///
2212
2212
/// # Examples
2213
2213
///
@@ -2227,6 +2227,19 @@ impl From<Box<str>> for String {
2227
2227
2228
2228
#[ stable( feature = "box_from_str" , since = "1.20.0" ) ]
2229
2229
impl 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
+ /// ```
2230
2243
fn from ( s : String ) -> Box < str > {
2231
2244
s. into_boxed_str ( )
2232
2245
}
@@ -2286,6 +2299,20 @@ impl<'a> FromIterator<String> for Cow<'a, str> {
2286
2299
2287
2300
#[ stable( feature = "from_string_for_vec_u8" , since = "1.14.0" ) ]
2288
2301
impl 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
+ /// ```
2289
2316
fn from ( string : String ) -> Vec < u8 > {
2290
2317
string. into_bytes ( )
2291
2318
}
0 commit comments