update documentation

This commit is contained in:
The 8472 2023-03-13 20:16:43 +01:00
parent e29b27b4a4
commit 9cd9da2cd1
2 changed files with 10 additions and 8 deletions

View file

@ -101,10 +101,11 @@ pub trait DoubleEndedIterator: Iterator {
/// eagerly skip `n` elements starting from the back by calling [`next_back`] up
/// to `n` times until [`None`] is encountered.
///
/// `advance_back_by(n)` will return `0` if the iterator successfully advances by
/// `n` elements, or an usize `k` if [`None`] is encountered, where `k` is remaining number
/// of steps that could not be advanced because the iterator ran out.
/// Note that `k` is always less than `n`.
/// `advance_back_by(n)` will return `Ok(())` if the iterator successfully advances by
/// `n` elements, or a `Err(NonZeroUsize)` with value `k` if [`None`] is encountered, where `k`
/// is remaining number of steps that could not be advanced because the iterator ran out.
/// If `self` is empty and `n` is non-zero, then this returns `Err(n)`.
/// Otherwise, `k` is always less than `n`.
///
/// Calling `advance_back_by(0)` can do meaningful work, for example [`Flatten`] can advance its
/// outer iterator until it finds an inner iterator that is not empty, which then often

View file

@ -309,10 +309,11 @@ fn some<T>(_: Option<T>, x: T) -> Option<T> {
/// This method will eagerly skip `n` elements by calling [`next`] up to `n`
/// times until [`None`] is encountered.
///
/// `advance_by(n)` will return `0` if the iterator successfully advances by
/// `n` elements, or an usize `k` if [`None`] is encountered, where `k` is remaining number
/// of steps that could not be advanced because the iterator ran out.
/// Note that `k` is always less than `n`.
/// `advance_by(n)` will return `Ok(())` if the iterator successfully advances by
/// `n` elements, or a `Err(NonZeroUsize)` with value `k` if [`None`] is encountered,
/// where `k` is remaining number of steps that could not be advanced because the iterator ran out.
/// If `self` is empty and `n` is non-zero, then this returns `Err(n)`.
/// Otherwise, `k` is always less than `n`.
///
/// Calling `advance_by(0)` can do meaningful work, for example [`Flatten`]
/// can advance its outer iterator until it finds an inner iterator that is not empty, which