Skip to content

Mention as_chunks in the docs for chunks #143265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions library/core/src/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,9 @@ impl<T> [T] {
/// `chunk_size` elements, and [`rchunks`] for the same iterator but starting at the end of the
/// slice.
///
/// If your `chunk_size` is a constant, consider using [`as_chunks`] instead, which will
/// give references to arrays of exactly that length, rather than slices.
///
/// # Panics
///
/// Panics if `chunk_size` is zero.
Expand All @@ -1137,6 +1140,7 @@ impl<T> [T] {
///
/// [`chunks_exact`]: slice::chunks_exact
/// [`rchunks`]: slice::rchunks
/// [`as_chunks`]: slice::as_chunks
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_slice_make_iter", issue = "137737")]
#[inline]
Expand All @@ -1156,6 +1160,9 @@ impl<T> [T] {
/// exactly `chunk_size` elements, and [`rchunks_mut`] for the same iterator but starting at
/// the end of the slice.
///
/// If your `chunk_size` is a constant, consider using [`as_chunks_mut`] instead, which will
/// give references to arrays of exactly that length, rather than slices.
///
/// # Panics
///
/// Panics if `chunk_size` is zero.
Expand All @@ -1177,6 +1184,7 @@ impl<T> [T] {
///
/// [`chunks_exact_mut`]: slice::chunks_exact_mut
/// [`rchunks_mut`]: slice::rchunks_mut
/// [`as_chunks_mut`]: slice::as_chunks_mut
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_slice_make_iter", issue = "137737")]
#[inline]
Expand All @@ -1199,6 +1207,9 @@ impl<T> [T] {
/// See [`chunks`] for a variant of this iterator that also returns the remainder as a smaller
/// chunk, and [`rchunks_exact`] for the same iterator but starting at the end of the slice.
///
/// If your `chunk_size` is a constant, consider using [`as_chunks`] instead, which will
/// give references to arrays of exactly that length, rather than slices.
///
/// # Panics
///
/// Panics if `chunk_size` is zero.
Expand All @@ -1216,6 +1227,7 @@ impl<T> [T] {
///
/// [`chunks`]: slice::chunks
/// [`rchunks_exact`]: slice::rchunks_exact
/// [`as_chunks`]: slice::chunks
#[stable(feature = "chunks_exact", since = "1.31.0")]
#[rustc_const_unstable(feature = "const_slice_make_iter", issue = "137737")]
#[inline]
Expand All @@ -1239,6 +1251,9 @@ impl<T> [T] {
/// smaller chunk, and [`rchunks_exact_mut`] for the same iterator but starting at the end of
/// the slice.
///
/// If your `chunk_size` is a constant, consider using [`as_chunks_mut`] instead, which will
/// give references to arrays of exactly that length, rather than slices.
///
/// # Panics
///
/// Panics if `chunk_size` is zero.
Expand All @@ -1260,6 +1275,7 @@ impl<T> [T] {
///
/// [`chunks_mut`]: slice::chunks_mut
/// [`rchunks_exact_mut`]: slice::rchunks_exact_mut
/// [`as_chunks_mut`]: slice::as_chunks_mut
#[stable(feature = "chunks_exact", since = "1.31.0")]
#[rustc_const_unstable(feature = "const_slice_make_iter", issue = "137737")]
#[inline]
Expand Down Expand Up @@ -1707,6 +1723,9 @@ impl<T> [T] {
/// `chunk_size` elements, and [`chunks`] for the same iterator but starting at the beginning
/// of the slice.
///
/// If your `chunk_size` is a constant, consider using [`as_rchunks`] instead, which will
/// give references to arrays of exactly that length, rather than slices.
///
/// # Panics
///
/// Panics if `chunk_size` is zero.
Expand All @@ -1724,6 +1743,7 @@ impl<T> [T] {
///
/// [`rchunks_exact`]: slice::rchunks_exact
/// [`chunks`]: slice::chunks
/// [`as_rchunks`]: slice::as_rchunks
#[stable(feature = "rchunks", since = "1.31.0")]
#[rustc_const_unstable(feature = "const_slice_make_iter", issue = "137737")]
#[inline]
Expand All @@ -1743,6 +1763,9 @@ impl<T> [T] {
/// exactly `chunk_size` elements, and [`chunks_mut`] for the same iterator but starting at the
/// beginning of the slice.
///
/// If your `chunk_size` is a constant, consider using [`as_rchunks_mut`] instead, which will
/// give references to arrays of exactly that length, rather than slices.
///
/// # Panics
///
/// Panics if `chunk_size` is zero.
Expand All @@ -1764,6 +1787,7 @@ impl<T> [T] {
///
/// [`rchunks_exact_mut`]: slice::rchunks_exact_mut
/// [`chunks_mut`]: slice::chunks_mut
/// [`as_rchunks_mut`]: slice::as_rchunks_mut
#[stable(feature = "rchunks", since = "1.31.0")]
#[rustc_const_unstable(feature = "const_slice_make_iter", issue = "137737")]
#[inline]
Expand All @@ -1787,6 +1811,9 @@ impl<T> [T] {
/// chunk, and [`chunks_exact`] for the same iterator but starting at the beginning of the
/// slice.
///
/// If your `chunk_size` is a constant, consider using [`as_rchunks`] instead, which will
/// give references to arrays of exactly that length, rather than slices.
///
/// # Panics
///
/// Panics if `chunk_size` is zero.
Expand All @@ -1805,6 +1832,7 @@ impl<T> [T] {
/// [`chunks`]: slice::chunks
/// [`rchunks`]: slice::rchunks
/// [`chunks_exact`]: slice::chunks_exact
/// [`as_rchunks`]: slice::as_rchunks
#[stable(feature = "rchunks", since = "1.31.0")]
#[rustc_const_unstable(feature = "const_slice_make_iter", issue = "137737")]
#[inline]
Expand All @@ -1828,6 +1856,9 @@ impl<T> [T] {
/// smaller chunk, and [`chunks_exact_mut`] for the same iterator but starting at the beginning
/// of the slice.
///
/// If your `chunk_size` is a constant, consider using [`as_rchunks_mut`] instead, which will
/// give references to arrays of exactly that length, rather than slices.
///
/// # Panics
///
/// Panics if `chunk_size` is zero.
Expand All @@ -1850,6 +1881,7 @@ impl<T> [T] {
/// [`chunks_mut`]: slice::chunks_mut
/// [`rchunks_mut`]: slice::rchunks_mut
/// [`chunks_exact_mut`]: slice::chunks_exact_mut
/// [`as_rchunks_mut`]: slice::as_rchunks_mut
#[stable(feature = "rchunks", since = "1.31.0")]
#[rustc_const_unstable(feature = "const_slice_make_iter", issue = "137737")]
#[inline]
Expand Down
Loading