rust-itertools / itertools

Extra iterator adaptors, iterator methods, free functions, and macros.
https://docs.rs/itertools/
Apache License 2.0
2.72k stars 309 forks source link

Write `CONTRIBUTING.md` #756

Closed jswrenn closed 8 months ago

jswrenn commented 1 year ago

Itertools needs a CONTRIBUTING.md. Key highlights should include:

A complete guide should also address:

(Anything else?)

Happy to provide mentorship on this.

Philippe-Cholet commented 1 year ago

I recently contributed about each of those points (except DoubleEndedIterator) and there are key points I would have liked to know early on so I think I can help here. I'm starting a draft: https://github.com/Philippe-Cholet/itertools/compare/master...contributing Mentorship welcomed.

EDIT: Markdown rendered here. I try to be as complete and precise but brief as possible.

Philippe-Cholet commented 1 year ago

tests/specializations.rs definitely seems promising (I really like the Unspecialized struct) but all apply some "closure" only on a fresh iterator and not on an iterator that has yielded elements. A buggy iterator could behave differently if those were applied later on. I've experimented quite a bit (and eventually ditched macros, for sanity) to check size_hint/count/last/nth/fold/collect (as most of our specialized methods are those) at every step of iteration (at the start and after every next). And it works fine but is slower as you might expect, so I added the possibility to limit this to a few steps. Usage (example) would remain nice but my implementation is definitely way more verbose (working branch: https://github.com/rust-itertools/itertools/compare/master...Philippe-Cholet:itertools:test-specializations).

jswrenn commented 1 year ago

Can you file a draft PR for CONTRIBUTING.md?

I'm very interested in seeing our specialization tests improved further!