diff --git a/src/lib.rs b/src/lib.rs index aefd89ca..6cc3d907 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -109,7 +109,6 @@ extern crate serialize; extern crate test; use std::cmp; -pub use traits::{PartialLess, PartialEqual, PartialGreater, NotComparable}; pub use traits::{ Absolute, AbsoluteRotate, diff --git a/src/structs/pnt.rs b/src/structs/pnt.rs index 51761d8b..451d85de 100644 --- a/src/structs/pnt.rs +++ b/src/structs/pnt.rs @@ -5,8 +5,7 @@ use std::mem; use std::slice::{Items, MutItems}; use std::iter::{Iterator, FromIterator}; -use traits::operations::{ApproxEq, POrd, POrdering, PartialLess, PartialEqual, - PartialGreater, NotComparable, Axpy, ScalarAdd, ScalarSub, ScalarMul, +use traits::operations::{ApproxEq, POrd, POrdering, Axpy, ScalarAdd, ScalarSub, ScalarMul, ScalarDiv}; use traits::structure::{Cast, Dim, Indexable, Iterable, IterableMut, PntAsVec, Shape, NumPnt, FloatPnt, BaseFloat, BaseNum, Zero, One, Bounded}; diff --git a/src/structs/quat.rs b/src/structs/quat.rs index bdd4bd6d..535e294e 100644 --- a/src/structs/quat.rs +++ b/src/structs/quat.rs @@ -7,8 +7,7 @@ use std::num; use std::rand::{Rand, Rng}; use std::slice::{Items, MutItems}; use structs::{Vec3, Pnt3, Rot3, Mat3, Vec3MulRhs, Pnt3MulRhs}; -use traits::operations::{ApproxEq, Inv, POrd, POrdering, NotComparable, PartialLess, - PartialGreater, PartialEqual, Axpy, ScalarAdd, ScalarSub, ScalarMul, +use traits::operations::{ApproxEq, Inv, POrd, POrdering, Axpy, ScalarAdd, ScalarSub, ScalarMul, ScalarDiv}; use traits::structure::{Cast, Indexable, Iterable, IterableMut, Dim, Shape, BaseFloat, BaseNum, Zero, One, Bounded}; diff --git a/src/structs/vec.rs b/src/structs/vec.rs index 0cae3b8b..bdb5f6dc 100644 --- a/src/structs/vec.rs +++ b/src/structs/vec.rs @@ -5,8 +5,7 @@ use std::mem; use std::slice::{Items, MutItems}; use std::iter::{Iterator, FromIterator}; -use traits::operations::{ApproxEq, POrd, POrdering, PartialLess, PartialEqual, - PartialGreater, NotComparable, Axpy, ScalarAdd, ScalarSub, ScalarMul, +use traits::operations::{ApproxEq, POrd, POrdering, Axpy, ScalarAdd, ScalarSub, ScalarMul, ScalarDiv, Absolute}; use traits::geometry::{Transform, Rotate, FromHomogeneous, ToHomogeneous, Dot, Norm, Translation, Translate}; diff --git a/src/structs/vec_macros.rs b/src/structs/vec_macros.rs index 7a4a771b..b93f9896 100644 --- a/src/structs/vec_macros.rs +++ b/src/structs/vec_macros.rs @@ -80,16 +80,16 @@ macro_rules! ord_impl( if is_lt { // < $( if a.$compN > b.$compN { - return NotComparable + return POrdering::NotComparable } )* - PartialLess + POrdering::PartialLess } else { // >= $( if a.$compN < b.$compN { - return NotComparable + return POrdering::NotComparable } else if a.$compN > b.$compN { is_eq = false; @@ -98,10 +98,10 @@ macro_rules! ord_impl( )* if is_eq { - PartialEqual + POrdering::PartialEqual } else { - PartialGreater + POrdering::PartialGreater } } } diff --git a/src/traits/mod.rs b/src/traits/mod.rs index 7a54df3e..364d0f81 100644 --- a/src/traits/mod.rs +++ b/src/traits/mod.rs @@ -11,7 +11,7 @@ pub use traits::structure::{FloatVec, FloatPnt, Basis, Cast, Col, Dim, Indexable pub use traits::operations::{Absolute, ApproxEq, Axpy, Cov, Det, Inv, LMul, Mean, Outer, POrd, RMul, ScalarAdd, ScalarSub, ScalarMul, ScalarDiv, Transpose, EigenQR}; -pub use traits::operations::{POrdering, PartialLess, PartialEqual, PartialGreater, NotComparable}; +pub use traits::operations::POrdering; pub mod geometry; pub mod structure; diff --git a/src/traits/operations.rs b/src/traits/operations.rs index b47e6baa..fead0289 100644 --- a/src/traits/operations.rs +++ b/src/traits/operations.rs @@ -19,40 +19,40 @@ pub enum POrdering { impl POrdering { /// Returns `true` if `self` is equal to `Equal`. pub fn is_eq(&self) -> bool { - *self == PartialEqual + *self == POrdering::PartialEqual } /// Returns `true` if `self` is equal to `Less`. pub fn is_lt(&self) -> bool { - *self == PartialLess + *self == POrdering::PartialLess } /// Returns `true` if `self` is equal to `Less` or `Equal`. pub fn is_le(&self) -> bool { - *self == PartialLess || *self == PartialEqual + *self == POrdering::PartialLess || *self == POrdering::PartialEqual } /// Returns `true` if `self` is equal to `Greater`. pub fn is_gt(&self) -> bool { - *self == PartialGreater + *self == POrdering::PartialGreater } /// Returns `true` if `self` is equal to `Greater` or `Equal`. pub fn is_ge(&self) -> bool { - *self == PartialGreater || *self == PartialEqual + *self == POrdering::PartialGreater || *self == POrdering::PartialEqual } /// Returns `true` if `self` is equal to `NotComparable`. pub fn is_not_comparable(&self) -> bool { - *self == NotComparable + *self == POrdering::NotComparable } /// Creates a `POrdering` from an `Ordering`. pub fn from_ordering(ord: Ordering) -> POrdering { match ord { - Less => PartialLess, - Equal => PartialEqual, - Greater => PartialGreater + Less => POrdering::PartialLess, + Equal => POrdering::PartialEqual, + Greater => POrdering::PartialGreater } } @@ -61,10 +61,10 @@ impl POrdering { /// Returns `None` if `self` is `NotComparable`. pub fn to_ordering(self) -> Option { match self { - PartialLess => Some(Less), - PartialEqual => Some(Equal), - PartialGreater => Some(Greater), - NotComparable => None + POrdering::PartialLess => Some(Less), + POrdering::PartialEqual => Some(Equal), + POrdering::PartialGreater => Some(Greater), + POrdering::NotComparable => None } } } @@ -108,9 +108,9 @@ pub trait POrd { #[inline] fn partial_min<'a>(a: &'a Self, b: &'a Self) -> Option<&'a Self> { match POrd::partial_cmp(a, b) { - PartialLess | PartialEqual => Some(a), - PartialGreater => Some(b), - NotComparable => None + POrdering::PartialLess | POrdering::PartialEqual => Some(a), + POrdering::PartialGreater => Some(b), + POrdering::NotComparable => None } } @@ -118,9 +118,9 @@ pub trait POrd { #[inline] fn partial_max<'a>(a: &'a Self, b: &'a Self) -> Option<&'a Self> { match POrd::partial_cmp(a, b) { - PartialGreater | PartialEqual => Some(a), - PartialLess => Some(b), - NotComparable => None + POrdering::PartialGreater | POrdering::PartialEqual => Some(a), + POrdering::PartialLess => Some(b), + POrdering::NotComparable => None } }