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

Feature Request: ArrayVec that is Copy #32

Open
mitchmindtree opened this issue Mar 2, 2016 · 13 comments · May be fixed by #261
Open

Feature Request: ArrayVec that is Copy #32

mitchmindtree opened this issue Mar 2, 2016 · 13 comments · May be fixed by #261

Comments

@mitchmindtree
Copy link

I'm considering using an ArrayVec<[_; 9]> as a small stack to keep track of pressed buttons on a mouse in conrod, however I noticed that it does not impl Copy. Seeing as it has a fixed-size, shouldn't deriving Copy be ok? Or is there some other boundary stopping this?

@bluss
Copy link
Owner

bluss commented Mar 2, 2016

It's a relevant question. ArrayVec implements Drop, which precludes Copy.

I have considered making a Copy-only ArrayVec, but most of the hard things this library does are for the non-Copy part to be correct. The Copy case is simple, so a regular array is often enough.

@WiSaGaN
Copy link

WiSaGaN commented Apr 22, 2016

Would you accept a CopyArrayVec pull-request?

@bluss
Copy link
Owner

bluss commented Apr 23, 2016

I'm not sure, it requires duplicating the whole thing. As said above, the most interesting things ArrayVec does is handle the non-Copy case correctly.

I guess this is not what you want, but maybe specialization (unstable feature) can be used to make ArrayVec Copy exactly when its elements are Copy.

@bluss
Copy link
Owner

bluss commented Apr 23, 2016

a PoC of copy-specialization works. This is the ideal approach since it transparently removes the overhead of non-copy arrayvecs (overwrite in drop etc). The use of unstable features is rather non-ideal though.

@mitchmindtree
Copy link
Author

This issue isn't very high priority for me, I'm happy waiting until specialization stabilises if that suits you best 👍

@bluss
Copy link
Owner

bluss commented Apr 25, 2016

We don't even know if specialization will allow this, but we'll see.

@bluss
Copy link
Owner

bluss commented Apr 25, 2016

It sounds like this is no longer just a question but a feature request?

@bluss bluss changed the title Why does ArrayVec not derive Copy? Feature Request: ArrayVec that is Copy Apr 25, 2016
tbu- added a commit to tbu-/arrayvec that referenced this issue Apr 26, 2016
tbu- added a commit to tbu-/arrayvec that referenced this issue Apr 26, 2016
tbu- added a commit to tbu-/arrayvec that referenced this issue Sep 21, 2016
@tbu-
Copy link
Collaborator

tbu- commented Mar 18, 2017

I'm not sure that this needs a breaking change.

@bluss
Copy link
Owner

bluss commented Mar 18, 2017

arrayvec as a crate needs it. It's part of clearing the air before adding new features, if you will.

@bluss
Copy link
Owner

bluss commented Mar 18, 2017

Where the most significant breaking change is the change of minimum Rust version

@c410-f3r
Copy link
Contributor

What is the status of this feature?

@smessmer
Copy link

Is this maybe easier to do now with the new array based implementation in 0.7?

@pwnorbitals
Copy link

I’d be interested in this feature, is #193 on the right way to be merged ? thanks :)

@pYtoner pYtoner linked a pull request Feb 9, 2024 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.

7 participants