diff --git a/src/mat2.rs b/src/mat2.rs index 764ffcb..178ed4d 100644 --- a/src/mat2.rs +++ b/src/mat2.rs @@ -24,6 +24,7 @@ use vec::Vec2; * * `y` - the second column vector of the matrix * * `z` - the third column vector of the matrix */ +#[deriving_eq] pub struct Mat2 { x: Vec2, y: Vec2 } pub impl Mat2 { @@ -380,19 +381,6 @@ pub impl Mat2: Neg> { } } -pub impl Mat2: Eq { - #[inline(always)] - pure fn eq(&self, other: &Mat2) -> bool { - self[0] == other[0] && - self[1] == other[1] - } - - #[inline(always)] - pure fn ne(&self, other: &Mat2) -> bool { - !(self == other) - } -} - pub impl Mat2: FuzzyEq { #[inline(always)] pure fn fuzzy_eq(other: &Mat2) -> bool { diff --git a/src/mat3.rs b/src/mat3.rs index 3a699d3..b5af2df 100644 --- a/src/mat3.rs +++ b/src/mat3.rs @@ -25,6 +25,7 @@ use vec::Vec3; * * `y` - the second column vector of the matrix * * `z` - the third column vector of the matrix */ +#[deriving_eq] pub struct Mat3 { x: Vec3, y: Vec3, z: Vec3 } pub impl Mat3 { @@ -575,20 +576,6 @@ pub impl Mat3: Neg> { } } -pub impl Mat3: Eq { - #[inline(always)] - pure fn eq(&self, other: &Mat3) -> bool { - self[0] == other[0] && - self[1] == other[1] && - self[2] == other[2] - } - - #[inline(always)] - pure fn ne(&self, other: &Mat3) -> bool { - !(self == other) - } -} - pub impl Mat3: FuzzyEq { #[inline(always)] pure fn fuzzy_eq(other: &Mat3) -> bool { diff --git a/src/mat4.rs b/src/mat4.rs index a9de91d..b23cb5a 100644 --- a/src/mat4.rs +++ b/src/mat4.rs @@ -25,6 +25,7 @@ use vec::Vec4; * * `z` - the third column vector of the matrix * * `w` - the fourth column vector of the matrix */ +#[deriving_eq] pub struct Mat4 { x: Vec4, y: Vec4, z: Vec4, w: Vec4 } pub impl Mat4 { @@ -520,21 +521,6 @@ pub impl Mat4: Index> { } } -pub impl Mat4: Eq { - #[inline(always)] - pure fn eq(&self, other: &Mat4) -> bool { - self[0] == other[0] && - self[1] == other[1] && - self[2] == other[2] && - self[3] == other[3] - } - - #[inline(always)] - pure fn ne(&self, other: &Mat4) -> bool { - !(self == other) - } -} - pub impl Mat4: FuzzyEq { #[inline(always)] pure fn fuzzy_eq(other: &Mat4) -> bool { diff --git a/src/quat.rs b/src/quat.rs index 1243bad..53f1ce5 100644 --- a/src/quat.rs +++ b/src/quat.rs @@ -198,6 +198,7 @@ pub trait Quaternion: Index Eq Neg { * * `s` - the scalar component * * `v` - a vector containing the three imaginary components */ +#[deriving_eq] pub struct Quat { s: T, v: Vec3 } pub impl Quat { @@ -460,21 +461,6 @@ pub impl Quat: Neg> { } } -pub impl Quat: Eq { - #[inline(always)] - pure fn eq(&self, other: &Quat) -> bool { - self[0] == other[0] && - self[1] == other[1] && - self[2] == other[2] && - self[3] == other[3] - } - - #[inline(always)] - pure fn ne(&self, other: &Quat) -> bool { - !(self == other) - } -} - pub impl Quat: FuzzyEq { #[inline(always)] pure fn fuzzy_eq(other: &Quat) -> bool { diff --git a/src/vec2.rs b/src/vec2.rs index c64436c..ff3e626 100644 --- a/src/vec2.rs +++ b/src/vec2.rs @@ -22,6 +22,7 @@ use numeric::types::number::Number; * * `x` - the first component of the vector * * `y` - the second component of the vector */ + #[deriving_eq] pub struct Vec2 { x: T, y: T } pub impl Vec2/*: Vector2*/ { @@ -225,19 +226,6 @@ pub impl Vec2: MutableEuclideanVector<&self/T> { } } -pub impl Vec2: Eq { - #[inline(always)] - pure fn eq(&self, other: &Vec2) -> bool { - self[0] == other[0] && - self[1] == other[1] - } - - #[inline(always)] - pure fn ne(&self, other: &Vec2) -> bool { - !(self == other) - } -} - pub impl Vec2: FuzzyEq { #[inline(always)] pure fn fuzzy_eq(other: &Vec2) -> bool { diff --git a/src/vec3.rs b/src/vec3.rs index e2eba87..c298e67 100644 --- a/src/vec3.rs +++ b/src/vec3.rs @@ -23,6 +23,7 @@ use numeric::types::number::Number; * * `y` - the second component of the vector * * `z` - the third component of the vector */ +#[deriving_eq] pub struct Vec3 { x: T, y: T, z: T } pub impl Vec3/*: Vector3*/ { @@ -248,20 +249,6 @@ pub impl Vec3: MutableEuclideanVector<&self/T> { } } -pub impl Vec3: Eq { - #[inline(always)] - pure fn eq(&self, other: &Vec3) -> bool { - self[0] == other[0] && - self[1] == other[1] && - self[2] == other[2] - } - - #[inline(always)] - pure fn ne(&self, other: &Vec3) -> bool { - !(self == other) - } -} - pub impl Vec3: FuzzyEq { #[inline(always)] pure fn fuzzy_eq(other: &Vec3) -> bool { diff --git a/src/vec4.rs b/src/vec4.rs index afafca0..b399586 100644 --- a/src/vec4.rs +++ b/src/vec4.rs @@ -24,6 +24,7 @@ use numeric::types::number::Number; * * `z` - the third component of the vector * * `w` - the fourth component of the vector */ +#[deriving_eq] pub struct Vec4 { x: T, y: T, z: T, w: T } pub impl Vec4/*: Vector4*/ { @@ -246,21 +247,6 @@ pub impl Vec4: MutableEuclideanVector<&self/T> { } } -pub impl Vec4: Eq { - #[inline(always)] - pure fn eq(&self, other: &Vec4) -> bool { - self[0] == other[0] && - self[1] == other[1] && - self[2] == other[2] && - self[3] == other[3] - } - - #[inline(always)] - pure fn ne(&self, other: &Vec4) -> bool { - !(self == other) - } -} - pub impl Vec4: FuzzyEq { #[inline(always)] pure fn fuzzy_eq(other: &Vec4) -> bool {