Skip to content

Add missing implementations of core iterator traits#734

Merged
BurntSushi merged 1 commit intorust-lang:masterfrom
lopopolo:missing-iterator-impls
Dec 29, 2020
Merged

Add missing implementations of core iterator traits#734
BurntSushi merged 1 commit intorust-lang:masterfrom
lopopolo:missing-iterator-impls

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?

- 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.

2 participants