Lokathor/bytemuck

Boxed slice cast

mystise opened this issue · 1 comments

Is it possible to add casts for Box<[A]> -> Box<[B]> implemented the same way try_cast_vec and cast_vec are? Even better if it was implemented the same way try_cast_slice and cast_slice are, though I assume that may cause other issues since the vec casts have stricter requirements.

Currently it's possible to do this by bytemuck::cast_vec(boxed_slice.into_vec()).into_boxed_slice() or bytemuck::try_cast_vec(boxed_slice.into_vec()).map(|x| x.into_boxed_slice()) which isn't too long but a helper function would be nice.

I'd be happy to merge a PR for this one!