Mention in the exact_chunks docs that this can often be optimized better by the compiler

And also link from the normal chunks iterator to the exact_chunks one.
This commit is contained in:
Sebastian Dröge
2018-01-09 22:58:41 +02:00
parent 6bf1dfdd76
commit 8a82e8e89f
+15
View File
@@ -613,6 +613,9 @@ pub fn windows(&self, size: usize) -> Windows<T> {
/// not divide the length of the slice, then the last chunk will
/// not have length `chunk_size`.
///
/// See [`exact_chunks`] for a variant of this iterator that returns chunks
/// of always exactly `chunk_size` elements.
///
/// # Panics
///
/// Panics if `chunk_size` is 0.
@@ -638,6 +641,10 @@ pub fn chunks(&self, chunk_size: usize) -> Chunks<T> {
/// not divide the length of the slice, then the last up to `chunk_size-1`
/// elements will be omitted.
///
/// Due to each chunk having exactly `chunk_size` elements, the compiler
/// can often optimize the resulting code better than in the case of
/// [`chunks`].
///
/// # Panics
///
/// Panics if `chunk_size` is 0.
@@ -664,6 +671,9 @@ pub fn exact_chunks(&self, chunk_size: usize) -> ExactChunks<T> {
/// not divide the length of the slice, then the last chunk will not
/// have length `chunk_size`.
///
/// See [`exact_chunks_mut`] for a variant of this iterator that returns chunks
/// of always exactly `chunk_size` elements.
///
/// # Panics
///
/// Panics if `chunk_size` is 0.
@@ -693,6 +703,11 @@ pub fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<T> {
/// not divide the length of the slice, then the last up to `chunk_size-1`
/// elements will be omitted.
///
///
/// Due to each chunk having exactly `chunk_size` elements, the compiler
/// can often optimize the resulting code better than in the case of
/// [`chunks_mut`].
///
/// # Panics
///
/// Panics if `chunk_size` is 0.