docs: note that find(f) is equivalent to filter(f).next() in the iterator docs.

This commit is contained in:
Matthias Krüger
2020-02-27 00:35:04 +01:00
parent a8437cf213
commit 31b9764a14
+4
View File
@@ -719,6 +719,8 @@ fn call<T>(mut f: impl FnMut(T)) -> impl FnMut((), T) {
/// ```
///
/// of these layers.
///
/// Note that `iter.filter(f).next()` is equivalent to `iter.find(f)`.
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
fn filter<P>(self, predicate: P) -> Filter<Self, P>
@@ -2152,6 +2154,8 @@ fn check<T>(mut f: impl FnMut(T) -> bool) -> impl FnMut((), T) -> LoopState<(),
/// // we can still use `iter`, as there are more elements.
/// assert_eq!(iter.next(), Some(&3));
/// ```
///
/// Note that `iter.find(f)` is equivalent to `iter.filter(f).next()`.
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>