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

Add Copy to ArrayVec enabled by a feature #192

Closed
wants to merge 3 commits into from
Closed

Add Copy to ArrayVec enabled by a feature #192

wants to merge 3 commits into from

Conversation

pYtoner
Copy link

@pYtoner pYtoner commented Jul 16, 2021

Completes #32.

Unfortunately, because trait bounds other than Sized are not allowed for const functions the new_const function is not available if the copy feature is enabled.

The whole idea behind the whole thing is that there is no way to construct an ArrayVec<T> that isn't T: Copy if the copy feature is enabled.

@bluss
Copy link
Owner

bluss commented Jul 17, 2021

Hi, this is a non-additive feature and the general guidelines for libraries are that features have to be additive, so this can not be included in this way, unfortunately. There should be a separate ArrayVecCopy type for this use case, and it should use the ArrayVecImpl trait (and flesh it out) to share as much code as possible.

@pYtoner pYtoner closed this Jul 17, 2021
@HughHoyland
Copy link

That's regrettable. I would totally expect a stack-allocateable ArrayVec to be Copy. That's the main use case of fixed-size stack-allocateable Vec for me.

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.

None yet

3 participants