diff --git a/src/structs/dvec.rs b/src/structs/dvec.rs index 6936d185..0560caff 100644 --- a/src/structs/dvec.rs +++ b/src/structs/dvec.rs @@ -57,6 +57,11 @@ impl DVec { pub fn from_fn(dim: uint, f: |uint| -> N) -> DVec { DVec { at: Vec::from_fn(dim, |i| f(i)) } } + + #[inline] + pub fn len(&self) -> uint { + self.at.len() + } } impl FromIterator for DVec { @@ -73,13 +78,6 @@ impl FromIterator for DVec { } -impl Collection for DVec { - #[inline] - fn len(&self) -> uint { - self.at.len() - } -} - dvec_impl!(DVec, DVecMulRhs, DVecDivRhs, DVecAddRhs, DVecSubRhs) /// Stack-allocated, dynamically sized vector with a maximum size of 1. diff --git a/src/structs/dvec_macros.rs b/src/structs/dvec_macros.rs index c54c98e0..3f80c43d 100644 --- a/src/structs/dvec_macros.rs +++ b/src/structs/dvec_macros.rs @@ -377,9 +377,9 @@ macro_rules! dvec_scalar_sub_impl ( macro_rules! small_dvec_impl ( ($dvec: ident, $dim: expr, $mul: ident, $div: ident, $add: ident, $sub: ident $(,$idx: expr)*) => ( - impl Collection for $dvec { + impl $dvec { #[inline] - fn len(&self) -> uint { + pub fn len(&self) -> uint { self.dim } } diff --git a/src/structs/vec_macros.rs b/src/structs/vec_macros.rs index 9568a69c..863a2ef8 100644 --- a/src/structs/vec_macros.rs +++ b/src/structs/vec_macros.rs @@ -282,9 +282,9 @@ macro_rules! dim_impl( macro_rules! container_impl( ($t: ident) => ( - impl Collection for $t { + impl $t { #[inline] - fn len(&self) -> uint { + pub fn len(&self) -> uint { Dim::dim(None::<$t>) } }