From a850e374245c13fe6758fdae7f124eaa8d1b2a89 Mon Sep 17 00:00:00 2001 From: ozkriff Date: Mon, 2 Jun 2014 12:18:05 +0400 Subject: [PATCH] Updated to latest Rust: PartialEq, PartialOrd --- src/cgmath/aabb.rs | 4 ++-- src/cgmath/angle.rs | 6 +++--- src/cgmath/cylinder.rs | 2 +- src/cgmath/frustum.rs | 4 ++-- src/cgmath/line.rs | 2 +- src/cgmath/matrix.rs | 6 +++--- src/cgmath/obb.rs | 4 ++-- src/cgmath/plane.rs | 2 +- src/cgmath/point.rs | 4 ++-- src/cgmath/projection.rs | 6 +++--- src/cgmath/quaternion.rs | 2 +- src/cgmath/ray.rs | 2 +- src/cgmath/rotation.rs | 6 +++--- src/cgmath/sphere.rs | 2 +- src/cgmath/vector.rs | 2 +- 15 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/cgmath/aabb.rs b/src/cgmath/aabb.rs index 60a555c..c4a89e7 100644 --- a/src/cgmath/aabb.rs +++ b/src/cgmath/aabb.rs @@ -82,7 +82,7 @@ pub trait Aabb, P: Point> { } /// A two-dimensional AABB, aka a rectangle. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Aabb2 { pub min: Point2, pub max: Point2, @@ -127,7 +127,7 @@ impl fmt::Show for Aabb2 { } /// A three-dimensional AABB, aka a rectangular prism. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Aabb3 { pub min: Point3, pub max: Point3, diff --git a/src/cgmath/angle.rs b/src/cgmath/angle.rs index 8f535ac..a7a1356 100644 --- a/src/cgmath/angle.rs +++ b/src/cgmath/angle.rs @@ -22,9 +22,9 @@ use approx::ApproxEq; use num::BaseFloat; /// An angle, in radians -#[deriving(Clone, Eq, Ord, Hash)] pub struct Rad { pub s: S } +#[deriving(Clone, PartialEq, PartialOrd, Hash)] pub struct Rad { pub s: S } /// An angle, in degrees -#[deriving(Clone, Eq, Ord, Hash)] pub struct Deg { pub s: S } +#[deriving(Clone, PartialEq, PartialOrd, Hash)] pub struct Deg { pub s: S } /// Create a new angle, in radians #[inline] pub fn rad(s: S) -> Rad { Rad { s: s } } @@ -74,7 +74,7 @@ pub trait Angle S: BaseFloat > : Clone + Zero -+ Eq + Equiv + Ord ++ PartialEq + Equiv + PartialOrd + ApproxEq + Neg + ToRad diff --git a/src/cgmath/cylinder.rs b/src/cgmath/cylinder.rs index d1a1089..a22f218 100644 --- a/src/cgmath/cylinder.rs +++ b/src/cgmath/cylinder.rs @@ -18,7 +18,7 @@ use point::Point3; use vector::Vector3; -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Cylinder { pub center: Point3, pub axis: Vector3, diff --git a/src/cgmath/frustum.rs b/src/cgmath/frustum.rs index 2456c0c..707989e 100644 --- a/src/cgmath/frustum.rs +++ b/src/cgmath/frustum.rs @@ -22,7 +22,7 @@ use plane::Plane; use point::Point3; use vector::{Vector, EuclideanVector}; -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Frustum { pub left: Plane, pub right: Plane, @@ -59,7 +59,7 @@ Frustum { } } -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct FrustumPoints { pub near_top_left: Point3, pub near_top_right: Point3, diff --git a/src/cgmath/line.rs b/src/cgmath/line.rs index de4a365..ee40211 100644 --- a/src/cgmath/line.rs +++ b/src/cgmath/line.rs @@ -23,7 +23,7 @@ use vector::{Vector, Vector2}; use intersect::Intersect; /// A generic directed line segment from `origin` to `dest`. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Line

