Add 'rustc-serialize' and 'serde-serialize' features.

This commit is contained in:
Syrws 2015-06-13 01:11:56 +02:00
parent 44df67bde2
commit dd3c1fbea7
11 changed files with 116 additions and 34 deletions

View File

@ -16,13 +16,23 @@ name = "nalgebra"
path = "src/lib.rs" path = "src/lib.rs"
[features] [features]
default = ["rustc-serialize"]
serde-serialize = ["serde", "serde_macros"]
# Generate arbitrary instances of nalgebra types for testing with quickcheck # Generate arbitrary instances of nalgebra types for testing with quickcheck
arbitrary = ["quickcheck"] arbitrary = ["quickcheck"]
[dependencies] [dependencies]
rustc-serialize = "*"
rand = "*" rand = "*"
num = "*" num = "*"
[dependencies.rustc-serialize]
optional = true
[dependencies.serde]
optional = true
[dependencies.serde_macros]
optional = true
[dependencies.quickcheck] [dependencies.quickcheck]
optional = true optional = true

View File

@ -73,10 +73,18 @@ Feel free to add your project to this list if you happen to use **nalgebra**!
#![warn(missing_docs)] #![warn(missing_docs)]
#![doc(html_root_url = "http://nalgebra.org/doc")] #![doc(html_root_url = "http://nalgebra.org/doc")]
extern crate rustc_serialize; #![cfg_attr(feature = "serde-serialize", feature(custom_derive, plugin))]
#![cfg_attr(feature = "serde-serialize", plugin(serde_macros))]
extern crate rand; extern crate rand;
extern crate num; extern crate num;
#[cfg(feature = "rustc-serialize")]
extern crate rustc_serialize;
#[cfg(feature = "serde-serialize")]
extern crate serde;
#[cfg(feature="arbitrary")] #[cfg(feature="arbitrary")]
extern crate quickcheck; extern crate quickcheck;

View File

