I want to do
pub fn col_vec<T:Sized, const DIM0: usize>(mat: [T; DIM0]) -> [[T; 1]; DIM0] {
unsafe { std::mem::transmute(mat) }
}
which is obviously safe to do. Rust rejects it as
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> vf\src\shape_arr.rs:22:14
|
22 | unsafe { std::mem::transmute(mat) }
| ^^^^^^^^^^^^^^^^^^^
|
= note: source type: `[T; DIM0]` (this type does not have a fixed size)
= note: target type: `[[T; 1]; DIM0]` (this type does not have a fixed size)
Is there some way around this?