@@ -622,6 +622,28 @@ pub trait Itertools: Iterator {
622622 ///
623623 /// **Panics** if the iterators reach an end and they are not of equal
624624 /// lengths.
625+ ///
626+ /// # Examples
627+ ///
628+ /// ```
629+ /// use itertools::Itertools;
630+ ///
631+ /// let a = [1, 2];
632+ /// let b = [3, 4];
633+ ///
634+ /// let zipped: Vec<_> = a.into_iter().zip_eq(b.into_iter()).collect();
635+ ///
636+ /// assert_eq!(zipped, vec![(1, 3), (2, 4)]);
637+ /// ```
638+ ///
639+ /// ```should_panic
640+ /// use itertools::Itertools;
641+ ///
642+ /// let a = [1, 2];
643+ /// let b = [3, 4, 5];
644+ /// // This example panics because the iterators are not of equal length.
645+ /// let _zipped: Vec<_> = a.iter().zip_eq(b.iter()).collect();
646+ /// ```
625647 #[ inline]
626648 fn zip_eq < J > ( self , other : J ) -> ZipEq < Self , J :: IntoIter >
627649 where
@@ -731,6 +753,8 @@ pub trait Itertools: Iterator {
731753 ///
732754 /// **Panics** if `size` is 0.
733755 ///
756+ /// # Examples
757+ ///
734758 /// ```
735759 /// use itertools::Itertools;
736760 ///
@@ -744,6 +768,13 @@ pub trait Itertools: Iterator {
744768 /// assert_eq!(4, chunk.sum());
745769 /// }
746770 /// ```
771+ ///
772+ /// ```should_panic
773+ /// use itertools::Itertools;
774+ /// let data = vec![1, 2, 3];
775+ /// // Panics because chunk size is 0.
776+ /// let _chunks = data.into_iter().chunks(0);
777+ /// ```
747778 #[ cfg( feature = "use_alloc" ) ]
748779 fn chunks ( self , size : usize ) -> IntoChunks < Self >
749780 where
@@ -872,7 +903,7 @@ pub trait Itertools: Iterator {
872903 /// Split into an iterator pair that both yield all elements from
873904 /// the original iterator.
874905 ///
875- /// **Note:** If the iterator is clonable , prefer using that instead
906+ /// **Note:** If the iterator is cloneable , prefer using that instead
876907 /// of using this method. Cloning is likely to be more efficient.
877908 ///
878909 /// Iterator element type is `Self::Item`.
@@ -1003,7 +1034,7 @@ pub trait Itertools: Iterator {
10031034 /// as long as the original iterator produces `Ok` values.
10041035 ///
10051036 /// If the original iterable produces an error at any point, the adapted
1006- /// iterator ends and it will return the error iself .
1037+ /// iterator ends and it will return the error itself .
10071038 ///
10081039 /// Otherwise, the return value from the closure is returned wrapped
10091040 /// inside `Ok`.
@@ -1601,11 +1632,11 @@ pub trait Itertools: Iterator {
16011632 /// #[derive(Debug, PartialEq)]
16021633 /// struct NoCloneImpl(i32);
16031634 ///
1604- /// let non_clonable_items : Vec<_> = vec![1, 2, 3, 4, 5]
1635+ /// let non_cloneable_items : Vec<_> = vec![1, 2, 3, 4, 5]
16051636 /// .into_iter()
16061637 /// .map(NoCloneImpl)
16071638 /// .collect();
1608- /// let filtered: Vec<_> = non_clonable_items
1639+ /// let filtered: Vec<_> = non_cloneable_items
16091640 /// .into_iter()
16101641 /// .take_while_inclusive(|n| n.0 % 3 != 0)
16111642 /// .collect();
@@ -3797,7 +3828,7 @@ pub trait Itertools: Iterator {
37973828 /// value of type `K` will be used as key to identify the groups and the
37983829 /// value of type `V` as value for the folding operation.
37993830 ///
3800- /// See [`GroupingMap`] for more informations
3831+ /// See [`GroupingMap`] for more information
38013832 /// on what operations are available.
38023833 #[ cfg( feature = "use_std" ) ]
38033834 fn into_grouping_map < K , V > ( self ) -> GroupingMap < Self >
@@ -3814,7 +3845,7 @@ pub trait Itertools: Iterator {
38143845 /// The values from this iterator will be used as values for the folding operation
38153846 /// while the keys will be obtained from the values by calling `key_mapper`.
38163847 ///
3817- /// See [`GroupingMap`] for more informations
3848+ /// See [`GroupingMap`] for more information
38183849 /// on what operations are available.
38193850 #[ cfg( feature = "use_std" ) ]
38203851 fn into_grouping_map_by < K , V , F > ( self , key_mapper : F ) -> GroupingMapBy < Self , F >
@@ -4334,7 +4365,7 @@ pub trait Itertools: Iterator {
43344365 }
43354366 }
43364367
4337- /// Return the postions of the minimum and maximum elements of an
4368+ /// Return the positions of the minimum and maximum elements of an
43384369 /// iterator, as determined by the specified function.
43394370 ///
43404371 /// The return value is a variant of [`MinMaxResult`] like for
@@ -4382,7 +4413,7 @@ pub trait Itertools: Iterator {
43824413 }
43834414 }
43844415
4385- /// Return the postions of the minimum and maximum elements of an
4416+ /// Return the positions of the minimum and maximum elements of an
43864417 /// iterator, as determined by the specified comparison function.
43874418 ///
43884419 /// The return value is a variant of [`MinMaxResult`] like for
0 commit comments