File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
branches/snap-stage3/src/libcollections Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: 9146a919b616e39e528e4d7100d16eef52f1f852
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
- refs/heads/snap-stage3: d7d5ccf9bb3bc63f347d8d5441092f20a3fe7088
4
+ refs/heads/snap-stage3: 5ba7c5da62bae732bf466191dbeb5f699ba44d70
5
5
refs/heads/try: 20cbbffeefc1f35e2ea63afce7b42fbd79611d42
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
Original file line number Diff line number Diff line change @@ -729,6 +729,15 @@ impl FromIterator<char> for String {
729
729
}
730
730
}
731
731
732
+ #[ experimental = "waiting on FromIterator stabilization" ]
733
+ impl < ' a > FromIterator < & ' a str > for String {
734
+ fn from_iter < I : Iterator < & ' a str > > ( iterator : I ) -> String {
735
+ let mut buf = String :: new ( ) ;
736
+ buf. extend ( iterator) ;
737
+ buf
738
+ }
739
+ }
740
+
732
741
#[ experimental = "waiting on Extend stabilization" ]
733
742
impl Extend < char > for String {
734
743
fn extend < I : Iterator < char > > ( & mut self , mut iterator : I ) {
@@ -740,6 +749,18 @@ impl Extend<char> for String {
740
749
}
741
750
}
742
751
752
+ #[ experimental = "waiting on Extend stabilization" ]
753
+ impl < ' a > Extend < & ' a str > for String {
754
+ fn extend < I : Iterator < & ' a str > > ( & mut self , mut iterator : I ) {
755
+ // A guess that at least one byte per iterator element will be needed.
756
+ let ( lower_bound, _) = iterator. size_hint ( ) ;
757
+ self . reserve ( lower_bound) ;
758
+ for s in iterator {
759
+ self . push_str ( s)
760
+ }
761
+ }
762
+ }
763
+
743
764
impl PartialEq for String {
744
765
#[ inline]
745
766
fn eq ( & self , other : & String ) -> bool { PartialEq :: eq ( & * * self , & * * other) }
You can’t perform that action at this time.
0 commit comments