whitequark / rust-xdg

A library that makes it easy to follow the X Desktop Group specifications
https://wiki.freedesktop.org/www/Specifications/
Apache License 2.0
154 stars 30 forks source link

Add methods to iterate over matching config/data files #20

Closed takluyver closed 6 years ago

takluyver commented 6 years ago

I suspect that I'm doing this in a clumsy way, so don't hesitate to point out if it can be made more elegant!

Closes gh-19

whitequark commented 6 years ago

Remember that snippet I gave you in #19? Note the return type of chain there and make FileFindIterator a newtype over it. Boom, done.

takluyver commented 6 years ago

Sorry, I'm not getting it. The return type is std::iter::Chain, I think? But that wants type parameters which I'm not sure about, and lifetime specifiers which I'm even less sure about.

takluyver commented 6 years ago

I've tried a few more things, but none of them compile. I think I don't understand how to properly work with abstract things like iterators in Rust - I can only make it work by converting everything to concrete, owned objects like Vec.

takluyver commented 6 years ago

If it's easier for you to do this yourself, feel free to do so, and I'll try to understand it by looking at your code.

whitequark commented 6 years ago

Just haven't had any time, sorry! It's sitting in my review queue. I'll take a look soon.

takluyver commented 6 years ago

Thanks, no rush :-)

whitequark commented 6 years ago

Thanks for the PR!

takluyver commented 6 years ago

Thanks :-). If you can see a smarter way to do it with iterators, I'm happy to learn.