diff options
| author | Sebastian Dröge <sebastian@centricular.com> | 2018-01-09 22:58:41 +0200 |
|---|---|---|
| committer | Sebastian Dröge <sebastian@centricular.com> | 2018-01-13 12:18:58 +0200 |
| commit | 8a82e8e89f6eec3744f12d45c12ce05d48233d8d (patch) | |
| tree | 54f43d2a63290907bfba5f0caf2c3552c19292a7 /src/liballoc | |
| parent | 6bf1dfdd76625ba753de0d1b87a2825606cf6f2b (diff) | |
| download | rust-8a82e8e89f6eec3744f12d45c12ce05d48233d8d.tar.gz rust-8a82e8e89f6eec3744f12d45c12ce05d48233d8d.zip | |
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.
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/slice.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs index 182e9b0a00e..f8980b8777e 100644 --- a/src/liballoc/slice.rs +++ b/src/liballoc/slice.rs @@ -613,6 +613,9 @@ impl<T> [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 @@ impl<T> [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 @@ impl<T> [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 @@ impl<T> [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. |
