From cac7e7fbc94c126ea70c535198bada462cde3cc3 Mon Sep 17 00:00:00 2001 From: Hyeon Kim Date: Mon, 9 Feb 2015 01:01:01 +0900 Subject: [PATCH] Add `#[derive_Rand]`, dropping `#[derive(Rand)]` `#[derive(Rand)]` has been deprecated --- src/structs/mat.rs | 21 ++++++++++++++------- src/structs/pnt.rs | 21 ++++++++++++++------- src/structs/quat.rs | 3 ++- src/structs/vec.rs | 21 ++++++++++++++------- 4 files changed, 44 insertions(+), 22 deletions(-) diff --git a/src/structs/mat.rs b/src/structs/mat.rs index c3e8ece5..c8892e31 100644 --- a/src/structs/mat.rs +++ b/src/structs/mat.rs @@ -20,7 +20,8 @@ use quickcheck::{Arbitrary, Gen}; /// Special identity matrix. All its operation are no-ops. -#[derive(Eq, PartialEq, RustcDecodable, Clone, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcDecodable, Clone, Debug, Copy)] +#[derive_Rand] pub struct Identity; impl Identity { @@ -32,7 +33,8 @@ impl Identity { } /// Square matrix of dimension 1. -#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] +#[derive_Rand] pub struct Mat1 { pub m11: N } @@ -77,7 +79,8 @@ eigen_qr_impl!(Mat1, Vec1); arbitrary_impl!(Mat1, m11); /// Square matrix of dimension 2. -#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] +#[derive_Rand] pub struct Mat2 { pub m11: N, pub m21: N, pub m12: N, pub m22: N @@ -126,7 +129,8 @@ eigen_qr_impl!(Mat2, Vec2); arbitrary_impl!(Mat2, m11, m12, m21, m22); /// Square matrix of dimension 3. -#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] +#[derive_Rand] pub struct Mat3 { pub m11: N, pub m21: N, pub m31: N, pub m12: N, pub m22: N, pub m32: N, @@ -213,7 +217,8 @@ arbitrary_impl!(Mat3, ); /// Square matrix of dimension 4. -#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] +#[derive_Rand] pub struct Mat4 { pub m11: N, pub m21: N, pub m31: N, pub m41: N, pub m12: N, pub m22: N, pub m32: N, pub m42: N, @@ -319,7 +324,8 @@ arbitrary_impl!(Mat4, ); /// Square matrix of dimension 5. -#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] +#[derive_Rand] pub struct Mat5 { pub m11: N, pub m21: N, pub m31: N, pub m41: N, pub m51: N, pub m12: N, pub m22: N, pub m32: N, pub m42: N, pub m52: N, @@ -440,7 +446,8 @@ arbitrary_impl!(Mat5, ); /// Square matrix of dimension 6. -#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] +#[derive_Rand] pub struct Mat6 { pub m11: N, pub m21: N, pub m31: N, pub m41: N, pub m51: N, pub m61: N, pub m12: N, pub m22: N, pub m32: N, pub m42: N, pub m52: N, pub m62: N, diff --git a/src/structs/pnt.rs b/src/structs/pnt.rs index aec3e948..54c09b43 100644 --- a/src/structs/pnt.rs +++ b/src/structs/pnt.rs @@ -17,7 +17,8 @@ use quickcheck::{Arbitrary, Gen}; /// Point of dimension 0. -#[derive(Eq, PartialEq, RustcDecodable, Clone, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcDecodable, Clone, Debug, Copy)] +#[derive_Rand] pub struct Pnt0; impl Pnt0 { @@ -35,7 +36,8 @@ impl Pnt0 { } /// Point of dimension 1. -#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] +#[derive_Rand] pub struct Pnt1 { /// First component of the point. pub x: N @@ -74,7 +76,8 @@ num_float_pnt_impl!(Pnt1, Vec1); arbitrary_pnt_impl!(Pnt1, x); /// Point of dimension 2. -#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] +#[derive_Rand] pub struct Pnt2 { /// First component of the point. pub x: N, @@ -115,7 +118,8 @@ num_float_pnt_impl!(Pnt2, Vec2); arbitrary_pnt_impl!(Pnt2, x, y); /// Point of dimension 3. -#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] +#[derive_Rand] pub struct Pnt3 { /// First component of the point. pub x: N, @@ -158,7 +162,8 @@ num_float_pnt_impl!(Pnt3, Vec3); arbitrary_pnt_impl!(Pnt3, x, y, z); /// Point of dimension 4. -#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] +#[derive_Rand] pub struct Pnt4 { /// First component of the point. pub x: N, @@ -203,7 +208,8 @@ num_float_pnt_impl!(Pnt4, Vec4); arbitrary_pnt_impl!(Pnt4, x, y, z, w); /// Point of dimension 5. -#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] +#[derive_Rand] pub struct Pnt5 { /// First component of the point. pub x: N, @@ -250,7 +256,8 @@ num_float_pnt_impl!(Pnt5, Vec5); arbitrary_pnt_impl!(Pnt5, x, y, z, w, a); /// Point of dimension 6. -#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] +#[derive_Rand] pub struct Pnt6 { /// First component of the point. pub x: N, diff --git a/src/structs/quat.rs b/src/structs/quat.rs index a084326a..d6b883af 100644 --- a/src/structs/quat.rs +++ b/src/structs/quat.rs @@ -20,7 +20,8 @@ use quickcheck::{Arbitrary, Gen}; /// A quaternion. -#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] +#[derive_Rand] pub struct Quat { /// The scalar component of the quaternion. pub w: N, diff --git a/src/structs/vec.rs b/src/structs/vec.rs index 96aca6b4..903aaef9 100644 --- a/src/structs/vec.rs +++ b/src/structs/vec.rs @@ -19,7 +19,8 @@ use quickcheck::{Arbitrary, Gen}; /// Vector of dimension 0. -#[derive(Eq, PartialEq, RustcDecodable, Clone, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcDecodable, Clone, Debug, Copy)] +#[derive_Rand] pub struct Vec0; impl Vec0 { @@ -37,7 +38,8 @@ impl Vec0 { } /// Vector of dimension 1. -#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] +#[derive_Rand] pub struct Vec1 { /// First component of the vector. pub x: N @@ -87,7 +89,8 @@ absolute_vec_impl!(Vec1, x); arbitrary_impl!(Vec1, x); /// Vector of dimension 2. -#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] +#[derive_Rand] pub struct Vec2 { /// First component of the vector. pub x: N, @@ -139,7 +142,8 @@ absolute_vec_impl!(Vec2, x, y); arbitrary_impl!(Vec2, x, y); /// Vector of dimension 3. -#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] +#[derive_Rand] pub struct Vec3 { /// First component of the vector. pub x: N, @@ -194,7 +198,8 @@ arbitrary_impl!(Vec3, x, y, z); /// Vector of dimension 4. -#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] +#[derive_Rand] pub struct Vec4 { /// First component of the vector. pub x: N, @@ -250,7 +255,8 @@ absolute_vec_impl!(Vec4, x, y, z, w); arbitrary_impl!(Vec4, x, y, z, w); /// Vector of dimension 5. -#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] +#[derive_Rand] pub struct Vec5 { /// First component of the vector. pub x: N, @@ -308,7 +314,8 @@ absolute_vec_impl!(Vec5, x, y, z, w, a); arbitrary_impl!(Vec5, x, y, z, w, a); /// Vector of dimension 6. -#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Debug, Copy)] +#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] +#[derive_Rand] pub struct Vec6 { /// First component of the vector. pub x: N,