danielhenrymantilla / rust-uninit

Read trait fixed to soundly work with uninitalized memory
MIT License
25 stars 2 forks source link

Add conversions for `[MaybeUninit<T>; N]` to/from `MaybeUninit<[T; N]>` #23

Closed kupiakos closed 10 months ago

kupiakos commented 10 months ago

Upstream nightly calls the MaybeUninit<[T; N]> -> [MaybeUninit<T>; N] operation transpose which could describe either direction.

This likely calls for another extension trait: MaybeUninitArrayExt?

kupiakos commented 10 months ago

Naming this trait MaybeUninitTranspose, with the below safe transformations:

Self Self::Transposed
[MaybeUninit<T>; N] MaybeUninit<[T; N]>
MaybeUninit<[T; N]> [MaybeUninit<T>; N]
&'a [MaybeUninit<T>; N] &'a MaybeUninit<[T; N]>
&'a MaybeUninit<[T; N]> &'a [MaybeUninit<T>; N]
&'a mut [MaybeUninit<T>; N] &'a mut MaybeUninit<[T; N]>
&'a mut MaybeUninit<[T; N]> &'a mut [MaybeUninit<T>; N]

There doesn't seem to be a great analogy for Out: there's no obvious transposition of Out<[T; N]>.