Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
535: Add `find_or_last` method to `Itertools` trait r=jswrenn a=mankinskin [Playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=6abc43c9037445f88fb0a86991da01f2) ```rust fn find_or_last(mut self, predicate: impl FnMut(&Self::Item) -> bool) -> Option<Self::Item> ``` - returns `None` if iterator is empty - returns `Some(element)` when element matches the predicate - returns `Some(last_element)` when no element matches the predicate [Related discussion on the rust user forum](https://users.rust-lang.org/t/find-or-return-last-element-of-iterator/58171) Co-authored-by: Linus Behrbohm <linusbehrbohm@web.de>
- Loading branch information