-
Notifications
You must be signed in to change notification settings - Fork 667
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
Dir: Implement IntoIterator
for Dir
#1333
Conversation
I don't understand the motivation for this PR. Can you please show an example? What does this enable that couldn't as easily be done with the existing API? |
Here's where I use it: https://github.com/wmanley/ostree-oxide/blob/d3f38da61deb614be67d3705519df0235e4d2e84/ostree-repo/src/lib.rs#L253-L281 This allows me to return an |
Would it be possible to add a usage example? |
Done, it's a little contrived, but illustrative. |
@asomers Ping: Are there any other changes you'd like to make this suitable to go in? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good. It just needs three small things:
- CHANGELOG entry (may require a rebase to avoid conflicts)
- Squash
- Doc comment for
OwningIter
. It can simply say "The return type of [Dir::into_iter
]".
This is useful to allow returning an iterator based on a directory iterator without needing a self-referential struct.
Thanks for the review. I've done these three things. CI on "OSX x86_64" failed with:
but I can't imagine that the failure was caused by this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OSX failure looks like perhaps GCE yanked the VM out from under us. That happens sometimes.
bors r+
My [patch to nix](nix-rust/nix#1333) was merged and now it's upstream. This was causing builds to fail because I deleted the repo from `wmanley/nix` after merging.
This is useful to allow returning an iterator based on a directory iterator
without needing a self-referential struct.