Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
723: `try_len` method r=phimuemue a=Easyoakland Add method to get the length of an iterator if the `size_hint` is consistent. Reasons why this would be useful: 1. It makes it more obvious when getting the length with `it.try_len().unwrap()` than with the match statement. 2. Iterator adapters that increase the length of iteration are not supposed to implement `ExactSizeIter` as indicated [here](https://doc.rust-lang.org/std/iter/trait.ExactSizeIterator.html#when-shouldnt-an-adapter-be-exactsizeiterator). This could be used in those cases. Co-authored-by: Easyoakland <[email protected]>
- Loading branch information