diff --git a/src/vector.rs b/src/vector.rs index 6a1d2d1..36f3e4b 100644 --- a/src/vector.rs +++ b/src/vector.rs @@ -203,10 +203,30 @@ macro_rules! vec( #[inline] fn mul(&self, v: &$Self) -> $Self { self.mul_v(v) } } + impl Div<$Self, $Self> for $Self { + #[inline] fn div(&self, v: &$Self) -> $Self { self.div_v(v) } + } + + impl Rem<$Self, $Self> for $Self { + #[inline] fn rem(&self, v: &$Self) -> $Self { self.rem_v(v) } + } + impl One for $Self { #[inline] fn one() -> $Self { $Self::from_value(one()) } } + impl Index for $Self { + #[inline] + fn index<'a>(&'a self, index: &uint) -> &'a S { + let slice: &[S, ..$n] = unsafe { mem::transmute(self) }; + &slice[*index] + } + } + + impl IndexMut for $Self { + #[inline] fn index_mut<'a>(&'a mut self, index: &uint) -> &'a mut S { self.mut_i(*index) } + } + impl ApproxEq for $Self { #[inline] fn approx_eq_eps(&self, other: &$Self, epsilon: &S) -> bool {