]> git.lizzy.rs Git - rust.git/commitdiff
impl FromIter<&char> for String
authorWithout Boats <woboats@gmail.com>
Wed, 22 Feb 2017 08:06:40 +0000 (00:06 -0800)
committerWithout Boats <woboats@gmail.com>
Wed, 22 Feb 2017 08:06:40 +0000 (00:06 -0800)
src/libcollections/string.rs

index e92eb4ff7bdd4b565b4a81543e09b366d9230dae..e81712fd7265d269336715c668655b126766678d 100644 (file)
@@ -1480,6 +1480,15 @@ fn from_iter<I: IntoIterator<Item = char>>(iter: I) -> 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 {