{ pub origin: P, pub dest: P, diff --git a/src/cgmath/matrix.rs b/src/cgmath/matrix.rs index 7fa08e3..0b0a1ea 100644 --- a/src/cgmath/matrix.rs +++ b/src/cgmath/matrix.rs @@ -29,15 +29,15 @@ use vector::{Vector, EuclideanVector}; use vector::{Vector2, Vector3, Vector4}; /// A 2 x 2, column major matrix -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Matrix2 { pub x: Vector2, pub y: Vector2 } /// A 3 x 3, column major matrix -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Matrix3 { pub x: Vector3, pub y: Vector3, pub z: Vector3 } /// A 4 x 4, column major matrix -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Matrix4 { pub x: Vector4, pub y: Vector4, pub z: Vector4, pub w: Vector4 } diff --git a/src/cgmath/obb.rs b/src/cgmath/obb.rs index 9157f84..9466359 100644 --- a/src/cgmath/obb.rs +++ b/src/cgmath/obb.rs @@ -18,14 +18,14 @@ use point::{Point2, Point3}; use vector::{Vector2, Vector3}; -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Obb2 { pub center: Point2, pub axis: Vector2, pub extents: Vector2, } -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Obb3 { pub center: Point3, pub axis: Vector3, diff --git a/src/cgmath/plane.rs b/src/cgmath/plane.rs index 0e28cf1..9f82837 100644 --- a/src/cgmath/plane.rs +++ b/src/cgmath/plane.rs @@ -41,7 +41,7 @@ use vector::{Vector, EuclideanVector}; /// The `A*x + B*y + C*z - D = 0` form is preferred over the other common /// alternative, `A*x + B*y + C*z + D = 0`, because it tends to avoid /// superfluous negations (see _Real Time Collision Detection_, p. 55). -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Plane { pub n: Vector3, pub d: S, diff --git a/src/cgmath/point.rs b/src/cgmath/point.rs index e0416fa..3a1c769 100644 --- a/src/cgmath/point.rs +++ b/src/cgmath/point.rs @@ -27,11 +27,11 @@ use num::{BaseNum, BaseFloat}; use vector::*; /// A point in 2-dimensional space. -#[deriving(Eq, Clone, Hash)] +#[deriving(PartialEq, Clone, Hash)] pub struct Point2 { pub x: S, pub y: S } /// A point in 3-dimensional space. -#[deriving(Eq, Clone, Hash)] +#[deriving(PartialEq, Clone, Hash)] pub struct Point3 { pub x: S, pub y: S, pub z: S } diff --git a/src/cgmath/projection.rs b/src/cgmath/projection.rs index 35d8cbc..3dc82a0 100644 --- a/src/cgmath/projection.rs +++ b/src/cgmath/projection.rs @@ -69,7 +69,7 @@ pub trait Projection: ToMatrix4 { } /// A perspective projection based on a vertical field-of-view angle. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct PerspectiveFov { pub fovy: A, pub aspect: S, @@ -143,7 +143,7 @@ impl> ToMatrix4 for PerspectiveFov { } /// A perspective projection with arbitrary left/right/bottom/top distances -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Perspective { pub left: S, right: S, pub bottom: S, top: S, @@ -193,7 +193,7 @@ impl ToMatrix4 for Perspective { } /// An orthographic projection with arbitrary left/right/bottom/top distances -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Ortho { pub left: S, right: S, pub bottom: S, top: S, diff --git a/src/cgmath/quaternion.rs b/src/cgmath/quaternion.rs index 2a5fd8e..40b0a56 100644 --- a/src/cgmath/quaternion.rs +++ b/src/cgmath/quaternion.rs @@ -28,7 +28,7 @@ use vector::{Vector3, Vector, EuclideanVector}; /// A [quaternion](https://en.wikipedia.org/wiki/Quaternion) in scalar/vector /// form. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Quaternion { pub s: S, pub v: Vector3 } /// Represents types which can be expressed as a quaternion. diff --git a/src/cgmath/ray.rs b/src/cgmath/ray.rs index 75bdcd8..7d88b9c 100644 --- a/src/cgmath/ray.rs +++ b/src/cgmath/ray.rs @@ -19,7 +19,7 @@ use vector::{Vector, Vector2, Vector3}; /// A generic ray starting at `origin` and extending infinitely in /// `direction`. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Ray { pub origin: P, pub direction: V, diff --git a/src/cgmath/rotation.rs b/src/cgmath/rotation.rs index 9fe930e..11fdc43 100644 --- a/src/cgmath/rotation.rs +++ b/src/cgmath/rotation.rs @@ -26,7 +26,7 @@ use vector::{Vector, Vector2, Vector3}; /// A trait for a generic rotation. A rotation is a transformation that /// creates a circular motion, and preserves at least one point in the space. -pub trait Rotation, P: Point>: Eq + ApproxEq { +pub trait Rotation, P: Point>: PartialEq + ApproxEq { /// Create the identity transform (causes no transformation). fn identity() -> Self; @@ -125,7 +125,7 @@ pub trait Rotation3: Rotation, Point3> /// implemented more efficiently than the implementations for `math::Matrix2`. To /// enforce orthogonality at the type level the operations have been restricted /// to a subset of those implemented on `Matrix2`. -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] pub struct Basis2 { mat: Matrix2 } @@ -203,7 +203,7 @@ impl Rotation2 for Basis2 { /// inversion, can be implemented more efficiently than the implementations for /// `math::Matrix3`. To ensure orthogonality is maintained, the operations have /// been restricted to a subeset of those implemented on `Matrix3`. -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] pub struct Basis3 { mat: Matrix3 } diff --git a/src/cgmath/sphere.rs b/src/cgmath/sphere.rs index 446491a..4960456 100644 --- a/src/cgmath/sphere.rs +++ b/src/cgmath/sphere.rs @@ -23,7 +23,7 @@ use vector::Vector; use std::num::zero; -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Sphere { pub center: Point3, pub radius: S, diff --git a/src/cgmath/vector.rs b/src/cgmath/vector.rs index 4193dde..49efe82 100644 --- a/src/cgmath/vector.rs +++ b/src/cgmath/vector.rs @@ -97,7 +97,7 @@ pub trait Vector: Array1 // Utility macro for generating associated functions for the vectors macro_rules! vec( ($Self:ident <$S:ident> { $($field:ident),+ }, $n:expr) => ( - #[deriving(Eq, TotalEq, Clone, Hash)] + #[deriving(PartialEq, Eq, Clone, Hash)] pub struct $Self { $(pub $field: S),+ } impl<$S> $Self<$S> {