diff --git a/src/matrix.rs b/src/matrix.rs index caddf3d..6ee48b0 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -163,6 +163,11 @@ pub impl Mat2: Matrix, Vec2> { to_unsafe_ptr(&self)), 2) |slice| { slice[i] } } } + + #[inline(always)] + pure fn to_ptr() -> *T { + self[0].to_ptr() + } } pub impl Mat2: NumericMatrix, Vec2> { @@ -296,13 +301,6 @@ pub impl Mat2: FuzzyEq { } } -pub impl Mat2: ToPtr { - #[inline(always)] - pure fn to_ptr() -> *T { - self[0].to_ptr() - } -} - @@ -396,6 +394,11 @@ pub impl Mat3: Matrix, Vec3> { to_unsafe_ptr(&self)), 3) |slice| { slice[i] } } } + + #[inline(always)] + pure fn to_ptr() -> *T { + self[0].to_ptr() + } } pub impl Mat3: NumericMatrix, Vec3> { @@ -589,13 +592,6 @@ pub impl Mat3: FuzzyEq { } } -pub impl Mat3: ToPtr { - #[inline(always)] - pure fn to_ptr() -> *T { - self[0].to_ptr() - } -} - @@ -707,6 +703,11 @@ pub impl Mat4: Matrix, Vec4> { to_unsafe_ptr(&self)), 4) |slice| { slice[i] } } } + + #[inline(always)] + pure fn to_ptr() -> *T { + self[0].to_ptr() + } } pub impl Mat4: NumericMatrix, Vec4> { @@ -931,10 +932,3 @@ pub impl Mat4: FuzzyEq { self[3].fuzzy_eq(&other[3]) } } - -pub impl Mat4: ToPtr { - #[inline(always)] - pure fn to_ptr() -> *T { - self[0].to_ptr() - } -} diff --git a/src/quaternion.rs b/src/quaternion.rs index 14352ba..a159fc2 100644 --- a/src/quaternion.rs +++ b/src/quaternion.rs @@ -95,6 +95,11 @@ pub impl Quat: Quaternion #[inline(always)] pure fn dim() -> uint { 4 } + #[inline(always)] + pure fn to_ptr() -> *T { + addr_of(&self[0]) + } + #[inline(always)] pure fn neg() -> Quat { Quat::new(-self[0], -self[1], -self[2], -self[3]) @@ -299,11 +304,4 @@ pub impl Quat: FuzzyEq { self[2].fuzzy_eq(&other[2]) && self[3].fuzzy_eq(&other[3]) } -} - -pub impl Quat: ToPtr { - #[inline(always)] - pure fn to_ptr() -> *T { - addr_of(&self[0]) - } } \ No newline at end of file diff --git a/src/vector.rs b/src/vector.rs index f71cebf..85b4e31 100644 --- a/src/vector.rs +++ b/src/vector.rs @@ -130,6 +130,11 @@ pub impl Vec2: Vector { to_unsafe_ptr(&self)), 2) |slice| { slice[i] } } } + + #[inline(always)] + pure fn to_ptr() -> *T { + ptr::addr_of(&self[0]) + } } pub impl Vec2: NumericVector { @@ -235,13 +240,6 @@ pub impl Vec2: FuzzyEq { } } -pub impl Vec2: ToPtr { - #[inline(always)] - pure fn to_ptr() -> *T { - ptr::addr_of(&self[0]) - } -} - @@ -318,6 +316,11 @@ pub impl Vec3: Vector { to_unsafe_ptr(&self)), 3) |slice| { slice[i] } } } + + #[inline(always)] + pure fn to_ptr() -> *T { + addr_of(&self[0]) + } } pub impl Vec3: NumericVector { @@ -431,13 +434,6 @@ pub impl Vec3: FuzzyEq { } } -pub impl Vec3: ToPtr { - #[inline(always)] - pure fn to_ptr() -> *T { - addr_of(&self[0]) - } -} - @@ -512,6 +508,11 @@ pub impl Vec4: Vector { to_unsafe_ptr(&self)), 4) |slice| { slice[i] } } } + + #[inline(always)] + pure fn to_ptr() -> *T { + addr_of(&self[0]) + } } pub impl Vec4: NumericVector { @@ -631,11 +632,4 @@ pub impl Vec4: FuzzyEq { self[2].fuzzy_eq(&other[2]) && self[3].fuzzy_eq(&other[3]) } -} - -pub impl Vec4: ToPtr { - #[inline(always)] - pure fn to_ptr() -> *T { - addr_of(&self[0]) - } } \ No newline at end of file