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

implement Clone for iterator types #134

Open
mikeyhew opened this issue May 28, 2020 · 3 comments · May be fixed by #155
Open

implement Clone for iterator types #134

mikeyhew opened this issue May 28, 2020 · 3 comments · May be fixed by #155

Comments

@mikeyhew
Copy link

std::vec::Iter<'a, T> implements Clone, but it seems that im::vector::Iter<'a, T> does not. Would it be possible to to implement Clone for all of the by-reference Iter types in im, and would you accept a PR adding the impls?

@bodil
Copy link
Owner

bodil commented May 30, 2020

Absolutely. There's no good reason why they shouldn't implement Clone.

@vorner
Copy link

vorner commented Nov 3, 2020

I've hit the need of them just today. @mikeyhew are you working on the PR, or should I try to find a bit of time to give them a try?

@mikeyhew
Copy link
Author

mikeyhew commented Nov 3, 2020

@vorner I'm not working on a PR for this, all yours!

vorner added a commit to vorner/bitmaps that referenced this issue Nov 4, 2020
Most importantly, Clone, which is generally useful (to pass it to
somewhere and iterate over it multiple times, but also for reverse
dependencies, see bodil/im-rs#134).

Piggy-backing Debug when at it, because, why not.

*Not* implementing Copy, as that could lead to footguns (iterators
forking by accident would do confusing things).
vorner added a commit to vorner/sized-chunks that referenced this issue Nov 4, 2020
Most importantly, Clone. See bodil/im-rs#134.

Piggy-backing Debug when at it, because, why not.

Not implementing Copy even where it would be possible, as that could
turn into footgun (iterators "forking").

Not implementing Clone on consuming iterators, as that also clones the
elements and that's probably not intended.
vorner added a commit to vorner/sized-chunks that referenced this issue Nov 4, 2020
Most importantly, Clone. See bodil/im-rs#134.

Piggy-backing Debug when possible, because, why not.

Not implementing Copy even where it would be possible, as that could
turn into footgun (iterators "forking").

Not implementing Clone on consuming iterators, as that also clones the
elements and that's probably not intended.
vorner added a commit to vorner/im-rs that referenced this issue Nov 5, 2020
@vorner vorner linked a pull request Nov 5, 2020 that will close this issue
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 a pull request may close this issue.

3 participants