diff --git a/src/vec.rs b/src/vec.rs index 386e4f81..389d88b0 100644 --- a/src/vec.rs +++ b/src/vec.rs @@ -45,6 +45,7 @@ vec_cast_impl!(Vec1, x) indexable_impl!(Vec1, 1) new_repeat_impl!(Vec1, val, x) dim_impl!(Vec1, 1) +container_impl!(Vec1) // (specialized) basis_impl!(Vec1, 1) add_impl!(Vec1, x) sub_impl!(Vec1, x) @@ -86,6 +87,7 @@ vec_cast_impl!(Vec2, x, y) indexable_impl!(Vec2, 2) new_repeat_impl!(Vec2, val, x, y) dim_impl!(Vec2, 2) +container_impl!(Vec2) // (specialized) basis_impl!(Vec2, 1) add_impl!(Vec2, x, y) sub_impl!(Vec2, x, y) @@ -129,6 +131,7 @@ vec_cast_impl!(Vec3, x, y, z) indexable_impl!(Vec3, 3) new_repeat_impl!(Vec3, val, x, y, z) dim_impl!(Vec3, 3) +container_impl!(Vec3) // (specialized) basis_impl!(Vec3, 1) add_impl!(Vec3, x, y, z) sub_impl!(Vec3, x, y, z) @@ -181,6 +184,7 @@ vec_cast_impl!(PVec3, x, y, z) indexable_impl!(PVec3, 3) new_repeat_impl!(PVec3, val, x, y, z, _unused) dim_impl!(PVec3, 3) +container_impl!(PVec3) // (specialized) basis_impl!(PVec3, 1) add_impl!(PVec3, x, y, z) sub_impl!(PVec3, x, y, z) @@ -228,6 +232,7 @@ vec_cast_impl!(Vec4, x, y, z, w) indexable_impl!(Vec4, 4) new_repeat_impl!(Vec4, val, x, y, z, w) dim_impl!(Vec4, 4) +container_impl!(Vec4) basis_impl!(Vec4, 4) add_impl!(Vec4, x, y, z, w) sub_impl!(Vec4, x, y, z, w) @@ -275,6 +280,7 @@ vec_cast_impl!(Vec5, x, y, z, w, a) indexable_impl!(Vec5, 5) new_repeat_impl!(Vec5, val, x, y, z, w, a) dim_impl!(Vec5, 5) +container_impl!(Vec5) basis_impl!(Vec5, 5) add_impl!(Vec5, x, y, z, w, a) sub_impl!(Vec5, x, y, z, w, a) @@ -324,6 +330,7 @@ vec_cast_impl!(Vec6, x, y, z, w, a, b) indexable_impl!(Vec6, 6) new_repeat_impl!(Vec6, val, x, y, z, w, a, b) dim_impl!(Vec6, 6) +container_impl!(Vec6) basis_impl!(Vec6, 6) add_impl!(Vec6, x, y, z, w, a, b) sub_impl!(Vec6, x, y, z, w, a, b) diff --git a/src/vec_macros.rs b/src/vec_macros.rs index 9f991c45..15022238 100644 --- a/src/vec_macros.rs +++ b/src/vec_macros.rs @@ -181,6 +181,17 @@ macro_rules! dim_impl( ) ) +macro_rules! container_impl( + ($t: ident) => ( + impl Container for $t { + #[inline] + fn len(&self) -> uint { + Dim::dim(None::<$t>) + } + } + ) +) + macro_rules! basis_impl( ($t: ident, $dim: expr) => ( impl> Basis for $t {