about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWithout Boats <woboats@gmail.com>2017-02-22 00:06:40 -0800
committerWithout Boats <woboats@gmail.com>2017-02-22 00:06:40 -0800
commit097398e3837770dce1ee8609083b7344cb983e95 (patch)
tree583387d7e87ebce9c578906e46ef33a779669c00
parentfc6f092c21a7a7249a9f8860f3cd10160aa36c02 (diff)
impl FromIter<&char> for String
-rw-r--r--src/libcollections/string.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index e92eb4ff7bd..e81712fd726 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -1480,6 +1480,15 @@ impl FromIterator<char> for String {
     }
 }
 
+#[stable(feature = "string_from_iter_by_ref", since = "1.17.0")]
+impl<'a> FromIterator<&'a char> for String {
+    fn from_iter<I: IntoIterator<Item = &'a char>>(iter: I) -> String {
+        let mut buf = String::new();
+        buf.extend(iter);
+        buf
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> FromIterator<&'a str> for String {
     fn from_iter<I: IntoIterator<Item = &'a str>>(iter: I) -> String {