1
Fork 0

Clarified the documentation on core::iter::from_fn and core::iter::successors

This commit is contained in:
ranger-ross 2025-01-05 17:30:32 +09:00
parent 8417f8311f
commit 6243c0f818
No known key found for this signature in database
GPG key ID: A7D198C212395322
2 changed files with 3 additions and 0 deletions

View file

@ -3,6 +3,8 @@ use crate::fmt;
/// Creates a new iterator where each iteration calls the provided closure
/// `F: FnMut() -> Option<T>`.
///
/// The iterator will yield the `T`s returned from the closure.
///
/// This allows creating a custom iterator with any behavior
/// without using the more verbose syntax of creating a dedicated type
/// and implementing the [`Iterator`] trait for it.

View file

@ -5,6 +5,7 @@ use crate::iter::FusedIterator;
///
/// The iterator starts with the given first item (if any)
/// and calls the given `FnMut(&T) -> Option<T>` closure to compute each items successor.
/// The iterator will yield the `T`s returned from the closure.
///
/// ```
/// use std::iter::successors;