@@ -5,9 +5,7 @@ use super::{FusedIterator, TrustedLen};
5
5
6
6
/// An iterator that repeats an element endlessly.
7
7
///
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.
11
9
#[ derive( Clone , Debug ) ]
12
10
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
13
11
pub struct Repeat < A > {
@@ -47,15 +45,11 @@ unsafe impl<A: Clone> TrustedLen for Repeat<A> {}
47
45
/// The `repeat()` function repeats a single value over and over again.
48
46
///
49
47
/// 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.
53
49
///
54
50
/// If the element type of the iterator you need does not implement `Clone`,
55
51
/// 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.
59
53
///
60
54
/// # Examples
61
55
///
@@ -77,7 +71,7 @@ unsafe impl<A: Clone> TrustedLen for Repeat<A> {}
77
71
/// assert_eq!(Some(4), fours.next());
78
72
/// ```
79
73
///
80
- /// Going finite with [`take`]:
74
+ /// Going finite with [`Iterator:: take() `]:
81
75
///
82
76
/// ```
83
77
/// use std::iter;
@@ -102,10 +96,8 @@ pub fn repeat<T: Clone>(elt: T) -> Repeat<T> {
102
96
/// An iterator that repeats elements of type `A` endlessly by
103
97
/// applying the provided closure `F: FnMut() -> A`.
104
98
///
105
- /// This `struct` is created by the [`repeat_with`] function.
99
+ /// This `struct` is created by the [`repeat_with() `] function.
106
100
/// See its documentation for more.
107
- ///
108
- /// [`repeat_with`]: fn.repeat_with.html
109
101
#[ derive( Copy , Clone , Debug ) ]
110
102
#[ stable( feature = "iterator_repeat_with" , since = "1.28.0" ) ]
111
103
pub struct RepeatWith < F > {
@@ -139,20 +131,18 @@ unsafe impl<A, F: FnMut() -> A> TrustedLen for RepeatWith<F> {}
139
131
/// The `repeat_with()` function calls the repeater over and over again.
140
132
///
141
133
/// Infinite iterators like `repeat_with()` are often used with adapters like
142
- /// [`take`], in order to make them finite.
143
- ///
144
- /// [`take`]: trait.Iterator.html#method.take
134
+ /// [`Iterator::take()`], in order to make them finite.
145
135
///
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
147
137
/// 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.
151
139
///
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`] ,
154
142
/// please open a GitHub issue explaining your use case.
155
143
///
144
+ /// [`DoubleEndedIterator`]: crate::iter::DoubleEndedIterator
145
+ ///
156
146
/// # Examples
157
147
///
158
148
/// Basic usage:
@@ -201,9 +191,7 @@ pub fn repeat_with<A, F: FnMut() -> A>(repeater: F) -> RepeatWith<F> {
201
191
202
192
/// An iterator that yields nothing.
203
193
///
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.
207
195
#[ stable( feature = "iter_empty" , since = "1.2.0" ) ]
208
196
pub struct Empty < T > ( marker:: PhantomData < T > ) ;
209
197
@@ -292,9 +280,7 @@ pub const fn empty<T>() -> Empty<T> {
292
280
293
281
/// An iterator that yields an element exactly once.
294
282
///
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.
298
284
#[ derive( Clone , Debug ) ]
299
285
#[ stable( feature = "iter_once" , since = "1.2.0" ) ]
300
286
pub struct Once < T > {
@@ -336,12 +322,12 @@ impl<T> FusedIterator for Once<T> {}
336
322
337
323
/// Creates an iterator that yields an element exactly once.
338
324
///
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
340
326
/// kinds of iteration. Maybe you have an iterator that covers almost
341
327
/// everything, but you need an extra special case. Maybe you have a function
342
328
/// which works on iterators, but you only need to process one value.
343
329
///
344
- /// [`chain`]: trait. Iterator.html#method. chain
330
+ /// [`chain() `]: Iterator:: chain
345
331
///
346
332
/// # Examples
347
333
///
@@ -393,10 +379,8 @@ pub fn once<T>(value: T) -> Once<T> {
393
379
/// An iterator that yields a single element of type `A` by
394
380
/// applying the provided closure `F: FnOnce() -> A`.
395
381
///
396
- /// This `struct` is created by the [`once_with`] function.
382
+ /// This `struct` is created by the [`once_with() `] function.
397
383
/// See its documentation for more.
398
- ///
399
- /// [`once_with`]: fn.once_with.html
400
384
#[ derive( Clone , Debug ) ]
401
385
#[ stable( feature = "iter_once_with" , since = "1.43.0" ) ]
402
386
pub struct OnceWith < F > {
@@ -442,15 +426,14 @@ unsafe impl<A, F: FnOnce() -> A> TrustedLen for OnceWith<F> {}
442
426
/// Creates an iterator that lazily generates a value exactly once by invoking
443
427
/// the provided closure.
444
428
///
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
446
430
/// other kinds of iteration. Maybe you have an iterator that covers almost
447
431
/// everything, but you need an extra special case. Maybe you have a function
448
432
/// which works on iterators, but you only need to process one value.
449
433
///
450
- /// Unlike [`once`], this function will lazily generate the value on request.
434
+ /// Unlike [`once() `], this function will lazily generate the value on request.
451
435
///
452
- /// [`once`]: fn.once.html
453
- /// [`chain`]: trait.Iterator.html#method.chain
436
+ /// [`chain()`]: Iterator::chain
454
437
///
455
438
/// # Examples
456
439
///
@@ -505,17 +488,16 @@ pub fn once_with<A, F: FnOnce() -> A>(gen: F) -> OnceWith<F> {
505
488
///
506
489
/// This allows creating a custom iterator with any behavior
507
490
/// 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.
509
492
///
510
493
/// Note that the `FromFn` iterator doesn’t make assumptions about the behavior of the closure,
511
494
/// 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)`.
516
496
///
517
497
/// 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
519
501
///
520
502
/// # Examples
521
503
///
@@ -549,10 +531,10 @@ where
549
531
550
532
/// An iterator where each iteration calls the provided closure `F: FnMut() -> Option<T>`.
551
533
///
552
- /// This `struct` is created by the [`iter::from_fn`] function.
534
+ /// This `struct` is created by the [`iter::from_fn() `] function.
553
535
/// See its documentation for more.
554
536
///
555
- /// [`iter::from_fn`]: fn. from_fn.html
537
+ /// [`iter::from_fn() `]: from_fn
556
538
#[ derive( Clone ) ]
557
539
#[ stable( feature = "iter_from_fn" , since = "1.34.0" ) ]
558
540
pub struct FromFn < F > ( F ) ;
@@ -601,10 +583,10 @@ where
601
583
602
584
/// An new iterator where each successive item is computed based on the preceding one.
603
585
///
604
- /// This `struct` is created by the [`successors`] function.
586
+ /// This `struct` is created by the [`iter:: successors() `] function.
605
587
/// See its documentation for more.
606
588
///
607
- /// [`successors`]: fn. successors.html
589
+ /// [`iter:: successors() `]: successors
608
590
#[ derive( Clone ) ]
609
591
#[ stable( feature = "iter_successors" , since = "1.34.0" ) ]
610
592
pub struct Successors < T , F > {
0 commit comments