Skip to content

Commit dfacdda

Browse files
authored
Rollup merge of #69213 - LeSeulArtichaut:improve-doc-iter, r=steveklabnik
Improve documentation on iterators length Attempts to resolve #66491. @the8472 does this help? r? @steveklabnik
2 parents 9381e81 + 0c82a5c commit dfacdda

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/libcore/iter/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
//! are elements, and once they've all been exhausted, will return `None` to
4444
//! indicate that iteration is finished. Individual iterators may choose to
4545
//! resume iteration, and so calling [`next`] again may or may not eventually
46-
//! start returning `Some(Item)` again at some point.
46+
//! start returning `Some(Item)` again at some point (for example, see [`TryIter`]).
4747
//!
4848
//! [`Iterator`]'s full definition includes a number of other methods as well,
4949
//! but they are default methods, built on top of [`next`], and so you get
@@ -56,6 +56,7 @@
5656
//! [`Iterator`]: trait.Iterator.html
5757
//! [`next`]: trait.Iterator.html#tymethod.next
5858
//! [`Option`]: ../../std/option/enum.Option.html
59+
//! [`TryIter`]: ../../std/sync/mpsc/struct.TryIter.html
5960
//!
6061
//! # The three forms of iteration
6162
//!

src/libcore/iter/traits/exact_size.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@
6969
/// ```
7070
#[stable(feature = "rust1", since = "1.0.0")]
7171
pub trait ExactSizeIterator: Iterator {
72-
/// Returns the exact number of times the iterator will iterate.
72+
/// Returns the exact length of the iterator.
7373
///
74+
/// The implementation ensures that the iterator will return exactly `len()`
75+
/// more times a `Some(T)` value, before returning `None`.
7476
/// This method has a default implementation, so you usually should not
7577
/// implement it directly. However, if you can provide a more efficient
7678
/// implementation, you can do so. See the [trait-level] docs for an

0 commit comments

Comments
 (0)