Improve documentation on iterators

This commit is contained in:
LeSeulArtichaut 2020-02-16 17:12:26 +01:00
parent 8040bc9836
commit 0891496898
2 changed files with 4 additions and 2 deletions

View File

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

View File

@ -69,7 +69,8 @@
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub trait ExactSizeIterator: Iterator {
/// Returns the exact number of times the iterator will iterate.
/// Returns the exact length of the iterator, which is the number of times
/// the iterator will return `Some(T)` before returning `None`.
///
/// This method has a default implementation, so you usually should not
/// implement it directly. However, if you can provide a more efficient