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

Add missing implementations of core iterator traits #734

Merged
merged 1 commit into from Dec 29, 2020
Merged

Add missing implementations of core iterator traits #734

merged 1 commit into from Dec 29, 2020

Conversation

lopopolo
Copy link
Contributor

  • Add missing implementations of FusedIterator.
  • Add missing implementations of ExactSizeIterator.
  • Add missing overrides of Iterator::count when wrapping a slice iterator.
  • Add missing overrides of Iterator::size_hint when size hint is known.

Context: I'm building an implementation of Ruby Regexp on top of the regex crate, and having guarantees around whether iterators are fused will allow me to implement these traits on my wrapping Iterators as well.

Copy link
Member

@BurntSushi BurntSushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I think there are a couple of impls we don't need though?

src/dfa.rs Outdated Show resolved Hide resolved
src/literal/imp.rs Outdated Show resolved Hide resolved
- Add missing implementations of FusedIterator.
- Add missing implementations of ExactSizeIterator.
- Add missing overrides of `Iterator::count` when wrapping a slice
  iterator.
- Add missing overrides of `Iterator::size_hint` when size hint is
  known.
@lopopolo
Copy link
Contributor Author

@BurntSushi I've removed the impls on internal types you flagged.

Copy link
Member

@BurntSushi BurntSushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@BurntSushi BurntSushi merged commit 8a81699 into rust-lang:master Dec 29, 2020
@lopopolo lopopolo deleted the missing-iterator-impls branch December 29, 2020 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants