Skip to content

Implement as_flattened{_mut}() for Array<Array<>> #86

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

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

jmwample
Copy link
Contributor

Implementation of as_flattened and as_flattened_mut for nested Array types to make it easier to operate on nested Arrays. Inspiration drawn from the as_flattened{_mut} implementations on [[T; N]] (i.e. for the slice primitive).

Note:

  • Array<[T; N], U> already implements these functions as it is transparent to &[[T; N]].
  • [Array<T, U>] does not implement these functions and we can't implement them this way without a new local trait. Doesn't really seem necessary though.

Verified

This commit was signed with the committer’s verified signature.
lucacome Luca Comellini
@tarcieri
Copy link
Member

NOTE: the SAFETY comments could probably include some more information regarding the Array type always being a newtype for a core array, similar to the existing SAFETY comments, but this is fine for now

@tarcieri tarcieri merged commit 4e4c10e into RustCrypto:master Sep 12, 2024
14 checks passed
@jmwample jmwample deleted the flatten branch September 12, 2024 17:52
@tarcieri tarcieri mentioned this pull request Oct 19, 2024
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

2 participants