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

Conversation

@lopopolo
Copy link
Contributor

@lopopolo lopopolo commented Dec 29, 2020

  • 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

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 lopopolo force-pushed the lopopolo:missing-iterator-impls branch from 489ad04 to d8167d2 Dec 29, 2020
@lopopolo
Copy link
Contributor Author

@lopopolo lopopolo commented Dec 29, 2020

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

Copy link
Member

@BurntSushi BurntSushi left a comment

Thanks!

@BurntSushi BurntSushi merged commit 8a81699 into rust-lang:master Dec 29, 2020
10 checks passed
10 checks passed
test (pinned)
Details
test (stable)
Details
test (stable-32)
Details
test (stable-mips)
Details
test (beta)
Details
test (nightly)
Details
test (macos)
Details
test (win-msvc)
Details
test (win-gnu)
Details
rustfmt
Details
@lopopolo lopopolo deleted the lopopolo:missing-iterator-impls branch Dec 29, 2020
This was referenced Mar 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants