@@ -1152,6 +1152,22 @@ where
1152
1152
#[ stable( feature = "fused" , since = "1.26.0" ) ]
1153
1153
impl < I : FusedIterator , P > FusedIterator for Filter < I , P > where P : FnMut ( & I :: Item ) -> bool { }
1154
1154
1155
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
1156
+ unsafe impl < S : Iterator , P , I : Iterator > SourceIter for Filter < I , P > where
1157
+ P : FnMut ( & I :: Item ) -> bool ,
1158
+ I : SourceIter < Source = S >
1159
+ {
1160
+ type Source = S ;
1161
+
1162
+ #[ inline]
1163
+ fn as_inner ( & mut self ) -> & mut S {
1164
+ SourceIter :: as_inner ( & mut self . iter )
1165
+ }
1166
+ }
1167
+
1168
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
1169
+ unsafe impl < I : InPlaceIterable , P > InPlaceIterable for Filter < I , P > where P : FnMut ( & I :: Item ) -> bool { }
1170
+
1155
1171
/// An iterator that uses `f` to both filter and map elements from `iter`.
1156
1172
///
1157
1173
/// This `struct` is created by the [`filter_map`] method on [`Iterator`]. See its
@@ -1278,6 +1294,23 @@ where
1278
1294
#[ stable( feature = "fused" , since = "1.26.0" ) ]
1279
1295
impl < B , I : FusedIterator , F > FusedIterator for FilterMap < I , F > where F : FnMut ( I :: Item ) -> Option < B > { }
1280
1296
1297
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
1298
+ unsafe impl < S : Iterator , B , I : Iterator , F > SourceIter for FilterMap < I , F > where
1299
+ F : FnMut ( I :: Item ) -> Option < B > ,
1300
+ I : SourceIter < Source = S >
1301
+ {
1302
+ type Source = S ;
1303
+
1304
+ #[ inline]
1305
+ fn as_inner ( & mut self ) -> & mut S {
1306
+ SourceIter :: as_inner ( & mut self . iter )
1307
+ }
1308
+ }
1309
+
1310
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
1311
+ unsafe impl < B , I : InPlaceIterable , F > InPlaceIterable for FilterMap < I , F > where F : FnMut ( I :: Item ) -> Option < B > { }
1312
+
1313
+
1281
1314
/// An iterator that yields the current count and the element during iteration.
1282
1315
///
1283
1316
/// This `struct` is created by the [`enumerate`] method on [`Iterator`]. See its
@@ -1910,6 +1943,22 @@ where
1910
1943
{
1911
1944
}
1912
1945
1946
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
1947
+ unsafe impl < S : Iterator , P , I : Iterator > SourceIter for SkipWhile < I , P > where
1948
+ P : FnMut ( & I :: Item ) -> bool ,
1949
+ I : SourceIter < Source = S >
1950
+ {
1951
+ type Source = S ;
1952
+
1953
+ #[ inline]
1954
+ fn as_inner ( & mut self ) -> & mut S {
1955
+ SourceIter :: as_inner ( & mut self . iter )
1956
+ }
1957
+ }
1958
+
1959
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
1960
+ unsafe impl < I : InPlaceIterable , F > InPlaceIterable for SkipWhile < I , F > where F : FnMut ( & I :: Item ) -> bool { }
1961
+
1913
1962
/// An iterator that only accepts elements while `predicate` returns `true`.
1914
1963
///
1915
1964
/// This `struct` is created by the [`take_while`] method on [`Iterator`]. See its
@@ -2101,6 +2150,23 @@ where
2101
2150
}
2102
2151
}
2103
2152
2153
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
2154
+ unsafe impl < S : Iterator , P , I : Iterator > SourceIter for TakeWhile < I , P > where
2155
+ P : FnMut ( & I :: Item ) -> bool ,
2156
+ I : SourceIter < Source = S >
2157
+ {
2158
+ type Source = S ;
2159
+
2160
+ #[ inline]
2161
+ fn as_inner ( & mut self ) -> & mut S {
2162
+ SourceIter :: as_inner ( & mut self . iter )
2163
+ }
2164
+ }
2165
+
2166
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
2167
+ unsafe impl < I : InPlaceIterable , F > InPlaceIterable for TakeWhile < I , F > where F : FnMut ( & I :: Item ) -> bool { }
2168
+
2169
+
2104
2170
/// An iterator that skips over `n` elements of `iter`.
2105
2171
///
2106
2172
/// This `struct` is created by the [`skip`] method on [`Iterator`]. See its
@@ -2410,6 +2476,19 @@ where
2410
2476
}
2411
2477
}
2412
2478
2479
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
2480
+ unsafe impl < S : Iterator , I : Iterator > SourceIter for Take < I > where I : SourceIter < Source = S > {
2481
+ type Source = S ;
2482
+
2483
+ #[ inline]
2484
+ fn as_inner ( & mut self ) -> & mut S {
2485
+ SourceIter :: as_inner ( & mut self . iter )
2486
+ }
2487
+ }
2488
+
2489
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
2490
+ unsafe impl < I : InPlaceIterable > InPlaceIterable for Take < I > { }
2491
+
2413
2492
#[ stable( feature = "double_ended_take_iterator" , since = "1.38.0" ) ]
2414
2493
impl < I > DoubleEndedIterator for Take < I >
2415
2494
where
@@ -2574,6 +2653,24 @@ where
2574
2653
}
2575
2654
}
2576
2655
2656
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
2657
+ unsafe impl < St , F , B , S : Iterator , I : Iterator > SourceIter for Scan < I , St , F >
2658
+ where I : SourceIter < Source = S > ,
2659
+ F : FnMut ( & mut St , I :: Item ) -> Option < B > ,
2660
+ {
2661
+ type Source = S ;
2662
+
2663
+ #[ inline]
2664
+ fn as_inner ( & mut self ) -> & mut S {
2665
+ SourceIter :: as_inner ( & mut self . iter )
2666
+ }
2667
+ }
2668
+
2669
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
2670
+ unsafe impl < St , F , B , I : InPlaceIterable > InPlaceIterable for Scan < I , St , F >
2671
+ where F : FnMut ( & mut St , I :: Item ) -> Option < B > ,
2672
+ { }
2673
+
2577
2674
/// An iterator that calls a function with a reference to each element before
2578
2675
/// yielding it.
2579
2676
///
@@ -2720,6 +2817,22 @@ where
2720
2817
#[ stable( feature = "fused" , since = "1.26.0" ) ]
2721
2818
impl < I : FusedIterator , F > FusedIterator for Inspect < I , F > where F : FnMut ( & I :: Item ) { }
2722
2819
2820
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
2821
+ unsafe impl < S : Iterator , I : Iterator , F > SourceIter for Inspect < I , F > where
2822
+ F : FnMut ( & I :: Item ) ,
2823
+ I : SourceIter < Source = S >
2824
+ {
2825
+ type Source = S ;
2826
+
2827
+ #[ inline]
2828
+ fn as_inner ( & mut self ) -> & mut S {
2829
+ SourceIter :: as_inner ( & mut self . iter )
2830
+ }
2831
+ }
2832
+
2833
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
2834
+ unsafe impl < I : InPlaceIterable , F > InPlaceIterable for Inspect < I , F > where F : FnMut ( & I :: Item ) { }
2835
+
2723
2836
/// An iterator adapter that produces output as long as the underlying
2724
2837
/// iterator produces `Result::Ok` values.
2725
2838
///
0 commit comments