1pub trait Matrix22<T>
2where
3 Self: Sized,
4{
5 fn from_slice(slice: &[T; 4]) -> Self;
6 fn as_slice(&self) -> &[T; 4];
7 fn as_ptr(&self) -> *const T;
8}
9
10impl<T> Matrix22<T> for [T; 4]
11where
12 T: Copy,
13{
14 fn from_slice(slice: &[T; 4]) -> Self {
15 *slice
16 }
17
18 fn as_slice(&self) -> &[T; 4] {
19 self
20 }
21
22 fn as_ptr(&self) -> *const T {
23 self as *const T
24 }
25}
26
27pub trait Matrix33<T>
28where
29 Self: Sized,
30{
31 fn from_slice(slice: &[T; 9]) -> Self;
32 fn as_slice(&self) -> &[T; 9];
33 fn as_ptr(&self) -> *const T;
34}
35
36impl<T> Matrix33<T> for [T; 9]
37where
38 T: Copy,
39{
40 fn from_slice(slice: &[T; 9]) -> Self {
41 *slice
42 }
43
44 fn as_slice(&self) -> &[T; 9] {
45 self
46 }
47
48 fn as_ptr(&self) -> *const T {
49 self as *const T
50 }
51}
52
53pub trait Matrix44<T>
54where
55 Self: Sized,
56{
57 fn from_slice(slice: &[T; 16]) -> Self;
58 fn as_slice(&self) -> &[T; 16];
59 fn as_ptr(&self) -> *const T;
60}
61
62impl<T> Matrix44<T> for [T; 16]
63where
64 T: Copy,
65{
66 fn from_slice(slice: &[T; 16]) -> Self {
67 *slice
68 }
69
70 fn as_slice(&self) -> &[T; 16] {
71 self
72 }
73
74 fn as_ptr(&self) -> *const T {
75 self as *const T
76 }
77}