@@ -1834,6 +1834,20 @@ impl<'a, T> ChunksExact<'a, T> {
1834
1834
/// Returns the remainder of the original slice that is not going to be
1835
1835
/// returned by the iterator. The returned slice has at most `chunk_size-1`
1836
1836
/// elements.
1837
+ ///
1838
+ /// # Example
1839
+ ///
1840
+ /// ```
1841
+ /// let slice = ['l', 'o', 'r', 'e', 'm'];
1842
+ /// let mut iter = slice.chunks_exact(2);
1843
+ /// assert_eq!(iter.remainder(), &['m'][..]);
1844
+ /// assert_eq!(iter.next(), Some(&['l', 'o'][..]));
1845
+ /// assert_eq!(iter.remainder(), &['m'][..]);
1846
+ /// assert_eq!(iter.next(), Some(&['r', 'e'][..]));
1847
+ /// assert_eq!(iter.remainder(), &['m'][..]);
1848
+ /// assert_eq!(iter.next(), None);
1849
+ /// assert_eq!(iter.remainder(), &['m'][..]);
1850
+ /// ```
1837
1851
#[ must_use]
1838
1852
#[ stable( feature = "chunks_exact" , since = "1.31.0" ) ]
1839
1853
pub fn remainder ( & self ) -> & ' a [ T ] {
@@ -2869,7 +2883,7 @@ unsafe impl<T> Sync for RChunksMut<'_, T> where T: Sync {}
2869
2883
/// ```
2870
2884
///
2871
2885
/// [`rchunks_exact`]: slice::rchunks_exact
2872
- /// [`remainder`]: ChunksExact ::remainder
2886
+ /// [`remainder`]: RChunksExact ::remainder
2873
2887
/// [slices]: slice
2874
2888
#[ derive( Debug ) ]
2875
2889
#[ stable( feature = "rchunks" , since = "1.31.0" ) ]
@@ -2892,6 +2906,20 @@ impl<'a, T> RChunksExact<'a, T> {
2892
2906
/// Returns the remainder of the original slice that is not going to be
2893
2907
/// returned by the iterator. The returned slice has at most `chunk_size-1`
2894
2908
/// elements.
2909
+ ///
2910
+ /// # Example
2911
+ ///
2912
+ /// ```
2913
+ /// let slice = ['l', 'o', 'r', 'e', 'm'];
2914
+ /// let mut iter = slice.rchunks_exact(2);
2915
+ /// assert_eq!(iter.remainder(), &['l'][..]);
2916
+ /// assert_eq!(iter.next(), Some(&['e', 'm'][..]));
2917
+ /// assert_eq!(iter.remainder(), &['l'][..]);
2918
+ /// assert_eq!(iter.next(), Some(&['o', 'r'][..]));
2919
+ /// assert_eq!(iter.remainder(), &['l'][..]);
2920
+ /// assert_eq!(iter.next(), None);
2921
+ /// assert_eq!(iter.remainder(), &['l'][..]);
2922
+ /// ```
2895
2923
#[ must_use]
2896
2924
#[ stable( feature = "rchunks" , since = "1.31.0" ) ]
2897
2925
pub fn remainder ( & self ) -> & ' a [ T ] {
@@ -3031,7 +3059,7 @@ unsafe impl<'a, T> TrustedRandomAccessNoCoerce for RChunksExact<'a, T> {
3031
3059
/// ```
3032
3060
///
3033
3061
/// [`rchunks_exact_mut`]: slice::rchunks_exact_mut
3034
- /// [`into_remainder`]: ChunksExactMut ::into_remainder
3062
+ /// [`into_remainder`]: RChunksExactMut ::into_remainder
3035
3063
/// [slices]: slice
3036
3064
#[ derive( Debug ) ]
3037
3065
#[ stable( feature = "rchunks" , since = "1.31.0" ) ]
0 commit comments