@@ -1231,6 +1231,21 @@ impl<T> [T] {
12311231 /// assert_eq!(iter.next(), Some(&[2, 2, 2][..]));
12321232 /// assert_eq!(iter.next(), None);
12331233 /// ```
1234+ ///
1235+ /// This method can be used to extract the sorted subslices:
1236+ ///
1237+ /// ```
1238+ /// #![feature(slice_group_by)]
1239+ ///
1240+ /// let slice = &[1, 1, 2, 3, 2, 3, 2, 3, 4];
1241+ ///
1242+ /// let mut iter = slice.group_by(|a, b| a <= b);
1243+ ///
1244+ /// assert_eq!(iter.next(), Some(&[1, 1, 2, 3][..]));
1245+ /// assert_eq!(iter.next(), Some(&[2, 3][..]));
1246+ /// assert_eq!(iter.next(), Some(&[2, 3, 4][..]));
1247+ /// assert_eq!(iter.next(), None);
1248+ /// ```
12341249 #[ unstable( feature = "slice_group_by" , issue = "none" ) ]
12351250 #[ inline]
12361251 pub fn group_by < F > ( & self , pred : F ) -> GroupBy < ' _ , T , F >
@@ -1261,6 +1276,21 @@ impl<T> [T] {
12611276 /// assert_eq!(iter.next(), Some(&mut [2, 2, 2][..]));
12621277 /// assert_eq!(iter.next(), None);
12631278 /// ```
1279+ ///
1280+ /// This method can be used to extract the sorted subslices:
1281+ ///
1282+ /// ```
1283+ /// #![feature(slice_group_by)]
1284+ ///
1285+ /// let slice = &mut [1, 1, 2, 3, 2, 3, 2, 3, 4];
1286+ ///
1287+ /// let mut iter = slice.group_by_mut(|a, b| a <= b);
1288+ ///
1289+ /// assert_eq!(iter.next(), Some(&mut [1, 1, 2, 3][..]));
1290+ /// assert_eq!(iter.next(), Some(&mut [2, 3][..]));
1291+ /// assert_eq!(iter.next(), Some(&mut [2, 3, 4][..]));
1292+ /// assert_eq!(iter.next(), None);
1293+ /// ```
12641294 #[ unstable( feature = "slice_group_by" , issue = "none" ) ]
12651295 #[ inline]
12661296 pub fn group_by_mut < F > ( & mut self , pred : F ) -> GroupByMut < ' _ , T , F >
0 commit comments