Skip to content

Commit e227433

Browse files
committed
Auto merge of #38711 - programble:doc/slice-iter-method-links, r=brson
Add links to methods on all slice iterator struct docs In the same style as `std::slice::Iter` to help people find how to create iterators. r? @steveklabnik
2 parents 453172b + 8d88bbc commit e227433

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

src/libcore/slice.rs

+45
Original file line numberDiff line numberDiff line change
@@ -1301,6 +1301,11 @@ trait SplitIter: DoubleEndedIterator {
13011301

13021302
/// An iterator over subslices separated by elements that match a predicate
13031303
/// function.
1304+
///
1305+
/// This struct is created by the [`split`] method on [slices].
1306+
///
1307+
/// [`split`]: ../../std/primitive.slice.html#method.split
1308+
/// [slices]: ../../std/primitive.slice.html
13041309
#[stable(feature = "rust1", since = "1.0.0")]
13051310
pub struct Split<'a, T:'a, P> where P: FnMut(&T) -> bool {
13061311
v: &'a [T],
@@ -1387,6 +1392,11 @@ impl<'a, T, P> FusedIterator for Split<'a, T, P> where P: FnMut(&T) -> bool {}
13871392

13881393
/// An iterator over the subslices of the vector which are separated
13891394
/// by elements that match `pred`.
1395+
///
1396+
/// This struct is created by the [`split_mut`] method on [slices].
1397+
///
1398+
/// [`split_mut`]: ../../std/primitive.slice.html#method.split_mut
1399+
/// [slices]: ../../std/primitive.slice.html
13901400
#[stable(feature = "rust1", since = "1.0.0")]
13911401
pub struct SplitMut<'a, T:'a, P> where P: FnMut(&T) -> bool {
13921402
v: &'a mut [T],
@@ -1512,6 +1522,11 @@ impl<T, I: SplitIter<Item=T>> Iterator for GenericSplitN<I> {
15121522

15131523
/// An iterator over subslices separated by elements that match a predicate
15141524
/// function, limited to a given number of splits.
1525+
///
1526+
/// This struct is created by the [`splitn`] method on [slices].
1527+
///
1528+
/// [`splitn`]: ../../std/primitive.slice.html#method.splitn
1529+
/// [slices]: ../../std/primitive.slice.html
15151530
#[stable(feature = "rust1", since = "1.0.0")]
15161531
pub struct SplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool {
15171532
inner: GenericSplitN<Split<'a, T, P>>
@@ -1529,6 +1544,11 @@ impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for SplitN<'a, T, P> where P: FnMut(&
15291544
/// An iterator over subslices separated by elements that match a
15301545
/// predicate function, limited to a given number of splits, starting
15311546
/// from the end of the slice.
1547+
///
1548+
/// This struct is created by the [`rsplitn`] method on [slices].
1549+
///
1550+
/// [`rsplitn`]: ../../std/primitive.slice.html#method.rsplitn
1551+
/// [slices]: ../../std/primitive.slice.html
15321552
#[stable(feature = "rust1", since = "1.0.0")]
15331553
pub struct RSplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool {
15341554
inner: GenericSplitN<Split<'a, T, P>>
@@ -1545,6 +1565,11 @@ impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for RSplitN<'a, T, P> where P: FnMut(
15451565

15461566
/// An iterator over subslices separated by elements that match a predicate
15471567
/// function, limited to a given number of splits.
1568+
///
1569+
/// This struct is created by the [`splitn_mut`] method on [slices].
1570+
///
1571+
/// [`splitn_mut`]: ../../std/primitive.slice.html#method.splitn_mut
1572+
/// [slices]: ../../std/primitive.slice.html
15481573
#[stable(feature = "rust1", since = "1.0.0")]
15491574
pub struct SplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool {
15501575
inner: GenericSplitN<SplitMut<'a, T, P>>
@@ -1562,6 +1587,11 @@ impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for SplitNMut<'a, T, P> where P: FnMu
15621587
/// An iterator over subslices separated by elements that match a
15631588
/// predicate function, limited to a given number of splits, starting
15641589
/// from the end of the slice.
1590+
///
1591+
/// This struct is created by the [`rsplitn_mut`] method on [slices].
1592+
///
1593+
/// [`rsplitn_mut`]: ../../std/primitive.slice.html#method.rsplitn_mut
1594+
/// [slices]: ../../std/primitive.slice.html
15651595
#[stable(feature = "rust1", since = "1.0.0")]
15661596
pub struct RSplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool {
15671597
inner: GenericSplitN<SplitMut<'a, T, P>>
@@ -1607,6 +1637,11 @@ forward_iterator! { SplitNMut: T, &'a mut [T] }
16071637
forward_iterator! { RSplitNMut: T, &'a mut [T] }
16081638

16091639
/// An iterator over overlapping subslices of length `size`.
1640+
///
1641+
/// This struct is created by the [`windows`] method on [slices].
1642+
///
1643+
/// [`windows`]: ../../std/primitive.slice.html#method.windows
1644+
/// [slices]: ../../std/primitive.slice.html
16101645
#[derive(Debug)]
16111646
#[stable(feature = "rust1", since = "1.0.0")]
16121647
pub struct Windows<'a, T:'a> {
@@ -1704,6 +1739,11 @@ impl<'a, T> FusedIterator for Windows<'a, T> {}
17041739
///
17051740
/// When the slice len is not evenly divided by the chunk size, the last slice
17061741
/// of the iteration will be the remainder.
1742+
///
1743+
/// This struct is created by the [`chunks`] method on [slices].
1744+
///
1745+
/// [`chunks`]: ../../std/primitive.slice.html#method.chunks
1746+
/// [slices]: ../../std/primitive.slice.html
17071747
#[derive(Debug)]
17081748
#[stable(feature = "rust1", since = "1.0.0")]
17091749
pub struct Chunks<'a, T:'a> {
@@ -1808,6 +1848,11 @@ impl<'a, T> FusedIterator for Chunks<'a, T> {}
18081848
/// An iterator over a slice in (non-overlapping) mutable chunks (`size`
18091849
/// elements at a time). When the slice len is not evenly divided by the chunk
18101850
/// size, the last slice of the iteration will be the remainder.
1851+
///
1852+
/// This struct is created by the [`chunks_mut`] method on [slices].
1853+
///
1854+
/// [`chunks_mut`]: ../../std/primitive.slice.html#method.chunks_mut
1855+
/// [slices]: ../../std/primitive.slice.html
18111856
#[derive(Debug)]
18121857
#[stable(feature = "rust1", since = "1.0.0")]
18131858
pub struct ChunksMut<'a, T:'a> {

0 commit comments

Comments
 (0)