Implement explicit self for DefaultEq trait

This commit is contained in:
Brendan Zabarauskas 2012-12-01 15:05:11 +10:00
parent 1d4825e005
commit 0adbbd478b
4 changed files with 22 additions and 22 deletions

View file

@ -355,7 +355,7 @@ pub impl<T:Copy FuzzyEq> Mat2<T>: FuzzyEq {
pub impl<T:Copy DefaultEq> Mat2<T>: DefaultEq {
#[inline(always)]
pure fn default_eq(other: &Mat2<T>) -> bool {
pure fn default_eq(&self, other: &Mat2<T>) -> bool {
self[0].default_eq(&other[0]) &&
self[1].default_eq(&other[1])
}
@ -660,7 +660,7 @@ pub impl<T:Copy FuzzyEq> Mat3<T>: FuzzyEq {
pub impl<T:Copy DefaultEq> Mat3<T>: DefaultEq {
#[inline(always)]
pure fn default_eq(other: &Mat3<T>) -> bool {
pure fn default_eq(&self, other: &Mat3<T>) -> bool {
self[0].default_eq(&other[0]) &&
self[1].default_eq(&other[1]) &&
self[2].default_eq(&other[2])
@ -1016,7 +1016,7 @@ pub impl<T:Copy FuzzyEq> Mat4<T>: FuzzyEq {
pub impl<T:Copy DefaultEq> Mat4<T>: DefaultEq {
#[inline(always)]
pure fn default_eq(other: &Mat4<T>) -> bool {
pure fn default_eq(&self, other: &Mat4<T>) -> bool {
self[0].default_eq(&other[0]) &&
self[1].default_eq(&other[1]) &&
self[2].default_eq(&other[2]) &&

View file

@ -2,23 +2,23 @@ use std::cmp::FuzzyEq;
pub trait DefaultEq {
pure fn default_eq(other: &self) -> bool;
pure fn default_eq(&self, other: &self) -> bool;
}
pub impl bool: DefaultEq { #[inline(always)] pure fn default_eq(other: &bool) -> bool { self == *other } }
pub impl bool: DefaultEq { #[inline(always)] pure fn default_eq(&self, other: &bool) -> bool { (*self) == (*other) } }
pub impl u8: DefaultEq { #[inline(always)] pure fn default_eq(other: &u8) -> bool { self == *other } }
pub impl u16: DefaultEq { #[inline(always)] pure fn default_eq(other: &u16) -> bool { self == *other } }
pub impl u32: DefaultEq { #[inline(always)] pure fn default_eq(other: &u32) -> bool { self == *other } }
pub impl u64: DefaultEq { #[inline(always)] pure fn default_eq(other: &u64) -> bool { self == *other } }
pub impl uint: DefaultEq { #[inline(always)] pure fn default_eq(other: &uint) -> bool { self == *other } }
pub impl u8: DefaultEq { #[inline(always)] pure fn default_eq(&self, other: &u8) -> bool { (*self) == (*other) } }
pub impl u16: DefaultEq { #[inline(always)] pure fn default_eq(&self, other: &u16) -> bool { (*self) == (*other) } }
pub impl u32: DefaultEq { #[inline(always)] pure fn default_eq(&self, other: &u32) -> bool { (*self) == (*other) } }
pub impl u64: DefaultEq { #[inline(always)] pure fn default_eq(&self, other: &u64) -> bool { (*self) == (*other) } }
pub impl uint: DefaultEq { #[inline(always)] pure fn default_eq(&self, other: &uint) -> bool { (*self) == (*other) } }
pub impl i8: DefaultEq { #[inline(always)] pure fn default_eq(other: &i8) -> bool { self == *other } }
pub impl i16: DefaultEq { #[inline(always)] pure fn default_eq(other: &i16) -> bool { self == *other } }
pub impl i32: DefaultEq { #[inline(always)] pure fn default_eq(other: &i32) -> bool { self == *other } }
pub impl i64: DefaultEq { #[inline(always)] pure fn default_eq(other: &i64) -> bool { self == *other } }
pub impl int: DefaultEq { #[inline(always)] pure fn default_eq(other: &int) -> bool { self == *other } }
pub impl i8: DefaultEq { #[inline(always)] pure fn default_eq(&self, other: &i8) -> bool { (*self) == (*other) } }
pub impl i16: DefaultEq { #[inline(always)] pure fn default_eq(&self, other: &i16) -> bool { (*self) == (*other) } }
pub impl i32: DefaultEq { #[inline(always)] pure fn default_eq(&self, other: &i32) -> bool { (*self) == (*other) } }
pub impl i64: DefaultEq { #[inline(always)] pure fn default_eq(&self, other: &i64) -> bool { (*self) == (*other) } }
pub impl int: DefaultEq { #[inline(always)] pure fn default_eq(&self, other: &int) -> bool { (*self) == (*other) } }
pub impl f32: DefaultEq { #[inline(always)] pure fn default_eq(other: &f32) -> bool { self.fuzzy_eq(other) } }
pub impl f64: DefaultEq { #[inline(always)] pure fn default_eq(other: &f64) -> bool { self.fuzzy_eq(other) } }
pub impl float: DefaultEq { #[inline(always)] pure fn default_eq(other: &float) -> bool { self.fuzzy_eq(other) } }
pub impl f32: DefaultEq { #[inline(always)] pure fn default_eq(&self, other: &f32) -> bool { self.fuzzy_eq(other) } }
pub impl f64: DefaultEq { #[inline(always)] pure fn default_eq(&self, other: &f64) -> bool { self.fuzzy_eq(other) } }
pub impl float: DefaultEq { #[inline(always)] pure fn default_eq(&self, other: &float) -> bool { self.fuzzy_eq(other) } }

View file

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

View file

@ -239,7 +239,7 @@ pub impl<T:Copy FuzzyEq> Vec2<T>: FuzzyEq {
pub impl<T:Copy DefaultEq> Vec2<T>: DefaultEq {
#[inline(always)]
pure fn default_eq(other: &Vec2<T>) -> bool {
pure fn default_eq(&self, other: &Vec2<T>) -> bool {
self[0].default_eq(&other[0]) &&
self[1].default_eq(&other[1])
}
@ -418,7 +418,7 @@ pub impl<T:Copy FuzzyEq> Vec3<T>: FuzzyEq {
pub impl<T:Copy DefaultEq> Vec3<T>: DefaultEq {
#[inline(always)]
pure fn default_eq(other: &Vec3<T>) -> bool {
pure fn default_eq(&self, other: &Vec3<T>) -> bool {
self[0].default_eq(&other[0]) &&
self[1].default_eq(&other[1]) &&
self[2].default_eq(&other[2])
@ -597,7 +597,7 @@ pub impl<T:Copy FuzzyEq> Vec4<T>: FuzzyEq {
pub impl<T:Copy DefaultEq> Vec4<T>: DefaultEq {
#[inline(always)]
pure fn default_eq(other: &Vec4<T>) -> bool {
pure fn default_eq(&self, other: &Vec4<T>) -> bool {
self[0].default_eq(&other[0]) &&
self[1].default_eq(&other[1]) &&
self[2].default_eq(&other[2]) &&