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 From<&[T;N]> and From<&mut [T; N]> impls for &[mut] GenericArray #104

Merged
merged 2 commits into from
Jun 25, 2020

Conversation

Robbepop
Copy link
Contributor

Adds the following impls to GenericArray:

  • impl From<&'a [T; N]> for &'a GenericArray<T, N>
  • impl From<&'a mut [T; N]> for &'a mut GenericArray<T, N>

So far users had to convert their &'a [mut] [T; N] array references into slices to perform the conversion into the GenericArray reference. This also resulted into an additional unnecessary assertion since the length are known anyways.

This PR adds the missing From implementations to drop the unnecessary assertion in those cases and to allow direct conversions between array references and generic array references.

@Robbepop
Copy link
Contributor Author

Sorry for the bump but it would be really nice to have these implementations available for some neat optimizations.

@novacrazy novacrazy mentioned this pull request Jun 15, 2020
@novacrazy novacrazy merged commit 8c5c0bf into fizyk20:master Jun 25, 2020
@novacrazy
Copy link
Collaborator

This made it into 0.14.3, by the way.

@Robbepop
Copy link
Contributor Author

This made it into 0.14.3, by the way.

Thanks for the notification!

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.

2 participants