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

Clone for into-iterators #346

Open
clarfonthey opened this issue Sep 11, 2024 · 4 comments
Open

Clone for into-iterators #346

clarfonthey opened this issue Sep 11, 2024 · 4 comments

Comments

@clarfonthey
Copy link

The hashbrown into-iterators currently don't support Clone (see: rust-lang/hashbrown#545) but this shouldn't stop this crate from implementing it for its into-iterators, which ditch the hash table and just use vec::IntoIter internally.

@cuviper
Copy link
Member

cuviper commented Sep 12, 2024

Sure, we could do that!

@cuviper
Copy link
Member

cuviper commented Sep 13, 2024

One thing that's kind of weird is that IntoKeys will still need V: Clone, and IntoValues will need K: Clone, so we can have a complete clone of the underlying vec::IntoIter. We could possibly use Default for the wasted part instead, but that seems even weirder as a constraint. What do you think?

@clarfonthey
Copy link
Author

Hmm, that's actually an interesting point. It'd require unsafe code, but perhaps we could transmute to make the unused parts MaybeUninit, since we're just going to ignore their values anyway, and then set them to uninit?

@cuviper
Copy link
Member

cuviper commented Sep 16, 2024

#348 is adding the easy ones for IntoIter, but we can leave this open for IntoKeys and IntoValues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants