Skip to content

ExactSizeIterator should not require DoubleEndedIterator; move rposition to extension trait #19395

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

Closed
DanielKeep opened this issue Nov 29, 2014 · 4 comments

Comments

@DanielKeep
Copy link
Contributor

I have an iterator extension which performs an incremental calculation, yielding partial results along the way (technically a specialisation of scan).

I can easily implement ExactSizeIterator::len, provided the underlying iterator also implements it, but I cannot implement DoubleEndedIterator because that would require computing and caching all intermediate results.

I'm really not sure why rposition is even part of ExactSizeIterator; surely it should be an extension trait that requires both? Currently, it's presence prohibits implementing the len method which is the only part of ExactSize that might reasonably be expected to be there.

@Gankra
Copy link
Contributor

Gankra commented Nov 29, 2014

I believe originally ExactSizeIterator was designed specifically to supplement DoubleEndedIterators. Somewhere along the way that stopped making complete sense.

@Gankra
Copy link
Contributor

Gankra commented Nov 29, 2014

CC @aturon

@bluss
Copy link
Member

bluss commented May 26, 2015

fixed

@alexcrichton
Copy link
Member

yay!

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

No branches or pull requests

5 participants