@@ -1093,6 +1093,22 @@ where
1093
1093
#[ stable( feature = "fused" , since = "1.26.0" ) ]
1094
1094
impl < I : FusedIterator , P > FusedIterator for Filter < I , P > where P : FnMut ( & I :: Item ) -> bool { }
1095
1095
1096
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
1097
+ unsafe impl < S : Iterator , P , I : Iterator > SourceIter for Filter < I , P > where
1098
+ P : FnMut ( & I :: Item ) -> bool ,
1099
+ I : SourceIter < Source = S >
1100
+ {
1101
+ type Source = S ;
1102
+
1103
+ #[ inline]
1104
+ fn as_inner ( & mut self ) -> & mut S {
1105
+ SourceIter :: as_inner ( & mut self . iter )
1106
+ }
1107
+ }
1108
+
1109
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
1110
+ unsafe impl < I : InPlaceIterable , P > InPlaceIterable for Filter < I , P > where P : FnMut ( & I :: Item ) -> bool { }
1111
+
1096
1112
/// An iterator that uses `f` to both filter and map elements from `iter`.
1097
1113
///
1098
1114
/// This `struct` is created by the [`filter_map`] method on [`Iterator`]. See its
@@ -1219,6 +1235,23 @@ where
1219
1235
#[ stable( feature = "fused" , since = "1.26.0" ) ]
1220
1236
impl < B , I : FusedIterator , F > FusedIterator for FilterMap < I , F > where F : FnMut ( I :: Item ) -> Option < B > { }
1221
1237
1238
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
1239
+ unsafe impl < S : Iterator , B , I : Iterator , F > SourceIter for FilterMap < I , F > where
1240
+ F : FnMut ( I :: Item ) -> Option < B > ,
1241
+ I : SourceIter < Source = S >
1242
+ {
1243
+ type Source = S ;
1244
+
1245
+ #[ inline]
1246
+ fn as_inner ( & mut self ) -> & mut S {
1247
+ SourceIter :: as_inner ( & mut self . iter )
1248
+ }
1249
+ }
1250
+
1251
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
1252
+ unsafe impl < B , I : InPlaceIterable , F > InPlaceIterable for FilterMap < I , F > where F : FnMut ( I :: Item ) -> Option < B > { }
1253
+
1254
+
1222
1255
/// An iterator that yields the current count and the element during iteration.
1223
1256
///
1224
1257
/// This `struct` is created by the [`enumerate`] method on [`Iterator`]. See its
@@ -1777,6 +1810,22 @@ where
1777
1810
{
1778
1811
}
1779
1812
1813
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
1814
+ unsafe impl < S : Iterator , P , I : Iterator > SourceIter for SkipWhile < I , P > where
1815
+ P : FnMut ( & I :: Item ) -> bool ,
1816
+ I : SourceIter < Source = S >
1817
+ {
1818
+ type Source = S ;
1819
+
1820
+ #[ inline]
1821
+ fn as_inner ( & mut self ) -> & mut S {
1822
+ SourceIter :: as_inner ( & mut self . iter )
1823
+ }
1824
+ }
1825
+
1826
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
1827
+ unsafe impl < I : InPlaceIterable , F > InPlaceIterable for SkipWhile < I , F > where F : FnMut ( & I :: Item ) -> bool { }
1828
+
1780
1829
/// An iterator that only accepts elements while `predicate` returns `true`.
1781
1830
///
1782
1831
/// This `struct` is created by the [`take_while`] method on [`Iterator`]. See its
@@ -1966,6 +2015,24 @@ where
1966
2015
{
1967
2016
}
1968
2017
2018
+
2019
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
2020
+ unsafe impl < S : Iterator , P , I : Iterator > SourceIter for TakeWhile < I , P > where
2021
+ P : FnMut ( & I :: Item ) -> bool ,
2022
+ I : SourceIter < Source = S >
2023
+ {
2024
+ type Source = S ;
2025
+
2026
+ #[ inline]
2027
+ fn as_inner ( & mut self ) -> & mut S {
2028
+ SourceIter :: as_inner ( & mut self . iter )
2029
+ }
2030
+ }
2031
+
2032
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
2033
+ unsafe impl < I : InPlaceIterable , F > InPlaceIterable for TakeWhile < I , F > where F : FnMut ( & I :: Item ) -> bool { }
2034
+
2035
+
1969
2036
/// An iterator that skips over `n` elements of `iter`.
1970
2037
///
1971
2038
/// This `struct` is created by the [`skip`] method on [`Iterator`]. See its
@@ -2259,6 +2326,19 @@ where
2259
2326
}
2260
2327
}
2261
2328
2329
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
2330
+ unsafe impl < S : Iterator , I : Iterator > SourceIter for Take < I > where I : SourceIter < Source = S > {
2331
+ type Source = S ;
2332
+
2333
+ #[ inline]
2334
+ fn as_inner ( & mut self ) -> & mut S {
2335
+ SourceIter :: as_inner ( & mut self . iter )
2336
+ }
2337
+ }
2338
+
2339
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
2340
+ unsafe impl < I : InPlaceIterable > InPlaceIterable for Take < I > { }
2341
+
2262
2342
#[ stable( feature = "double_ended_take_iterator" , since = "1.38.0" ) ]
2263
2343
impl < I > DoubleEndedIterator for Take < I >
2264
2344
where
@@ -2391,6 +2471,24 @@ where
2391
2471
}
2392
2472
}
2393
2473
2474
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
2475
+ unsafe impl < St , F , B , S : Iterator , I : Iterator > SourceIter for Scan < I , St , F >
2476
+ where I : SourceIter < Source = S > ,
2477
+ F : FnMut ( & mut St , I :: Item ) -> Option < B > ,
2478
+ {
2479
+ type Source = S ;
2480
+
2481
+ #[ inline]
2482
+ fn as_inner ( & mut self ) -> & mut S {
2483
+ SourceIter :: as_inner ( & mut self . iter )
2484
+ }
2485
+ }
2486
+
2487
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
2488
+ unsafe impl < St , F , B , I : InPlaceIterable > InPlaceIterable for Scan < I , St , F >
2489
+ where F : FnMut ( & mut St , I :: Item ) -> Option < B > ,
2490
+ { }
2491
+
2394
2492
/// An iterator that yields `None` forever after the underlying iterator
2395
2493
/// yields `None` once.
2396
2494
///
@@ -2808,6 +2906,22 @@ where
2808
2906
#[ stable( feature = "fused" , since = "1.26.0" ) ]
2809
2907
impl < I : FusedIterator , F > FusedIterator for Inspect < I , F > where F : FnMut ( & I :: Item ) { }
2810
2908
2909
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
2910
+ unsafe impl < S : Iterator , I : Iterator , F > SourceIter for Inspect < I , F > where
2911
+ F : FnMut ( & I :: Item ) ,
2912
+ I : SourceIter < Source = S >
2913
+ {
2914
+ type Source = S ;
2915
+
2916
+ #[ inline]
2917
+ fn as_inner ( & mut self ) -> & mut S {
2918
+ SourceIter :: as_inner ( & mut self . iter )
2919
+ }
2920
+ }
2921
+
2922
+ #[ unstable( issue = "0" , feature = "inplace_iteration" ) ]
2923
+ unsafe impl < I : InPlaceIterable , F > InPlaceIterable for Inspect < I , F > where F : FnMut ( & I :: Item ) { }
2924
+
2811
2925
/// An iterator adapter that produces output as long as the underlying
2812
2926
/// iterator produces `Result::Ok` values.
2813
2927
///
0 commit comments