Skip to content
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] Create a try_filter_entry() #131

Open
zicklag opened this issue Nov 11, 2019 · 5 comments
Open

[feature] Create a try_filter_entry() #131

zicklag opened this issue Nov 11, 2019 · 5 comments

Comments

@zicklag
Copy link

zicklag commented Nov 11, 2019

I am using this library and have run into the need to capture a potential error inside of the filter_entry predicate. I asked in a forum topic about my problem and the response was that the best way to accomplish it would be with a try_filter_entry iterator so that I could return a result inside of the filter predicate.

I did a quick check of the source code to see how I might be able to implement that, but I was wondering if you might have any guidance on how you would want that implemented.

I haven't ever written an iterator before, but it looks like, if I wanted to create a FilterEntry iterator that it would be nearly identical to the existing TryFilterEntry iterator, but not quite the same.

Is there any way to share most of the implementation without duplicating code, or is it better just to create a copy of FilterEntry and the make the changes necessary.

@BurntSushi
Copy link
Owner

I think the ideal way to do this would be to create TryFilterEntry as a copy, and then re-implement FilterEntry in terms of TryFilterEntry if possible.

@zicklag
Copy link
Author

zicklag commented Jan 12, 2020

OK, that makes sense. I'll try to get a PR for that when I find the time. Could you assign this to me so I don't forget?

@BurntSushi
Copy link
Owner

Done! Thanks!

@ThinkChaos
Copy link

@zicklag are you working on this or can I take it?

I implemented a workaround in a personal project but would like to contribute back to this crate instead 😃

@zicklag
Copy link
Author

zicklag commented May 4, 2020

@ThinkChaos Go ahead and take it. 😃

I never got back to this, so it would be appreciated! 👍

ThinkChaos added a commit to ThinkChaos/walkdir that referenced this issue May 5, 2020
ThinkChaos added a commit to ThinkChaos/walkdir that referenced this issue May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants