@@ -5,9 +5,7 @@ use super::{FusedIterator, TrustedLen};
55
66/// An iterator that repeats an element endlessly.
77///
8- /// This `struct` is created by the [`repeat`] function. See its documentation for more.
9- ///
10- /// [`repeat`]: fn.repeat.html
8+ /// This `struct` is created by the [`repeat()`] function. See its documentation for more.
119#[ derive( Clone , Debug ) ]
1210#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1311pub struct Repeat < A > {
@@ -47,15 +45,11 @@ unsafe impl<A: Clone> TrustedLen for Repeat<A> {}
4745/// The `repeat()` function repeats a single value over and over again.
4846///
4947/// Infinite iterators like `repeat()` are often used with adapters like
50- /// [`take`], in order to make them finite.
51- ///
52- /// [`take`]: trait.Iterator.html#method.take
48+ /// [`Iterator::take()`], in order to make them finite.
5349///
5450/// If the element type of the iterator you need does not implement `Clone`,
5551/// or if you do not want to keep the repeated element in memory, you can
56- /// instead use the [`repeat_with`] function.
57- ///
58- /// [`repeat_with`]: fn.repeat_with.html
52+ /// instead use the [`repeat_with()`] function.
5953///
6054/// # Examples
6155///
@@ -77,7 +71,7 @@ unsafe impl<A: Clone> TrustedLen for Repeat<A> {}
7771/// assert_eq!(Some(4), fours.next());
7872/// ```
7973///
80- /// Going finite with [`take`]:
74+ /// Going finite with [`Iterator:: take() `]:
8175///
8276/// ```
8377/// use std::iter;
@@ -102,10 +96,8 @@ pub fn repeat<T: Clone>(elt: T) -> Repeat<T> {
10296/// An iterator that repeats elements of type `A` endlessly by
10397/// applying the provided closure `F: FnMut() -> A`.
10498///
105- /// This `struct` is created by the [`repeat_with`] function.
99+ /// This `struct` is created by the [`repeat_with() `] function.
106100/// See its documentation for more.
107- ///
108- /// [`repeat_with`]: fn.repeat_with.html
109101#[ derive( Copy , Clone , Debug ) ]
110102#[ stable( feature = "iterator_repeat_with" , since = "1.28.0" ) ]
111103pub struct RepeatWith < F > {
@@ -139,20 +131,18 @@ unsafe impl<A, F: FnMut() -> A> TrustedLen for RepeatWith<F> {}
139131/// The `repeat_with()` function calls the repeater over and over again.
140132///
141133/// Infinite iterators like `repeat_with()` are often used with adapters like
142- /// [`take`], in order to make them finite.
134+ /// [`Iterator:: take() `], in order to make them finite.
143135///
144- /// [`take`]: trait.Iterator.html#method.take
145- ///
146- /// If the element type of the iterator you need implements `Clone`, and
136+ /// If the element type of the iterator you need implements [`Clone`], and
147137/// it is OK to keep the source element in memory, you should instead use
148- /// the [`repeat`] function.
149- ///
150- /// [`repeat`]: fn.repeat.html
138+ /// the [`repeat()`] function.
151139///
152- /// An iterator produced by `repeat_with()` is not a `DoubleEndedIterator`.
153- /// If you need `repeat_with()` to return a `DoubleEndedIterator`,
140+ /// An iterator produced by `repeat_with()` is not a [ `DoubleEndedIterator`] .
141+ /// If you need `repeat_with()` to return a [ `DoubleEndedIterator`] ,
154142/// please open a GitHub issue explaining your use case.
155143///
144+ /// [`DoubleEndedIterator`]: crate::iter::DoubleEndedIterator
145+ ///
156146/// # Examples
157147///
158148/// Basic usage:
@@ -201,9 +191,7 @@ pub fn repeat_with<A, F: FnMut() -> A>(repeater: F) -> RepeatWith<F> {
201191
202192/// An iterator that yields nothing.
203193///
204- /// This `struct` is created by the [`empty`] function. See its documentation for more.
205- ///
206- /// [`empty`]: fn.empty.html
194+ /// This `struct` is created by the [`empty()`] function. See its documentation for more.
207195#[ stable( feature = "iter_empty" , since = "1.2.0" ) ]
208196pub struct Empty < T > ( marker:: PhantomData < T > ) ;
209197
@@ -292,9 +280,7 @@ pub const fn empty<T>() -> Empty<T> {
292280
293281/// An iterator that yields an element exactly once.
294282///
295- /// This `struct` is created by the [`once`] function. See its documentation for more.
296- ///
297- /// [`once`]: fn.once.html
283+ /// This `struct` is created by the [`once()`] function. See its documentation for more.
298284#[ derive( Clone , Debug ) ]
299285#[ stable( feature = "iter_once" , since = "1.2.0" ) ]
300286pub struct Once < T > {
@@ -336,12 +322,12 @@ impl<T> FusedIterator for Once<T> {}
336322
337323/// Creates an iterator that yields an element exactly once.
338324///
339- /// This is commonly used to adapt a single value into a [`chain`] of other
325+ /// This is commonly used to adapt a single value into a [`chain() `] of other
340326/// kinds of iteration. Maybe you have an iterator that covers almost
341327/// everything, but you need an extra special case. Maybe you have a function
342328/// which works on iterators, but you only need to process one value.
343329///
344- /// [`chain`]: trait. Iterator.html#method. chain
330+ /// [`chain() `]: Iterator:: chain
345331///
346332/// # Examples
347333///
@@ -393,10 +379,8 @@ pub fn once<T>(value: T) -> Once<T> {
393379/// An iterator that yields a single element of type `A` by
394380/// applying the provided closure `F: FnOnce() -> A`.
395381///
396- /// This `struct` is created by the [`once_with`] function.
382+ /// This `struct` is created by the [`once_with() `] function.
397383/// See its documentation for more.
398- ///
399- /// [`once_with`]: fn.once_with.html
400384#[ derive( Clone , Debug ) ]
401385#[ stable( feature = "iter_once_with" , since = "1.43.0" ) ]
402386pub struct OnceWith < F > {
@@ -442,15 +426,14 @@ unsafe impl<A, F: FnOnce() -> A> TrustedLen for OnceWith<F> {}
442426/// Creates an iterator that lazily generates a value exactly once by invoking
443427/// the provided closure.
444428///
445- /// This is commonly used to adapt a single value generator into a [`chain`] of
429+ /// This is commonly used to adapt a single value generator into a [`chain() `] of
446430/// other kinds of iteration. Maybe you have an iterator that covers almost
447431/// everything, but you need an extra special case. Maybe you have a function
448432/// which works on iterators, but you only need to process one value.
449433///
450- /// Unlike [`once`], this function will lazily generate the value on request.
434+ /// Unlike [`once() `], this function will lazily generate the value on request.
451435///
452- /// [`once`]: fn.once.html
453- /// [`chain`]: trait.Iterator.html#method.chain
436+ /// [`chain()`]: Iterator::chain
454437///
455438/// # Examples
456439///
@@ -505,17 +488,16 @@ pub fn once_with<A, F: FnOnce() -> A>(gen: F) -> OnceWith<F> {
505488///
506489/// This allows creating a custom iterator with any behavior
507490/// without using the more verbose syntax of creating a dedicated type
508- /// and implementing the `Iterator` trait for it.
491+ /// and implementing the [ `Iterator`] trait for it.
509492///
510493/// Note that the `FromFn` iterator doesn’t make assumptions about the behavior of the closure,
511494/// and therefore conservatively does not implement [`FusedIterator`],
512- /// or override [`Iterator::size_hint`] from its default `(0, None)`.
513- ///
514- /// [`FusedIterator`]: trait.FusedIterator.html
515- /// [`Iterator::size_hint`]: trait.Iterator.html#method.size_hint
495+ /// or override [`Iterator::size_hint()`] from its default `(0, None)`.
516496///
517497/// The closure can use captures and its environment to track state across iterations. Depending on
518- /// how the iterator is used, this may require specifying the `move` keyword on the closure.
498+ /// how the iterator is used, this may require specifying the [`move`] keyword on the closure.
499+ ///
500+ /// [`move`]: ../../../std/keyword.move.html
519501///
520502/// # Examples
521503///
@@ -549,10 +531,8 @@ where
549531
550532/// An iterator where each iteration calls the provided closure `F: FnMut() -> Option<T>`.
551533///
552- /// This `struct` is created by the [`iter:: from_fn`] function.
534+ /// This `struct` is created by the [`from_fn() `] function.
553535/// See its documentation for more.
554- ///
555- /// [`iter::from_fn`]: fn.from_fn.html
556536#[ derive( Clone ) ]
557537#[ stable( feature = "iter_from_fn" , since = "1.34.0" ) ]
558538pub struct FromFn < F > ( F ) ;
@@ -601,10 +581,8 @@ where
601581
602582/// An new iterator where each successive item is computed based on the preceding one.
603583///
604- /// This `struct` is created by the [`successors`] function.
584+ /// This `struct` is created by the [`successors() `] function.
605585/// See its documentation for more.
606- ///
607- /// [`successors`]: fn.successors.html
608586#[ derive( Clone ) ]
609587#[ stable( feature = "iter_successors" , since = "1.34.0" ) ]
610588pub struct Successors < T , F > {
0 commit comments