Skip to content

Commit

Permalink
Clarified the documentation on core::iter::from_fn and core::iter::su…
Browse files Browse the repository at this point in the history
…ccessors
  • Loading branch information
ranger-ross authored and gitbot committed Feb 20, 2025
1 parent 33dbeb0 commit 9450e58
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/src/iter/sources/from_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions core/src/iter/sources/successors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 item’s successor.
/// The iterator will yield the `T`s returned from the closure.
///
/// ```
/// use std::iter::successors;
Expand Down

0 comments on commit 9450e58

Please sign in to comment.