@ -25,7 +25,9 @@ use quickcheck::{Arbitrary, Gen};
/// This is the composition of a rotation followed by a translation. /// This is the composition of a rotation followed by a translation.
/// Isometries conserve angles and distances, hence do not allow shearing nor scaling. /// Isometries conserve angles and distances, hence do not allow shearing nor scaling.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Debug, Copy)]
pub struct Iso2<N> { pub struct Iso2<N> {
/// The rotation applicable by this isometry. /// The rotation applicable by this isometry.
pub rotation: Rot2<N>, pub rotation: Rot2<N>,
@ -38,7 +40,9 @@ pub struct Iso2<N> {
/// This is the composition of a rotation followed by a translation. /// This is the composition of a rotation followed by a translation.
/// Isometries conserve angles and distances, hence do not allow shearing nor scaling. /// Isometries conserve angles and distances, hence do not allow shearing nor scaling.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Debug, Copy)]
pub struct Iso3<N> { pub struct Iso3<N> {
/// The rotation applicable by this isometry. /// The rotation applicable by this isometry.
pub rotation: Rot3<N>, pub rotation: Rot3<N>,
@ -50,7 +54,9 @@ pub struct Iso3<N> {
/// ///
/// Isometries conserve angles and distances, hence do not allow shearing nor scaling. /// Isometries conserve angles and distances, hence do not allow shearing nor scaling.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Debug, Copy)]
pub struct Iso4<N> { pub struct Iso4<N> {
/// The rotation applicable by this isometry. /// The rotation applicable by this isometry.
pub rotation: Rot4<N>, pub rotation: Rot4<N>,

View File

@ -23,7 +23,9 @@ use quickcheck::{Arbitrary, Gen};
/// Special identity matrix. All its operation are no-ops. /// Special identity matrix. All its operation are no-ops.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Debug, Copy)]
pub struct Identity; pub struct Identity;
impl Identity { impl Identity {
@ -36,7 +38,9 @@ impl Identity {
/// Square matrix of dimension 1. /// Square matrix of dimension 1.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct Mat1<N> { pub struct Mat1<N> {
pub m11: N pub m11: N
} }
@ -84,7 +88,9 @@ rand_impl!(Mat1, m11);
/// Square matrix of dimension 2. /// Square matrix of dimension 2.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct Mat2<N> { pub struct Mat2<N> {
pub m11: N, pub m21: N, pub m11: N, pub m21: N,
pub m12: N, pub m22: N pub m12: N, pub m22: N
@ -137,7 +143,9 @@ rand_impl!(Mat2, m11, m12, m21, m22);
/// Square matrix of dimension 3. /// Square matrix of dimension 3.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct Mat3<N> { pub struct Mat3<N> {
pub m11: N, pub m21: N, pub m31: N, pub m11: N, pub m21: N, pub m31: N,
pub m12: N, pub m22: N, pub m32: N, pub m12: N, pub m22: N, pub m32: N,
@ -233,7 +241,9 @@ rand_impl!(Mat3,
/// Square matrix of dimension 4. /// Square matrix of dimension 4.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct Mat4<N> { pub struct Mat4<N> {
pub m11: N, pub m21: N, pub m31: N, pub m41: N, pub m11: N, pub m21: N, pub m31: N, pub m41: N,
pub m12: N, pub m22: N, pub m32: N, pub m42: N, pub m12: N, pub m22: N, pub m32: N, pub m42: N,
@ -352,7 +362,9 @@ rand_impl!(Mat4,
/// Square matrix of dimension 5. /// Square matrix of dimension 5.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct Mat5<N> { pub struct Mat5<N> {
pub m11: N, pub m21: N, pub m31: N, pub m41: N, pub m51: N, 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, pub m12: N, pub m22: N, pub m32: N, pub m42: N, pub m52: N,
@ -488,7 +500,9 @@ rand_impl!(Mat5,
/// Square matrix of dimension 6. /// Square matrix of dimension 6.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct Mat6<N> { pub struct Mat6<N> {
pub m11: N, pub m21: N, pub m31: N, pub m41: N, pub m51: N, pub m61: N, 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, pub m12: N, pub m22: N, pub m32: N, pub m42: N, pub m52: N, pub m62: N,

View File

@ -8,7 +8,9 @@ use quickcheck::{Arbitrary, Gen};
/// A 3D orthographic projection stored without any matrix. /// A 3D orthographic projection stored without any matrix.
/// ///
/// Reading or modifying its individual properties is cheap but applying the transformation is costly. /// Reading or modifying its individual properties is cheap but applying the transformation is costly.
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Debug, Copy)]
pub struct Ortho3<N> { pub struct Ortho3<N> {
width: N, width: N,
height: N, height: N,
@ -19,7 +21,9 @@ pub struct Ortho3<N> {
/// A 3D orthographic projection stored as a 4D matrix. /// A 3D orthographic projection stored as a 4D matrix.
/// ///
/// Reading or modifying its individual properties is costly but applying the transformation is cheap. /// Reading or modifying its individual properties is costly but applying the transformation is cheap.
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Debug, Copy)]
pub struct OrthoMat3<N> { pub struct OrthoMat3<N> {
mat: Mat4<N> mat: Mat4<N>
} }

View File

@ -8,7 +8,9 @@ use quickcheck::{Arbitrary, Gen};
/// A 3D perspective projection stored without any matrix. /// A 3D perspective projection stored without any matrix.
/// ///
/// Reading or modifying its individual properties is cheap but applying the transformation is costly. /// Reading or modifying its individual properties is cheap but applying the transformation is costly.
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Debug, Copy)]
pub struct Persp3<N> { pub struct Persp3<N> {
aspect: N, aspect: N,
fov: N, fov: N,
@ -19,7 +21,9 @@ pub struct Persp3<N> {
/// A 3D perspective projection stored as a 4D matrix. /// A 3D perspective projection stored as a 4D matrix.
/// ///
/// Reading or modifying its individual properties is costly but applying the transformation is cheap. /// Reading or modifying its individual properties is costly but applying the transformation is cheap.
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Debug, Copy)]
pub struct PerspMat3<N> { pub struct PerspMat3<N> {
mat: Mat4<N> mat: Mat4<N>
} }

View File

@ -40,7 +40,9 @@ impl<N> Repeat<N> for Pnt0<N> {
/// Point of dimension 1. /// Point of dimension 1.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct Pnt1<N> { pub struct Pnt1<N> {
/// First component of the point. /// First component of the point.
pub x: N pub x: N
@ -80,7 +82,9 @@ rand_impl!(Pnt1, x);
/// Point of dimension 2. /// Point of dimension 2.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct Pnt2<N> { pub struct Pnt2<N> {
/// First component of the point. /// First component of the point.
pub x: N, pub x: N,
@ -122,7 +126,9 @@ rand_impl!(Pnt2, x, y);
/// Point of dimension 3. /// Point of dimension 3.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct Pnt3<N> { pub struct Pnt3<N> {
/// First component of the point. /// First component of the point.
pub x: N, pub x: N,
@ -166,7 +172,9 @@ rand_impl!(Pnt3, x, y, z);
/// Point of dimension 4. /// Point of dimension 4.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct Pnt4<N> { pub struct Pnt4<N> {
/// First component of the point. /// First component of the point.
pub x: N, pub x: N,
@ -212,7 +220,9 @@ rand_impl!(Pnt4, x, y, z, w);
/// Point of dimension 5. /// Point of dimension 5.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct Pnt5<N> { pub struct Pnt5<N> {
/// First component of the point. /// First component of the point.
pub x: N, pub x: N,
@ -260,7 +270,9 @@ rand_impl!(Pnt5, x, y, z, w, a);
/// Point of dimension 6. /// Point of dimension 6.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct Pnt6<N> { pub struct Pnt6<N> {
/// First component of the point. /// First component of the point.
pub x: N, pub x: N,

View File

@ -20,7 +20,9 @@ use quickcheck::{Arbitrary, Gen};
/// A quaternion. /// A quaternion.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct Quat<N> { pub struct Quat<N> {
/// The scalar component of the quaternion. /// The scalar component of the quaternion.
pub w: N, pub w: N,
@ -159,7 +161,9 @@ impl<N: ApproxEq<N> + BaseFloat> Div<Quat<N>> for Quat<N> {
/// A unit quaternion that can represent a 3D rotation. /// A unit quaternion that can represent a 3D rotation.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct UnitQuat<N> { pub struct UnitQuat<N> {
q: Quat<N> q: Quat<N>
} }

View File

@ -18,7 +18,9 @@ use quickcheck::{Arbitrary, Gen};
/// Two dimensional rotation matrix. /// Two dimensional rotation matrix.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Debug, Hash, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Debug, Hash, Copy)]
pub struct Rot2<N> { pub struct Rot2<N> {
submat: Mat2<N> submat: Mat2<N>
} }
@ -119,7 +121,9 @@ impl<N: Arbitrary + Clone + BaseFloat + Neg<Output = N>> Arbitrary for Rot2<N> {
*/ */
/// Three dimensional rotation matrix. /// Three dimensional rotation matrix.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Debug, Hash, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Debug, Hash, Copy)]
pub struct Rot3<N> { pub struct Rot3<N> {
submat: Mat3<N> submat: Mat3<N>
} }
@ -341,7 +345,9 @@ impl<N: Arbitrary + Clone + BaseFloat> Arbitrary for Rot3<N> {
/// Four dimensional rotation matrix. /// Four dimensional rotation matrix.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Debug, Hash, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Debug, Hash, Copy)]
pub struct Rot4<N> { pub struct Rot4<N> {
submat: Mat4<N> submat: Mat4<N>
} }

View File

@ -42,7 +42,9 @@ impl<N> Repeat<N> for Vec0<N> {
/// Vector of dimension 1. /// Vector of dimension 1.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct Vec1<N> { pub struct Vec1<N> {
/// First component of the vector. /// First component of the vector.
pub x: N pub x: N
@ -93,7 +95,9 @@ rand_impl!(Vec1, x);
/// Vector of dimension 2. /// Vector of dimension 2.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct Vec2<N> { pub struct Vec2<N> {
/// First component of the vector. /// First component of the vector.
pub x: N, pub x: N,
@ -146,7 +150,9 @@ rand_impl!(Vec2, x, y);
/// Vector of dimension 3. /// Vector of dimension 3.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct Vec3<N> { pub struct Vec3<N> {
/// First component of the vector. /// First component of the vector.
pub x: N, pub x: N,
@ -202,7 +208,9 @@ rand_impl!(Vec3, x, y, z);
/// Vector of dimension 4. /// Vector of dimension 4.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct Vec4<N> { pub struct Vec4<N> {
/// First component of the vector. /// First component of the vector.
pub x: N, pub x: N,
@ -259,7 +267,9 @@ rand_impl!(Vec4, x, y, z, w);
/// Vector of dimension 5. /// Vector of dimension 5.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct Vec5<N> { pub struct Vec5<N> {
/// First component of the vector. /// First component of the vector.
pub x: N, pub x: N,
@ -318,7 +328,9 @@ rand_impl!(Vec5, x, y, z, w, a);
/// Vector of dimension 6. /// Vector of dimension 6.
#[repr(C)] #[repr(C)]
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)]
pub struct Vec6<N> { pub struct Vec6<N> {
/// First component of the vector. /// First component of the vector.
pub x: N, pub x: N,

View File

@ -5,7 +5,9 @@ use std::cmp::Ordering;
use traits::structure::SquareMat; use traits::structure::SquareMat;
/// Result of a partial ordering. /// Result of a partial ordering.
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Debug, Copy)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Debug, Copy)]
pub enum POrdering { pub enum POrdering {
/// Result of a strict comparison. /// Result of a strict comparison.
PartialLess, PartialLess,