From d1a58f960cd4dd202e2948c94ffafdcc8863e5df Mon Sep 17 00:00:00 2001
From: Vincent Barrielle <vincent.barrielle@polytechnique.edu>
Date: Fri, 9 May 2014 23:05:23 +0200
Subject: [PATCH] Moving row/col slicing traits to a better place

---
 src/linalg/decompositions.rs |  3 ++-
 src/structs/dmat.rs          |  4 ++--
 src/traits/mod.rs            |  5 +++--
 src/traits/operations.rs     | 11 -----------
 src/traits/structure.rs      | 12 ++++++++++++
 5 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/src/linalg/decompositions.rs b/src/linalg/decompositions.rs
index bee21f37..0c957682 100644
--- a/src/linalg/decompositions.rs
+++ b/src/linalg/decompositions.rs
@@ -1,7 +1,8 @@
 use std::num::{Zero, Float};
 use na::DVec;
 use na::DMat;
-use traits::operations::{Transpose, ColSlice};
+use traits::operations::Transpose;
+use traits::structure::ColSlice;
 use traits::geometry::Norm;
 use std::cmp::min;
 
diff --git a/src/structs/dmat.rs b/src/structs/dmat.rs
index ac9cac7c..8fac029c 100644
--- a/src/structs/dmat.rs
+++ b/src/structs/dmat.rs
@@ -8,8 +8,8 @@ use std::num::{One, Zero};
 use traits::operations::ApproxEq;
 use std::mem;
 use structs::dvec::{DVec, DVecMulRhs};
-use traits::operations::{Inv, Transpose, Mean, Cov, ColSlice, RowSlice};
-use traits::structure::Cast;
+use traits::operations::{Inv, Transpose, Mean, Cov};
+use traits::structure::{Cast, ColSlice, RowSlice};
 use std::fmt::{Show, Formatter, Result};
 
 #[doc(hidden)]
diff --git a/src/traits/mod.rs b/src/traits/mod.rs
index c973e80a..9c774d80 100644
--- a/src/traits/mod.rs
+++ b/src/traits/mod.rs
@@ -5,10 +5,11 @@ pub use self::geometry::{AbsoluteRotate, Cross, CrossMatrix, Dot, FromHomogeneou
                          Transform, Transformation, Translate, Translation, UniformSphereSample};
 
 pub use self::structure::{FloatVec, FloatVecExt, Basis, Cast, Col, Dim, Indexable,
-                          Iterable, IterableMut, Mat, Row, AnyVec, VecExt};
+                          Iterable, IterableMut, Mat, Row, AnyVec, VecExt,
+                          ColSlice, RowSlice};
 
 pub use self::operations::{Absolute, ApproxEq, Cov, Inv, LMul, Mean, Outer, PartialOrd, RMul,
-                           ScalarAdd, ScalarSub, Transpose, ColSlice, RowSlice};
+                           ScalarAdd, ScalarSub, Transpose};
 pub use self::operations::{PartialOrdering, PartialLess, PartialEqual, PartialGreater, NotComparable};
 
 pub mod geometry;
diff --git a/src/traits/operations.rs b/src/traits/operations.rs
index 34f38d9a..b71a1ff2 100644
--- a/src/traits/operations.rs
+++ b/src/traits/operations.rs
@@ -244,17 +244,6 @@ pub trait Mean<N> {
     fn mean(&Self) -> N;
 }
 
-/// Trait for objects that support column slicing
-pub trait ColSlice<VecLike> {
-    /// Returns a view to a slice of a column of a matrix.
-    fn col_slice(&self, col_id :uint, row_start: uint, row_end: uint) -> VecLike;
-}
-
-/// Trait for objects that support column slicing
-pub trait RowSlice<VecLike> {
-    /// Returns a view to a slice of a row of a matrix.
-    fn row_slice(&self, row_id :uint, col_start: uint, col_end: uint) -> VecLike;
-}
 
 // /// Cholesky decomposition.
 // pub trait Chol {
diff --git a/src/traits/structure.rs b/src/traits/structure.rs
index db0f1be9..eb86190a 100644
--- a/src/traits/structure.rs
+++ b/src/traits/structure.rs
@@ -91,6 +91,18 @@ pub trait Col<C> {
     // a lot of operations.
 }
 
+/// Trait to access part of a column of a matrix
+pub trait ColSlice<C> {
+    /// Returns a view to a slice of a column of a matrix.
+    fn col_slice(&self, col_id :uint, row_start: uint, row_end: uint) -> C;
+}
+
+/// Trait to access part of a row of a matrix
+pub trait RowSlice<R> {
+    /// Returns a view to a slice of a row of a matrix.
+    fn row_slice(&self, row_id :uint, col_start: uint, col_end: uint) -> R;
+}
+
 /// Trait of objects having a spacial dimension known at compile time.
 pub trait Dim {
     /// The dimension of the object.