diff --git a/src/lib.rs b/src/lib.rs index 033d72c2..2e3bda31 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -576,7 +576,7 @@ pub fn inv_rotate>(m: &M, v: &V) -> V { /// Rotates a copy of `m` by `amount` using `center` as the pivot point. #[inline(always)] -pub fn append_rotation_wrt_point, +pub fn append_rotation_wrt_point + Copy, AV, M: RotationWithTranslation>( m: &M, @@ -587,7 +587,7 @@ pub fn append_rotation_wrt_point, /// Rotates a copy of `m` by `amount` using `m.translation()` as the pivot point. #[inline(always)] -pub fn append_rotation_wrt_center, +pub fn append_rotation_wrt_center + Copy, AV, M: RotationWithTranslation>( m: &M, diff --git a/src/structs/dvec.rs b/src/structs/dvec.rs index 02cbc5b6..e99b1524 100644 --- a/src/structs/dvec.rs +++ b/src/structs/dvec.rs @@ -4,7 +4,7 @@ use std::rand::Rand; use std::rand; -use std::slice::{Items, MutItems}; +use std::slice::{Iter, IterMut}; use std::iter::FromIterator; use traits::operations::{ApproxEq, Axpy}; use traits::geometry::{Dot, Norm}; diff --git a/src/structs/dvec_macros.rs b/src/structs/dvec_macros.rs index 4d67fc96..8ee1f762 100644 --- a/src/structs/dvec_macros.rs +++ b/src/structs/dvec_macros.rs @@ -110,14 +110,14 @@ macro_rules! dvec_impl( impl Iterable for $dvec { #[inline] - fn iter<'l>(&'l self) -> Items<'l, N> { + fn iter<'l>(&'l self) -> Iter<'l, N> { self.as_slice().iter() } } impl IterableMut for $dvec { #[inline] - fn iter_mut<'l>(&'l mut self) -> MutItems<'l, N> { + fn iter_mut<'l>(&'l mut self) -> IterMut<'l, N> { self.as_mut_slice().iter_mut() } } @@ -250,9 +250,9 @@ macro_rules! dvec_impl( } } - impl + Zero> Neg<$dvec> for $dvec { + impl + Zero + Copy> Neg<$dvec> for $dvec { #[inline] - fn neg(&self) -> $dvec { + fn neg(self) -> $dvec { FromIterator::from_iter(self.as_slice().iter().map(|a| -*a)) } } diff --git a/src/structs/mat.rs b/src/structs/mat.rs index d48b911b..7db026e8 100644 --- a/src/structs/mat.rs +++ b/src/structs/mat.rs @@ -4,7 +4,7 @@ use std::mem; use traits::operations::ApproxEq; -use std::slice::{Items, MutItems}; +use std::slice::{Iter, IterMut}; use structs::vec::{Vec1, Vec2, Vec3, Vec4, Vec5, Vec6}; use structs::pnt::{Pnt1, Pnt4, Pnt5, Pnt6}; use structs::dvec::{DVec1, DVec2, DVec3, DVec4, DVec5, DVec6}; diff --git a/src/structs/mat_macros.rs b/src/structs/mat_macros.rs index 78ac9851..9d91d5e5 100644 --- a/src/structs/mat_macros.rs +++ b/src/structs/mat_macros.rs @@ -181,7 +181,7 @@ macro_rules! iterable_impl( ($t: ident, $dim: expr) => ( impl Iterable for $t { #[inline] - fn iter<'l>(&'l self) -> Items<'l, N> { + fn iter<'l>(&'l self) -> Iter<'l, N> { unsafe { mem::transmute::<&'l $t, &'l [N, ..$dim * $dim]>(self).iter() } @@ -194,7 +194,7 @@ macro_rules! iterable_mut_impl( ($t: ident, $dim: expr) => ( impl IterableMut for $t { #[inline] - fn iter_mut<'l>(&'l mut self) -> MutItems<'l, N> { + fn iter_mut<'l>(&'l mut self) -> IterMut<'l, N> { unsafe { mem::transmute::<&'l mut $t, &'l mut [N, ..$dim * $dim]>(self).iter_mut() } diff --git a/src/structs/pnt.rs b/src/structs/pnt.rs index 4b77a39e..06dcb11d 100644 --- a/src/structs/pnt.rs +++ b/src/structs/pnt.rs @@ -3,7 +3,7 @@ #![allow(missing_docs)] // we allow missing to avoid having to document the point components. use std::mem; -use std::slice::{Items, MutItems}; +use std::slice::{Iter, IterMut}; use std::iter::{Iterator, FromIterator}; use traits::operations::{ApproxEq, POrd, POrdering, Axpy, ScalarAdd, ScalarSub, ScalarMul, ScalarDiv}; diff --git a/src/structs/quat.rs b/src/structs/quat.rs index e975f813..464884f0 100644 --- a/src/structs/quat.rs +++ b/src/structs/quat.rs @@ -5,7 +5,7 @@ use std::mem; use std::num; use std::rand::{Rand, Rng}; -use std::slice::{Items, MutItems}; +use std::slice::{Iter, IterMut}; use structs::{Vec3, Pnt3, Rot3, Mat3}; use traits::operations::{ApproxEq, Inv, POrd, POrdering, Axpy, ScalarAdd, ScalarSub, ScalarMul, ScalarDiv}; @@ -54,7 +54,7 @@ impl Quat { } } -impl> Quat { +impl + Copy> Quat { /// Replaces this quaternion by its conjugate. #[inline] pub fn conjugate(&mut self) { diff --git a/src/structs/rot.rs b/src/structs/rot.rs index cc5da36d..09ecea2a 100644 --- a/src/structs/rot.rs +++ b/src/structs/rot.rs @@ -18,7 +18,7 @@ pub struct Rot2 { submat: Mat2 } -impl> Rot2 { +impl + Copy> Rot2 { /// Builds a 2 dimensional rotation matrix from an angle in radian. pub fn new(angle: Vec1) -> Rot2 { let (sia, coa) = angle.x.sin_cos(); @@ -66,7 +66,7 @@ impl Rotation> for Rot2 { } } -impl> Rand for Rot2 { +impl + Copy> Rand for Rot2 { #[inline] fn rand(rng: &mut R) -> Rot2 { Rot2::new(rng.gen()) diff --git a/src/structs/spec/vec0.rs b/src/structs/spec/vec0.rs index 8e8c6da5..683b3e12 100644 --- a/src/structs/spec/vec0.rs +++ b/src/structs/spec/vec0.rs @@ -1,5 +1,5 @@ use std::mem; -use std::slice::{Items, MutItems}; +use std::slice::{Iter, IterMut}; use std::iter::{Iterator, FromIterator}; use traits::operations::ApproxEq; use traits::structure::{Iterable, IterableMut, Indexable, Basis, Dim, Shape, BaseFloat, BaseNum, @@ -66,14 +66,14 @@ impl Indexable for vec::Vec0 { impl Iterable for vec::Vec0 { #[inline] - fn iter<'l>(&'l self) -> Items<'l, N> { + fn iter<'l>(&'l self) -> Iter<'l, N> { unsafe { mem::transmute::<&'l vec::Vec0, &'l [N, ..0]>(self).iter() } } } impl IterableMut for vec::Vec0 { #[inline] - fn iter_mut<'l>(&'l mut self) -> MutItems<'l, N> { + fn iter_mut<'l>(&'l mut self) -> IterMut<'l, N> { unsafe { mem::transmute::<&'l mut vec::Vec0, &'l mut [N, ..0]>(self).iter_mut() } } } @@ -112,9 +112,9 @@ impl Sub> for vec::Vec0 { } } -impl> Neg> for vec::Vec0 { +impl + Copy> Neg> for vec::Vec0 { #[inline] - fn neg(&self) -> vec::Vec0 { + fn neg(self) -> vec::Vec0 { vec::Vec0 } } diff --git a/src/structs/vec.rs b/src/structs/vec.rs index 1f5c01bf..16e242df 100644 --- a/src/structs/vec.rs +++ b/src/structs/vec.rs @@ -3,7 +3,7 @@ #![allow(missing_docs)] // we allow missing to avoid having to document the dispatch traits. use std::mem; -use std::slice::{Items, MutItems}; +use std::slice::{Iter, IterMut}; use std::iter::{Iterator, FromIterator}; use traits::operations::{ApproxEq, POrd, POrdering, Axpy, ScalarAdd, ScalarSub, ScalarMul, ScalarDiv, Absolute}; diff --git a/src/structs/vec_macros.rs b/src/structs/vec_macros.rs index 50fd4d44..f33e0644 100644 --- a/src/structs/vec_macros.rs +++ b/src/structs/vec_macros.rs @@ -269,7 +269,7 @@ macro_rules! iterable_impl( ($t: ident, $dim: expr) => ( impl Iterable for $t { #[inline] - fn iter<'l>(&'l self) -> Items<'l, N> { + fn iter<'l>(&'l self) -> Iter<'l, N> { unsafe { mem::transmute::<&'l $t, &'l [N, ..$dim]>(self).iter() } @@ -282,7 +282,7 @@ macro_rules! iterable_mut_impl( ($t: ident, $dim: expr) => ( impl IterableMut for $t { #[inline] - fn iter_mut<'l>(&'l mut self) -> MutItems<'l, N> { + fn iter_mut<'l>(&'l mut self) -> IterMut<'l, N> { unsafe { mem::transmute::<&'l mut $t, &'l mut [N, ..$dim]>(self).iter_mut() } @@ -480,9 +480,9 @@ macro_rules! scalar_div_impl( macro_rules! neg_impl( ($t: ident, $comp0: ident $(,$compN: ident)*) => ( - impl> Neg<$t> for $t { + impl + Copy> Neg<$t> for $t { #[inline] - fn neg(&self) -> $t { + fn neg(self) -> $t { $t::new(-self.$comp0 $(, -self.$compN )*) } } diff --git a/src/traits/geometry.rs b/src/traits/geometry.rs index 3ac68557..ac7306cc 100644 --- a/src/traits/geometry.rs +++ b/src/traits/geometry.rs @@ -82,7 +82,7 @@ pub trait Rotate { /// /// Those operations are automatically implemented in term of the `Rotation` and `Translation` /// traits. -pub trait RotationWithTranslation, AV>: Rotation + Translation { +pub trait RotationWithTranslation + Copy, AV>: Rotation + Translation { /// Applies a rotation centered on a specific point. /// /// # Arguments @@ -136,7 +136,7 @@ pub trait RotationWithTranslation, AV>: Rotation + Translation, AV, M: Rotation + Translation> RotationWithTranslation for M { +impl + Copy, AV, M: Rotation + Translation> RotationWithTranslation for M { } /// Trait of transformation having a rotation extractable as a rotation matrix. This can typically diff --git a/src/traits/structure.rs b/src/traits/structure.rs index c3870936..76a9beca 100644 --- a/src/traits/structure.rs +++ b/src/traits/structure.rs @@ -3,7 +3,7 @@ use std::f32; use std::f64; use std::num::{Int, Float, FloatMath}; -use std::slice::{Items, MutItems}; +use std::slice::{Iter, IterMut}; use traits::operations::{RMul, LMul, Axpy, Transpose, Inv, Absolute}; use traits::geometry::{Dot, Norm, Orig}; @@ -209,7 +209,7 @@ pub trait Indexable: Shape + IndexMut { /// Traits of objects which can be iterated through like a vector. pub trait Iterable { /// Gets a vector-like read-only iterator. - fn iter<'l>(&'l self) -> Items<'l, N>; + fn iter<'l>(&'l self) -> Iter<'l, N>; } /// This is a workaround of current Rust limitations. @@ -217,7 +217,7 @@ pub trait Iterable { /// Traits of mutable objects which can be iterated through like a vector. pub trait IterableMut { /// Gets a vector-like read-write iterator. - fn iter_mut<'l>(&'l mut self) -> MutItems<'l, N>; + fn iter_mut<'l>(&'l mut self) -> IterMut<'l, N>; } /*