From 55d6247f52051e897938e8f65a34c3cc661f5e24 Mon Sep 17 00:00:00 2001 From: The8472 Date: Sat, 30 Jan 2021 18:07:48 +0100 Subject: [PATCH] Clarify that guarantees extend to other advancing iterator methods. --- library/core/src/iter/traits/marker.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/library/core/src/iter/traits/marker.rs b/library/core/src/iter/traits/marker.rs index ed8eea672f8..c4e21b84863 100644 --- a/library/core/src/iter/traits/marker.rs +++ b/library/core/src/iter/traits/marker.rs @@ -43,12 +43,14 @@ unsafe impl TrustedLen for &mut I {} /// An iterator that when yielding an item will have taken at least one element /// from its underlying [`SourceIter`]. /// -/// Calling [`next()`] guarantees that at least one value of the iterator's underlying source -/// has been moved out and the result of the iterator chain could be inserted in its place, -/// assuming structural constraints of the source allow such an insertion. +/// Calling any method that advances the iterator, e.g. [`next()`] or [`try_fold()`], +/// guarantees that for each step at least one value of the iterator's underlying source +/// has been moved out and the result of the iterator chain could be inserted +/// in its place, assuming structural constraints of the source allow such an insertion. /// In other words this trait indicates that an iterator pipeline can be collected in place. /// /// [`SourceIter`]: crate::iter::SourceIter /// [`next()`]: Iterator::next +/// [`try_fold()`]: Iterator::try_fold #[unstable(issue = "none", feature = "inplace_iteration")] pub unsafe trait InPlaceIterable: Iterator {}