Use explicit self for fuzzy_eq

This commit is contained in:
Brendan Zabarauskas 2013-02-07 08:31:52 +11:00
parent c0fb48f861
commit 238e034e07
7 changed files with 20 additions and 8 deletions

View file

@ -394,7 +394,7 @@ pub impl<T:Copy Float> Mat2<T>: Neg<Mat2<T>> {
pub impl<T:Copy Float> Mat2<T>: FuzzyEq {
#[inline(always)]
pure fn fuzzy_eq(other: &Mat2<T>) -> bool {
pure fn fuzzy_eq(&self, other: &Mat2<T>) -> bool {
self[0].fuzzy_eq(&other[0]) &&
self[1].fuzzy_eq(&other[1])
}

View file

@ -570,7 +570,7 @@ pub impl<T:Copy Float> Mat3<T>: Neg<Mat3<T>> {
pub impl<T:Copy Float> Mat3<T>: FuzzyEq {
#[inline(always)]
pure fn fuzzy_eq(other: &Mat3<T>) -> bool {
pure fn fuzzy_eq(&self, other: &Mat3<T>) -> bool {
self[0].fuzzy_eq(&other[0]) &&
self[1].fuzzy_eq(&other[1]) &&
self[2].fuzzy_eq(&other[2])

View file

@ -507,7 +507,7 @@ pub impl<T:Copy> Mat4<T>: Index<uint, Vec4<T>> {
pub impl<T:Copy Float> Mat4<T>: FuzzyEq {
#[inline(always)]
pure fn fuzzy_eq(other: &Mat4<T>) -> bool {
pure fn fuzzy_eq(&self, other: &Mat4<T>) -> bool {
self[0].fuzzy_eq(&other[0]) &&
self[1].fuzzy_eq(&other[1]) &&
self[2].fuzzy_eq(&other[2]) &&

View file

@ -406,7 +406,7 @@ pub impl<T:Copy Float> Quat<T>: Neg<Quat<T>> {
pub impl<T:Copy FuzzyEq> Quat<T>: FuzzyEq {
#[inline(always)]
pure fn fuzzy_eq(other: &Quat<T>) -> bool {
pure fn fuzzy_eq(&self, other: &Quat<T>) -> bool {
self[0].fuzzy_eq(&other[0]) &&
self[1].fuzzy_eq(&other[1]) &&
self[2].fuzzy_eq(&other[2]) &&

View file

@ -286,7 +286,7 @@ pub impl<T:Copy Float> Vec2<T>: MutableEuclideanVector<&self/T> {
pub impl<T:Copy FuzzyEq Eq> Vec2<T>: FuzzyEq {
#[inline(always)]
pure fn fuzzy_eq(other: &Vec2<T>) -> bool {
pure fn fuzzy_eq(&self, other: &Vec2<T>) -> bool {
self[0].fuzzy_eq(&other[0]) &&
self[1].fuzzy_eq(&other[1])
}
@ -418,4 +418,16 @@ pub impl uvec2 {
#[inline(always)] static pure fn dim() -> uint { 2 }
#[inline(always)] static pure fn size_of() -> uint { size_of::<uvec2>() }
}
}
// Type aliases named in a more 'Rustic' style
pub type vec2i = Vec2<int>;
pub type vec2i8 = Vec2<i8>;
pub type vec2i16 = Vec2<i16>;
pub type vec2i32 = Vec2<i32>;
pub type vec2i64 = Vec2<i64>;
pub type vec2f = Vec2<float>;
pub type vec2f32 = Vec2<f32>;
pub type vec2f64 = Vec2<f64>;
pub type vec2b = Vec2<bool>;

View file

@ -318,7 +318,7 @@ pub impl<T:Copy Float> Vec3<T>: MutableEuclideanVector<&self/T> {
pub impl<T:Copy FuzzyEq Eq> Vec3<T>: FuzzyEq {
#[inline(always)]
pure fn fuzzy_eq(other: &Vec3<T>) -> bool {
pure fn fuzzy_eq(&self, other: &Vec3<T>) -> bool {
self[0].fuzzy_eq(&other[0]) &&
self[1].fuzzy_eq(&other[1]) &&
self[2].fuzzy_eq(&other[2])

View file

@ -316,7 +316,7 @@ pub impl<T:Copy Float> Vec4<T>: MutableEuclideanVector<&self/T> {
pub impl<T:Copy FuzzyEq Eq> Vec4<T>: FuzzyEq {
#[inline(always)]
pure fn fuzzy_eq(other: &Vec4<T>) -> bool {
pure fn fuzzy_eq(&self, other: &Vec4<T>) -> bool {
self[0].fuzzy_eq(&other[0]) &&
self[1].fuzzy_eq(&other[1]) &&
self[2].fuzzy_eq(&other[2]) &&