5 let _id: &Mat2<f64> = &Matrix::identity(1.0);
8 pub trait Index<Index,Result> { fn get(&self, _: Index) -> Result { panic!() } }
9 pub trait Dimensional<T>: Index<usize, T> { }
11 pub struct Mat2<T> { x: T }
12 pub struct Vec2<T> { x: T }
14 impl<T> Dimensional<Vec2<T>> for Mat2<T> { }
15 impl<T> Index<usize, Vec2<T>> for Mat2<T> { }
17 impl<T> Dimensional<T> for Vec2<T> { }
18 impl<T> Index<usize, T> for Vec2<T> { }
20 pub trait Matrix<T,V>: Dimensional<V> {
21 fn identity(t:T) -> Self;
24 impl<T> Matrix<T, Vec2<T>> for Mat2<T> {
25 fn identity(t:T) -> Mat2<T> { Mat2{ x: t } }