-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
709: fix: take_while_inclusive takes iterator by value r=phimuemue a=abhikjain360 this helps in case `TakeWhileInclusive` is returned from a function, as otherwise we would be returning a struct which takes a reference from a locally created iterator. example code which breaks, but shouldn't: ```rust use itertools::Itertools; struct Entry { constraint: bool, } struct List { entries: Vec<Entry>, } impl List { fn special(&self) -> impl Iterator<Item = &Entry> { self .entries .iter() .take_while_inclusive(|entry| entry.constraint) } } ``` Rust Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f602ba3c6e7c2ab2f5132a0b40b80ceb Co-authored-by: Abhik Jain <[email protected]>
- Loading branch information
Showing
2 changed files
with
16 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters