about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authordjugei <ddjugei@gmail.com>2020-05-27 19:59:44 +0200
committerdjugei <ddjugei@gmail.com>2020-05-27 19:59:44 +0200
commitb4337ab8c387658b7012fa242e429f46c5f31141 (patch)
tree67e64cace652f0363f8d5f8a915c173e15f63405 /src/liballoc
parent52b605c8cb2f730e607de0777a694cd1b9bb3e15 (diff)
downloadrust-b4337ab8c387658b7012fa242e429f46c5f31141.tar.gz
rust-b4337ab8c387658b7012fa242e429f46c5f31141.zip
added .collect() into String from Box<str> with fake feature/stability annotation
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/string.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs
index f3fe1adebb1..f205835845e 100644
--- a/src/liballoc/string.rs
+++ b/src/liballoc/string.rs
@@ -1772,6 +1772,15 @@ impl FromIterator<String> for String {
     }
 }
 
+#[stable(feature = "box_str2", since = "1.45.0")]
+impl FromIterator<Box<str>> for String {
+    fn from_iter<I: IntoIterator<Item = Box<str>>>(iter: I) -> String {
+        let mut buf = String::new();
+        buf.extend(iter);
+        buf
+    }
+}
+
 #[stable(feature = "herd_cows", since = "1.19.0")]
 impl<'a> FromIterator<Cow<'a, str>> for String {
     fn from_iter<I: IntoIterator<Item = Cow<'a, str>>>(iter: I) -> String {
@@ -1815,6 +1824,13 @@ impl<'a> Extend<&'a str> for String {
     }
 }
 
+#[stable(feature = "box_str2", since = "1.45.0")]
+impl Extend<Box<str>> for String {
+    fn extend<I: IntoIterator<Item = Box<str>>>(&mut self, iter: I) {
+        iter.into_iter().for_each(move |s| self.push_str(&s));
+    }
+}
+
 #[stable(feature = "extend_string", since = "1.4.0")]
 impl Extend<String> for String {
     fn extend<I: IntoIterator<Item = String>>(&mut self, iter: I) {