Skip to content

Commit b4337ab

Browse files
committed
added .collect() into String from Box<str> with fake feature/stability annotation
1 parent 52b605c commit b4337ab

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/liballoc/string.rs

+16
Original file line numberDiff line numberDiff line change
@@ -1772,6 +1772,15 @@ impl FromIterator<String> for String {
17721772
}
17731773
}
17741774

1775+
#[stable(feature = "box_str2", since = "1.45.0")]
1776+
impl FromIterator<Box<str>> for String {
1777+
fn from_iter<I: IntoIterator<Item = Box<str>>>(iter: I) -> String {
1778+
let mut buf = String::new();
1779+
buf.extend(iter);
1780+
buf
1781+
}
1782+
}
1783+
17751784
#[stable(feature = "herd_cows", since = "1.19.0")]
17761785
impl<'a> FromIterator<Cow<'a, str>> for String {
17771786
fn from_iter<I: IntoIterator<Item = Cow<'a, str>>>(iter: I) -> String {
@@ -1815,6 +1824,13 @@ impl<'a> Extend<&'a str> for String {
18151824
}
18161825
}
18171826

1827+
#[stable(feature = "box_str2", since = "1.45.0")]
1828+
impl Extend<Box<str>> for String {
1829+
fn extend<I: IntoIterator<Item = Box<str>>>(&mut self, iter: I) {
1830+
iter.into_iter().for_each(move |s| self.push_str(&s));
1831+
}
1832+
}
1833+
18181834
#[stable(feature = "extend_string", since = "1.4.0")]
18191835
impl Extend<String> for String {
18201836
fn extend<I: IntoIterator<Item = String>>(&mut self, iter: I) {

0 commit comments

Comments
 (0)