bytemuck icon indicating copy to clipboard operation
bytemuck copied to clipboard

convert 2d array to slice without trait bounds

Open Lokathor opened this issue 3 years ago • 2 comments

right now you can convert a &[[T; N]; M] into &[T] when T is Pod, but we should add a function for this even for any generic T.

array2_as_slice or something, I dunno

Lokathor avatar Sep 27 '22 19:09 Lokathor

  • If there's no bound on T at all it doesn't sound like a very good fit for the library. Shouldn't core be able to perform this natively?
  • Which semantics to choose for &[[(); 2]; usize::MAX] (a valid ZST) which would end up with length usize::MAX*2, which overflows.

197g avatar Jan 10 '23 21:01 197g

Shouldn't core be able to perform this natively?

core should be able to do everything in this entire crate natively, but here we are ;3

Lokathor avatar Nov 26 '23 19:11 Lokathor