From eb24c4063fd442a36994956936ca9f4cf6909f3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Sat, 25 Oct 2014 22:28:49 +0200 Subject: [PATCH] Remove the {Any,Float}{Pnt,Vec}Ext traits. They are meaningless and too hard to implement in an ad-hoc way to be really useful. --- src/lib.rs | 4 ---- src/traits/mod.rs | 6 +++--- src/traits/structure.rs | 37 +++---------------------------------- 3 files changed, 6 insertions(+), 41 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c2a6ac9c..bf12512b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -115,9 +115,7 @@ pub use traits::{ Absolute, AbsoluteRotate, AnyPnt, - AnyPntExt, AnyVec, - AnyVecExt, ApproxEq, Axpy, Basis, @@ -133,9 +131,7 @@ pub use traits::{ Dot, Eye, FloatPnt, - FloatPntExt, FloatVec, - FloatVecExt, FromHomogeneous, Indexable, Inv, diff --git a/src/traits/mod.rs b/src/traits/mod.rs index 7d1c53a3..4cd2aa0b 100644 --- a/src/traits/mod.rs +++ b/src/traits/mod.rs @@ -4,9 +4,9 @@ pub use self::geometry::{AbsoluteRotate, Cross, CrossMatrix, Dot, FromHomogeneou Rotate, Rotation, RotationMatrix, RotationWithTranslation, ToHomogeneous, Transform, Transformation, Translate, Translation, UniformSphereSample}; -pub use self::structure::{FloatVec, FloatVecExt, FloatPnt, FloatPntExt, Basis, Cast, Col, Dim, - Indexable, Iterable, IterableMut, Mat, Row, AnyVec, AnyVecExt, AnyPnt, - AnyPntExt, PntAsVec, VecAsPnt, ColSlice, RowSlice, Diag, Eye}; +pub use self::structure::{FloatVec, FloatPnt, Basis, Cast, Col, Dim, Indexable, Iterable, + IterableMut, Mat, Row, AnyVec, AnyPnt, PntAsVec, VecAsPnt, ColSlice, + RowSlice, Diag, Eye}; pub use self::operations::{Absolute, ApproxEq, Axpy, Cov, Det, Inv, LMul, Mean, Outer, POrd, RMul, ScalarAdd, ScalarSub, ScalarMul, ScalarDiv, Transpose}; diff --git a/src/traits/structure.rs b/src/traits/structure.rs index 403b2bf2..050bfcae 100644 --- a/src/traits/structure.rs +++ b/src/traits/structure.rs @@ -1,9 +1,9 @@ //! Traits giving structural informations on linear algebra objects or the space they live in. -use std::num::{Zero, Bounded}; +use std::num::Zero; use std::slice::{Items, MutItems}; -use traits::operations::{RMul, LMul, ScalarAdd, ScalarSub, Axpy}; -use traits::geometry::{Dot, Norm, UniformSphereSample, Orig}; +use traits::operations::{RMul, LMul, Axpy}; +use traits::geometry::{Dot, Norm, Orig}; /// Traits of objects which can be created from an object of type `T`. pub trait Cast { @@ -164,28 +164,11 @@ pub trait AnyVec: Dim + Sub + Add + Neg + Zero pub trait FloatVec: AnyVec + Norm { } -/// Trait grouping uncommon, low-level and borderline (from the mathematical point of view) -/// operations on vectors. -pub trait AnyVecExt: AnyVec + Indexable + Index + IndexMut + - Iterable + UniformSphereSample + ScalarAdd + ScalarSub + Bounded -{ } - -/// Trait grouping uncommon, low-level and borderline (from the mathematical point of view) -/// operations on vectors. -pub trait FloatVecExt: FloatVec + AnyVecExt { } - impl + Add + Neg + Zero + PartialEq + Mul + Div + Dot + Axpy + Basis> AnyVec for V { } impl + Norm> FloatVec for V { } -impl + Indexable + Index + IndexMut + Iterable + - UniformSphereSample + ScalarAdd + ScalarSub + Bounded> -AnyVecExt for V { } - -impl + AnyVecExt> FloatVecExt for V { } - /* * Pnt related traits. */ @@ -226,20 +209,6 @@ pub trait FloatPnt>: AnyPnt { } } -/// Trait grouping uncommon, low-level and borderline (from the mathematical point of view) -/// operations on points. -pub trait AnyPntExt: AnyPnt + Indexable + Index + IndexMut + - Iterable + ScalarAdd + ScalarSub + Bounded + Axpy -{ } - -/// Trait grouping uncommon, low-level and borderline (from the mathematical point of view) -/// operations on points. -pub trait FloatPntExt> : FloatPnt + AnyPntExt { } - - impl + Dim + Sub + Add + Orig + Neg

+ PartialEq + Mul + Div> AnyPnt for P { } impl, P: AnyPnt> FloatPnt for P { } -impl + Indexable + Index + IndexMut + Iterable + ScalarAdd + ScalarSub + Bounded + Axpy> -AnyPntExt for P { } -impl, P: FloatPnt + AnyPntExt> FloatPntExt for P { }