@@ -768,18 +768,27 @@ impl fmt::Display for FromUtf16Error {
768
768
769
769
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
770
770
impl FromIterator < char > for String {
771
- fn from_iter < I : IntoIterator < Item =char > > ( iter : I ) -> String {
771
+ fn from_iter < I : IntoIterator < Item =char > > ( iterable : I ) -> String {
772
772
let mut buf = String :: new ( ) ;
773
- buf. extend ( iter ) ;
773
+ buf. extend ( iterable ) ;
774
774
buf
775
775
}
776
776
}
777
777
778
778
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
779
779
impl < ' a > FromIterator < & ' a str > for String {
780
- fn from_iter < I : IntoIterator < Item =& ' a str > > ( iter : I ) -> String {
780
+ fn from_iter < I : IntoIterator < Item =& ' a str > > ( iterable : I ) -> String {
781
781
let mut buf = String :: new ( ) ;
782
- buf. extend ( iter) ;
782
+ buf. extend ( iterable) ;
783
+ buf
784
+ }
785
+ }
786
+
787
+ #[ stable( feature = "extend_string" , since = "1.4.0" ) ]
788
+ impl FromIterator < String > for String {
789
+ fn from_iter < I : IntoIterator < Item =String > > ( iterable : I ) -> String {
790
+ let mut buf = String :: new ( ) ;
791
+ buf. extend ( iterable) ;
783
792
buf
784
793
}
785
794
}
@@ -798,8 +807,8 @@ impl Extend<char> for String {
798
807
799
808
#[ stable( feature = "extend_ref" , since = "1.2.0" ) ]
800
809
impl < ' a > Extend < & ' a char > for String {
801
- fn extend < I : IntoIterator < Item =& ' a char > > ( & mut self , iter : I ) {
802
- self . extend ( iter . into_iter ( ) . cloned ( ) ) ;
810
+ fn extend < I : IntoIterator < Item =& ' a char > > ( & mut self , iterable : I ) {
811
+ self . extend ( iterable . into_iter ( ) . cloned ( ) ) ;
803
812
}
804
813
}
805
814
@@ -812,6 +821,15 @@ impl<'a> Extend<&'a str> for String {
812
821
}
813
822
}
814
823
824
+ #[ stable( feature = "extend_string" , since = "1.4.0" ) ]
825
+ impl Extend < String > for String {
826
+ fn extend < I : IntoIterator < Item =String > > ( & mut self , iterable : I ) {
827
+ for s in iterable {
828
+ self . push_str ( & s)
829
+ }
830
+ }
831
+ }
832
+
815
833
/// A convenience impl that delegates to the impl for `&str`
816
834
impl < ' a , ' b > Pattern < ' a > for & ' b String {
817
835
type Searcher = <& ' b str as Pattern < ' a > >:: Searcher ;
0 commit comments