1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
pub trait Matrix33<T> where Self: Sized, { fn from_slice(slice: &[T; 9]) -> Self; fn as_slice(&self) -> &[T; 9]; fn as_ptr(&self) -> *const T; } impl<T> Matrix33<T> for [T; 9] where T: Copy, { fn from_slice(slice: &[T; 9]) -> Self { *slice } fn as_slice(&self) -> &[T; 9] { self } fn as_ptr(&self) -> *const T { self as *const T } } pub trait Matrix44<T> where Self: Sized, { fn from_slice(slice: &[T; 16]) -> Self; fn as_slice(&self) -> &[T; 16]; fn as_ptr(&self) -> *const T; } impl<T> Matrix44<T> for [T; 16] where T: Copy, { fn from_slice(slice: &[T; 16]) -> Self { *slice } fn as_slice(&self) -> &[T; 16] { self } fn as_ptr(&self) -> *const T { self as *const T } }