Add Ord instances.
This commit is contained in:
parent
3ccade3d2f
commit
6e627f3378
|
@ -10,7 +10,7 @@ use traits::sub_dot::SubDot;
|
|||
use traits::flatten::Flatten;
|
||||
use traits::workarounds::scalar_op::{ScalarMul, ScalarDiv, ScalarAdd, ScalarSub};
|
||||
|
||||
#[deriving(Eq, ToStr)]
|
||||
#[deriving(Eq, Ord, ToStr)]
|
||||
pub struct Vec1<N>
|
||||
{ x : N }
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ use traits::flatten::Flatten;
|
|||
use traits::translation::Translation;
|
||||
use traits::workarounds::scalar_op::{ScalarMul, ScalarDiv, ScalarAdd, ScalarSub};
|
||||
|
||||
#[deriving(Eq, ToStr)]
|
||||
#[deriving(Eq, Ord, ToStr)]
|
||||
pub struct Vec2<N>
|
||||
{
|
||||
x : N,
|
||||
|
|
|
@ -11,7 +11,7 @@ use traits::flatten::Flatten;
|
|||
use traits::translation::Translation;
|
||||
use traits::workarounds::scalar_op::{ScalarMul, ScalarDiv, ScalarAdd, ScalarSub};
|
||||
|
||||
#[deriving(Eq, ToStr)]
|
||||
#[deriving(Eq, Ord, ToStr)]
|
||||
pub struct Vec3<N>
|
||||
{
|
||||
x : N,
|
||||
|
|
|
@ -11,7 +11,7 @@ use traits::norm::Norm;
|
|||
use traits::translation::Translation;
|
||||
use traits::workarounds::scalar_op::{ScalarMul, ScalarDiv, ScalarAdd, ScalarSub};
|
||||
|
||||
#[deriving(Eq, ToStr, Clone)]
|
||||
#[deriving(Eq, Ord, ToStr, Clone)]
|
||||
pub struct DVec<N>
|
||||
{
|
||||
at: ~[N]
|
||||
|
|
|
@ -21,7 +21,7 @@ use traits::workarounds::scalar_op::{ScalarMul, ScalarDiv, ScalarAdd, ScalarSub}
|
|||
// using d0, d1, d2, d3, ..., d7 (or your own dn) are prefered.
|
||||
// FIXME: it might be possible to implement type-level integers and use them
|
||||
// here?
|
||||
#[deriving(Eq, ToStr)]
|
||||
#[deriving(Eq, Ord, ToStr)]
|
||||
pub struct NVec<D, N>
|
||||
{ at: DVec<N> }
|
||||
|
||||
|
|
|
@ -11,42 +11,42 @@ pub trait Dim {
|
|||
|
||||
/// Dimensional token for 0-dimensions. Dimensional tokens are the preferred
|
||||
/// way to specify at the type level the dimension of n-dimensional objects.
|
||||
#[deriving(Eq, ToStr)]
|
||||
#[deriving(Eq, Ord, ToStr)]
|
||||
pub struct d0;
|
||||
|
||||
/// Dimensional token for 1-dimension. Dimensional tokens are the preferred
|
||||
/// way to specify at the type level the dimension of n-dimensional objects.
|
||||
#[deriving(Eq, ToStr)]
|
||||
#[deriving(Eq, Ord, ToStr)]
|
||||
pub struct d1;
|
||||
|
||||
/// Dimensional token for 2-dimensions. Dimensional tokens are the preferred
|
||||
/// way to specify at the type level the dimension of n-dimensional objects.
|
||||
#[deriving(Eq, ToStr)]
|
||||
#[deriving(Eq, Ord, ToStr)]
|
||||
pub struct d2;
|
||||
|
||||
/// Dimensional token for 3-dimensions. Dimensional tokens are the preferred
|
||||
/// way to specify at the type level the dimension of n-dimensional objects.
|
||||
#[deriving(Eq, ToStr)]
|
||||
#[deriving(Eq, Ord, ToStr)]
|
||||
pub struct d3;
|
||||
|
||||
/// Dimensional token for 4-dimensions. Dimensional tokens are the preferred
|
||||
/// way to specify at the type level the dimension of n-dimensional objects.
|
||||
#[deriving(Eq, ToStr)]
|
||||
#[deriving(Eq, Ord, ToStr)]
|
||||
pub struct d4;
|
||||
|
||||
/// Dimensional token for 5-dimensions. Dimensional tokens are the preferred
|
||||
/// way to specify at the type level the dimension of n-dimensional objects.
|
||||
#[deriving(Eq, ToStr)]
|
||||
#[deriving(Eq, Ord, ToStr)]
|
||||
pub struct d5;
|
||||
|
||||
/// Dimensional token for 6-dimensions. Dimensional tokens are the preferred
|
||||
/// way to specify at the type level the dimension of n-dimensional objects.
|
||||
#[deriving(Eq, ToStr)]
|
||||
#[deriving(Eq, Ord, ToStr)]
|
||||
pub struct d6;
|
||||
|
||||
/// Dimensional token for 7-dimensions. Dimensional tokens are the preferred
|
||||
/// way to specify at the type level the dimension of n-dimensional objects.
|
||||
#[deriving(Eq, ToStr)]
|
||||
#[deriving(Eq, Ord, ToStr)]
|
||||
pub struct d7;
|
||||
|
||||
impl Dim for d0
|
||||
|
|
Loading…
Reference in New Issue