Skip to content

Commit 097398e

Browse files
committed
impl FromIter<&char> for String
1 parent fc6f092 commit 097398e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/libcollections/string.rs

+9
Original file line numberDiff line numberDiff line change
@@ -1480,6 +1480,15 @@ impl FromIterator<char> for String {
14801480
}
14811481
}
14821482

1483+
#[stable(feature = "string_from_iter_by_ref", since = "1.17.0")]
1484+
impl<'a> FromIterator<&'a char> for String {
1485+
fn from_iter<I: IntoIterator<Item = &'a char>>(iter: I) -> String {
1486+
let mut buf = String::new();
1487+
buf.extend(iter);
1488+
buf
1489+
}
1490+
}
1491+
14831492
#[stable(feature = "rust1", since = "1.0.0")]
14841493
impl<'a> FromIterator<&'a str> for String {
14851494
fn from_iter<I: IntoIterator<Item = &'a str>>(iter: I) -> String {

0 commit comments

Comments
 (0)