We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0366cca commit 93b5112Copy full SHA for 93b5112
src/liballoc/string.rs
@@ -2206,6 +2206,20 @@ impl<'a> From<&'a str> for String {
2206
#[cfg(not(test))]
2207
#[stable(feature = "string_from_box", since = "1.18.0")]
2208
impl From<Box<str>> for String {
2209
+ /// Converts the given boxed `str` slice to a `String`.
2210
+ /// It is notable that the `str` slice must be owned.
2211
+ ///
2212
+ /// # Examples
2213
2214
+ /// Basic usage:
2215
2216
+ /// ```
2217
+ /// let s1 : String = String::from("hello world");
2218
+ /// let s2 : Box<str> = s1.into_boxed_str();
2219
+ /// let s3 : String = String::from(s2);
2220
2221
+ /// assert_eq!("hello world", s3)
2222
2223
fn from(s: Box<str>) -> String {
2224
s.into_string()
2225
}
0 commit comments