@@ -26,7 +26,12 @@ pub(crate) use self::zip::TrustedRandomAccess;
26
26
#[ must_use = "iterators are lazy and do nothing unless consumed" ]
27
27
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
28
28
pub struct Rev < T > {
29
- pub ( super ) iter : T
29
+ iter : T
30
+ }
31
+ impl < T > Rev < T > {
32
+ pub ( super ) fn new ( iter : T ) -> Rev < T > {
33
+ Rev { iter }
34
+ }
30
35
}
31
36
32
37
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -127,7 +132,12 @@ unsafe impl<I> TrustedLen for Rev<I>
127
132
#[ must_use = "iterators are lazy and do nothing unless consumed" ]
128
133
#[ derive( Clone , Debug ) ]
129
134
pub struct Copied < I > {
130
- pub ( super ) it : I ,
135
+ it : I ,
136
+ }
137
+ impl < I > Copied < I > {
138
+ pub ( super ) fn new ( it : I ) -> Copied < I > {
139
+ Copied { it }
140
+ }
131
141
}
132
142
133
143
#[ unstable( feature = "iter_copied" , issue = "57127" ) ]
@@ -227,7 +237,12 @@ unsafe impl<'a, I, T: 'a> TrustedLen for Copied<I>
227
237
#[ must_use = "iterators are lazy and do nothing unless consumed" ]
228
238
#[ derive( Clone , Debug ) ]
229
239
pub struct Cloned < I > {
230
- pub ( super ) it : I ,
240
+ it : I ,
241
+ }
242
+ impl < I > Cloned < I > {
243
+ pub ( super ) fn new ( it : I ) -> Cloned < I > {
244
+ Cloned { it }
245
+ }
231
246
}
232
247
233
248
#[ stable( feature = "iter_cloned" , since = "1.1.0" ) ]
@@ -525,8 +540,13 @@ impl<I> ExactSizeIterator for StepBy<I> where I: ExactSizeIterator {}
525
540
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
526
541
#[ derive( Clone ) ]
527
542
pub struct Map < I , F > {
528
- pub ( super ) iter : I ,
529
- pub ( super ) f : F ,
543
+ iter : I ,
544
+ f : F ,
545
+ }
546
+ impl < I , F > Map < I , F > {
547
+ pub ( super ) fn new ( iter : I , f : F ) -> Map < I , F > {
548
+ Map { iter, f }
549
+ }
530
550
}
531
551
532
552
#[ stable( feature = "core_impl_debug" , since = "1.9.0" ) ]
@@ -636,8 +656,13 @@ unsafe impl<B, I, F> TrustedRandomAccess for Map<I, F>
636
656
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
637
657
#[ derive( Clone ) ]
638
658
pub struct Filter < I , P > {
639
- pub ( super ) iter : I ,
640
- pub ( super ) predicate : P ,
659
+ iter : I ,
660
+ predicate : P ,
661
+ }
662
+ impl < I , P > Filter < I , P > {
663
+ pub ( super ) fn new ( iter : I , predicate : P ) -> Filter < I , P > {
664
+ Filter { iter, predicate }
665
+ }
641
666
}
642
667
643
668
#[ stable( feature = "core_impl_debug" , since = "1.9.0" ) ]
@@ -768,8 +793,13 @@ impl<I: FusedIterator, P> FusedIterator for Filter<I, P>
768
793
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
769
794
#[ derive( Clone ) ]
770
795
pub struct FilterMap < I , F > {
771
- pub ( super ) iter : I ,
772
- pub ( super ) f : F ,
796
+ iter : I ,
797
+ f : F ,
798
+ }
799
+ impl < I , F > FilterMap < I , F > {
800
+ pub ( super ) fn new ( iter : I , f : F ) -> FilterMap < I , F > {
801
+ FilterMap { iter, f }
802
+ }
773
803
}
774
804
775
805
#[ stable( feature = "core_impl_debug" , since = "1.9.0" ) ]
@@ -1377,8 +1407,13 @@ impl<I, P> FusedIterator for TakeWhile<I, P>
1377
1407
#[ must_use = "iterators are lazy and do nothing unless consumed" ]
1378
1408
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1379
1409
pub struct Skip < I > {
1380
- pub ( super ) iter : I ,
1381
- pub ( super ) n : usize
1410
+ iter : I ,
1411
+ n : usize
1412
+ }
1413
+ impl < I > Skip < I > {
1414
+ pub ( super ) fn new ( iter : I , n : usize ) -> Skip < I > {
1415
+ Skip { iter, n }
1416
+ }
1382
1417
}
1383
1418
1384
1419
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -1518,6 +1553,11 @@ pub struct Take<I> {
1518
1553
pub ( super ) iter : I ,
1519
1554
pub ( super ) n : usize
1520
1555
}
1556
+ impl < I > Take < I > {
1557
+ pub ( super ) fn new ( iter : I , n : usize ) -> Take < I > {
1558
+ Take { iter, n }
1559
+ }
1560
+ }
1521
1561
1522
1562
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1523
1563
impl < I > Iterator for Take < I > where I : Iterator {
@@ -1603,9 +1643,14 @@ unsafe impl<I: TrustedLen> TrustedLen for Take<I> {}
1603
1643
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1604
1644
#[ derive( Clone ) ]
1605
1645
pub struct Scan < I , St , F > {
1606
- pub ( super ) iter : I ,
1607
- pub ( super ) f : F ,
1608
- pub ( super ) state : St ,
1646
+ iter : I ,
1647
+ f : F ,
1648
+ state : St ,
1649
+ }
1650
+ impl < I , St , F > Scan < I , St , F > {
1651
+ pub ( super ) fn new ( iter : I , state : St , f : F ) -> Scan < I , St , F > {
1652
+ Scan { iter, state, f }
1653
+ }
1609
1654
}
1610
1655
1611
1656
#[ stable( feature = "core_impl_debug" , since = "1.9.0" ) ]
@@ -1893,8 +1938,13 @@ impl<I> ExactSizeIterator for Fuse<I> where I: ExactSizeIterator {
1893
1938
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1894
1939
#[ derive( Clone ) ]
1895
1940
pub struct Inspect < I , F > {
1896
- pub ( super ) iter : I ,
1897
- pub ( super ) f : F ,
1941
+ iter : I ,
1942
+ f : F ,
1943
+ }
1944
+ impl < I , F > Inspect < I , F > {
1945
+ pub ( super ) fn new ( iter : I , f : F ) -> Inspect < I , F > {
1946
+ Inspect { iter, f }
1947
+ }
1898
1948
}
1899
1949
1900
1950
#[ stable( feature = "core_impl_debug" , since = "1.9.0" ) ]
0 commit comments