You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It'd be nice to have a version of all_equal that returns the value in the iterator where all the items in the iterator compare equal to that value. Proposed implementation:
/// Return the first item in the iterator if it compares equal to all the other
/// items in the iterator. Return `None` if the iterator is empty, or if it
/// contains any items that do not equal the first item.
fn all_equal_value(mut self) -> Option<Self::Item> {
let first = self.next()?;
if self.all(|item| first == item) {
Some(first)
} else {
None
}
}
The text was updated successfully, but these errors were encountered:
It'd be nice to have a version of
all_equal
that returns the value in the iterator where all the items in the iterator compare equal to that value. Proposed implementation:The text was updated successfully, but these errors were encountered: