Made BaseNum to be a blanket implementation.

This commit is contained in:
Delma 2016-11-28 22:29:09 +02:00
parent e0fc89ffc6
commit 23f57dd133
1 changed files with 14 additions and 18 deletions

View File

@ -229,14 +229,14 @@ pub trait IterableMut<N> {
pub trait NumVector<N>: Add<Self, Output = Self> + Sub<Self, Output = Self> + pub trait NumVector<N>: Add<Self, Output = Self> + Sub<Self, Output = Self> +
// Mul<Self, Output = Self> + Div<Self, Output = Self> + // Mul<Self, Output = Self> + Div<Self, Output = Self> +
// Add<N, Output = Self> + Sub<N, Output = Self> + // Add<N, Output = Self> + Sub<N, Output = Self> +
Mul<N, Output = Self> + Div<N, Output = Self> + Mul<N, Output = Self> + Div<N, Output = Self> +
AddAssign<Self> + SubAssign<Self> + AddAssign<Self> + SubAssign<Self> +
// MulAssign<Self> + DivAssign<Self> + // MulAssign<Self> + DivAssign<Self> +
// AddAssign<N> + SubAssign<N> + // AddAssign<N> + SubAssign<N> +
MulAssign<N> + DivAssign<N> + MulAssign<N> + DivAssign<N> +
Dimension + Index<usize, Output = N> + Dimension + Index<usize, Output = N> +
Zero + PartialEq + Dot<N> + Axpy<N> { Zero + PartialEq + Dot<N> + Axpy<N> {
@ -253,7 +253,7 @@ pub trait FloatVector<N: BaseFloat>: NumVector<N> + Norm<NormType = N> + Neg<Out
pub trait PointAsVector { pub trait PointAsVector {
/// The vector type of the vector space associated to this point's affine space. /// The vector type of the vector space associated to this point's affine space.
type Vector; type Vector;
/// Converts this point to its associated vector. /// Converts this point to its associated vector.
fn to_vector(self) -> Self::Vector; fn to_vector(self) -> Self::Vector;
@ -424,18 +424,14 @@ macro_rules! impl_base_float(
} }
); );
impl BaseNum for i8 { } impl<T: Copy + Zero + One +
impl BaseNum for i16 { } Add<T, Output = T> + Sub<T, Output = T> +
impl BaseNum for i32 { } Mul<T, Output = T> + Div<T, Output = T> +
impl BaseNum for i64 { } Rem<T, Output = T> +
impl BaseNum for isize { } AddAssign<T> + SubAssign<T> +
impl BaseNum for u8 { } MulAssign<T> + DivAssign<T> +
impl BaseNum for u16 { } RemAssign<T> +
impl BaseNum for u32 { } PartialEq + Absolute<T> + Axpy<T>> BaseNum for T {}
impl BaseNum for u64 { }
impl BaseNum for usize { }
impl BaseNum for f32 { }
impl BaseNum for f64 { }
impl_base_float!(f32); impl_base_float!(f32);
impl_base_float!(f64); impl_base_float!(f64);