Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements conversion from arrays to vec. The array does not have to be the same length as the capacity of the vec. Const generics are asserted at compile time. Unfortunately the method currently requires a copy of the source array.
Partially addresses requests in #341 and #344.
Also I'm not totally happy about the const assertions given #351. I've not added any tests in the
cfail
suite as I don't think we can practically check this withtrybuild
at the moment. There is a bit of a work-around you can do but it's not pretty.Questions
Would we prefer to just implement
From<[T; N]> for Vec<T, N>
? One of the issues with this impl is that users will need to be explicit about vec capacity. Because lengthsN
andM
can be different, you can't write:It needs to be:
Should
from_array
be internal, and the API exposed by the crate simply be theFrom
trait?