New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: zip_pad_with_default
#537
Comments
I don't think a new iterator adapter is the best choice here, since that's a relatively heavy and non-orthogonal addition. The item type for As a sketch,
Then (Dunno what the best name for the method would be. I'm inspired here by https://docs.rs/itertools/0.9.0/itertools/enum.MinMaxResult.html#method.into_option) |
That looks great to me! I've not contributed to an open source project before - at this point do I submit a pull request? |
I think you could give it a try. |
Please do! I'd be happy to merge this. |
@jswrenn Done! |
538: Added the `or_default` method to `EitherOrBoth` r=phimuemue a=abrassel This commit is motivated by the context explained in issue #537 Allows for doing things like padding out an iterator with a default value while the other one is consumed. Co-authored-by: Alex Brassel <awildbrasselsprouts@gmail.com>
…for context.
When trying to zip over two iterators of unequal lengths,
zip_longest
is very useful for the case in which one doesn't exist.When trying to do zip longest, but the underlying items implement
Default
, it could be useful to have a version ofzip_longest
that pads the shorter iterator withItem::default()
.The text was updated successfully, but these errors were encountered: