Skip to content

Commit

Permalink
Rollup merge of rust-lang#40028 - withoutboats:string_from_iter, r=al…
Browse files Browse the repository at this point in the history
…excrichton

impl FromIterator<&char> for String
  • Loading branch information
frewsxcv committed Mar 1, 2017
2 parents 06a0233 + 097398e commit 0a008b9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,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 {
Expand Down

0 comments on commit 0a008b9

Please sign in to comment.