Skip to content

Feature request: Conversion from &[[T; N]] to &[GenericArray<T, N>] (and &mut) #145

Closed
@jrose-signal

Description

@jrose-signal

APIs like the cipher crate's BlockEncrypt::encrypt_blocks take a slice of GenericArrays. However, if you're starting with a flat &[u8], it's unergonomic to get to the required type. The unstable slice::as_chunks gives you &[[u8; N]], but going from that to &[GenericArray<u8, _>] seems impossible without a pointer cast or transmute. However, that pointer cast or transmute is valid because GenericArray is repr(transparent), and it would be nice™ if the generic-array crate provided that operation as a safe wrapper.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions