37
37
//! - `use_std`
38
38
//! - Enabled by default.
39
39
//! - Disable to compile itertools using `#![no_std]`. This disables
40
- //! any items that depend on collections (like `group_by `, `unique`,
40
+ //! any items that depend on collections (like `chunk_by `, `unique`,
41
41
//! `kmerge`, `join` and many more).
42
42
//!
43
43
//! ## Rust Version
@@ -600,13 +600,13 @@ pub trait Itertools: Iterator {
600
600
/// // Note: The `&` is significant here, `GroupBy` is iterable
601
601
/// // only by reference. You can also call `.into_iter()` explicitly.
602
602
/// let mut data_grouped = Vec::new();
603
- /// for (key, group) in &data.into_iter().group_by (|elt| *elt >= 0) {
603
+ /// for (key, group) in &data.into_iter().chunk_by (|elt| *elt >= 0) {
604
604
/// data_grouped.push((key, group.collect()));
605
605
/// }
606
606
/// assert_eq!(data_grouped, vec![(true, vec![1, 3]), (false, vec![-2, -2]), (true, vec![1, 0, 1, 2])]);
607
607
/// ```
608
608
#[ cfg( feature = "use_alloc" ) ]
609
- fn group_by < K , F > ( self , key : F ) -> GroupBy < K , Self , F >
609
+ fn chunk_by < K , F > ( self , key : F ) -> GroupBy < K , Self , F >
610
610
where
611
611
Self : Sized ,
612
612
F : FnMut ( & Self :: Item ) -> K ,
@@ -615,6 +615,18 @@ pub trait Itertools: Iterator {
615
615
groupbylazy:: new ( self , key)
616
616
}
617
617
618
+ /// See [`.chunk_by()`](Itertools::chunk_by).
619
+ #[ deprecated( note = "Use .chunk_by() instead" , since = "0.13.0" ) ]
620
+ #[ cfg( feature = "use_alloc" ) ]
621
+ fn group_by < K , F > ( self , key : F ) -> GroupBy < K , Self , F >
622
+ where
623
+ Self : Sized ,
624
+ F : FnMut ( & Self :: Item ) -> K ,
625
+ K : PartialEq ,
626
+ {
627
+ self . chunk_by ( key)
628
+ }
629
+
618
630
/// Return an *iterable* that can chunk the iterator.
619
631
///
620
632
/// Yield subiterators (chunks) that each yield a fixed number elements,
0 commit comments