diff --git a/.travis.yml b/.travis.yml index 3654683..99d2910 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,14 +9,14 @@ cache: cargo env: - CARGO_FEATURES="" - - CARGO_FEATURES="eders" + - CARGO_FEATURES="serde" matrix: include: - rust: nightly env: CARGO_FEATURES="simd" - rust: nightly - env: CARGO_FEATURES="eders simd" + env: CARGO_FEATURES="serde simd" script: - cargo build --features "$CARGO_FEATURES" diff --git a/Cargo.toml b/Cargo.toml index 28b3783..9ae5550 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cgmath" -version = "0.14.1" +version = "0.15.0" authors = ["Brendan Zabarauskas "] license = "Apache-2.0" description = "A linear algebra and mathematics library for computer graphics." @@ -18,14 +18,12 @@ name = "cgmath" [features] unstable = [] -eders = ["serde", "serde_derive"] [dependencies] approx = "0.1" num-traits = "0.1" rand = "0.3" -serde = { version = "1.0", optional = true } -serde_derive = { version = "1.0", optional = true } +serde = { version = "1.0", features = ["serde_derive"], optional = true } simd = { version = "0.2", optional = true } [dev-dependencies] diff --git a/src/angle.rs b/src/angle.rs index fd02f61..922ee24 100644 --- a/src/angle.rs +++ b/src/angle.rs @@ -34,7 +34,7 @@ use num::BaseFloat; /// This type is marked as `#[repr(C)]`. #[repr(C)] #[derive(Copy, Clone, PartialEq, PartialOrd)] -#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Rad(pub S); /// An angle, in degrees. @@ -42,7 +42,7 @@ pub struct Rad(pub S); /// This type is marked as `#[repr(C)]`. #[repr(C)] #[derive(Copy, Clone, PartialEq, PartialOrd)] -#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Deg(pub S); impl From> for Deg where S: BaseFloat { diff --git a/src/euler.rs b/src/euler.rs index 8c8bfaa..5fd83e2 100644 --- a/src/euler.rs +++ b/src/euler.rs @@ -75,7 +75,7 @@ use num::BaseFloat; #[repr(C)] #[derive(Copy, Clone, Debug)] #[derive(PartialEq, Eq)] -#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Euler { /// The angle to apply around the _x_ axis. Also known at the _pitch_. pub x: A, diff --git a/src/lib.rs b/src/lib.rs index 75a8e3d..a9b1b0d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -57,10 +57,8 @@ extern crate approx; pub extern crate num_traits; extern crate rand; -#[cfg(feature = "eders")] +#[cfg(feature = "serde")] #[macro_use] -extern crate serde_derive; -#[cfg(feature = "eders")] extern crate serde; #[cfg(feature = "simd")] diff --git a/src/matrix.rs b/src/matrix.rs index 6e199f7..713edca 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -37,7 +37,7 @@ use vector::{Vector2, Vector3, Vector4}; /// This type is marked as `#[repr(C)]`. #[repr(C)] #[derive(Copy, Clone, PartialEq)] -#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Matrix2 { /// The first column of the matrix. pub x: Vector2, @@ -50,7 +50,7 @@ pub struct Matrix2 { /// This type is marked as `#[repr(C)]`. #[repr(C)] #[derive(Copy, Clone, PartialEq)] -#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Matrix3 { /// The first column of the matrix. pub x: Vector3, @@ -65,7 +65,7 @@ pub struct Matrix3 { /// This type is marked as `#[repr(C)]`. #[repr(C)] #[derive(Copy, Clone, PartialEq)] -#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Matrix4 { /// The first column of the matrix. pub x: Vector4, diff --git a/src/point.rs b/src/point.rs index 8fdb58e..8b08d59 100644 --- a/src/point.rs +++ b/src/point.rs @@ -33,7 +33,7 @@ use vector::{Vector1, Vector2, Vector3, Vector4}; /// This type is marked as `#[repr(C)]`. #[repr(C)] #[derive(PartialEq, Eq, Copy, Clone, Hash)] -#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Point1 { pub x: S, } @@ -43,7 +43,7 @@ pub struct Point1 { /// This type is marked as `#[repr(C)]`. #[repr(C)] #[derive(PartialEq, Eq, Copy, Clone, Hash)] -#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Point2 { pub x: S, pub y: S, @@ -54,7 +54,7 @@ pub struct Point2 { /// This type is marked as `#[repr(C)]`. #[repr(C)] #[derive(PartialEq, Eq, Copy, Clone, Hash)] -#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Point3 { pub x: S, pub y: S, diff --git a/src/projection.rs b/src/projection.rs index ad24e83..d30a189 100644 --- a/src/projection.rs +++ b/src/projection.rs @@ -68,7 +68,7 @@ pub fn ortho(left: S, right: S, bottom: S, top: S, near: S, far: S /// A perspective projection based on a vertical field-of-view angle. #[derive(Copy, Clone, Debug, PartialEq)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] -#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct PerspectiveFov { pub fovy: Rad, pub aspect: S, @@ -135,7 +135,7 @@ impl From> for Matrix4 { /// A perspective projection with arbitrary left/right/bottom/top distances #[derive(Copy, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Perspective { pub left: S, pub right: S, @@ -182,7 +182,7 @@ impl From> for Matrix4 { /// An orthographic projection with arbitrary left/right/bottom/top distances #[derive(Copy, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Ortho { pub left: S, pub right: S, diff --git a/src/quaternion.rs b/src/quaternion.rs index 17906e9..599756d 100644 --- a/src/quaternion.rs +++ b/src/quaternion.rs @@ -40,7 +40,7 @@ use simd::f32x4 as Simdf32x4; /// This type is marked as `#[repr(C)]`. #[repr(C)] #[derive(Copy, Clone, Debug, PartialEq)] -#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Quaternion { /// The scalar part of the quaternion. pub s: S, diff --git a/src/rotation.rs b/src/rotation.rs index 536323a..9e0fe8a 100644 --- a/src/rotation.rs +++ b/src/rotation.rs @@ -142,7 +142,7 @@ pub trait Rotation3: Rotation> /// // assert_ulps_eq!(&unit_y3, &unit_y2); // TODO: Figure out how to use this /// ``` #[derive(PartialEq, Copy, Clone)] -#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Basis2 { mat: Matrix2 } @@ -249,7 +249,7 @@ impl fmt::Debug for Basis2 { /// `math::Matrix3`. To ensure orthogonality is maintained, the operations have /// been restricted to a subset of those implemented on `Matrix3`. #[derive(PartialEq, Copy, Clone)] -#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Basis3 { mat: Matrix3 } diff --git a/src/transform.rs b/src/transform.rs index ddf1c56..f995cc7 100644 --- a/src/transform.rs +++ b/src/transform.rs @@ -184,9 +184,9 @@ impl ApproxEq for Decomposed } } -#[cfg(feature = "eders")] +#[cfg(feature = "serde")] #[doc(hidden)] -mod eders_ser { +mod serde_ser { use structure::VectorSpace; use super::Decomposed; use serde::{self, Serialize}; @@ -209,9 +209,9 @@ mod eders_ser { } } -#[cfg(feature = "eders")] +#[cfg(feature = "serde")] #[doc(hidden)] -mod eders_de { +mod serde_de { use structure::VectorSpace; use super::Decomposed; use serde::{self, Deserialize}; diff --git a/src/vector.rs b/src/vector.rs index f5ba358..412fc43 100644 --- a/src/vector.rs +++ b/src/vector.rs @@ -38,7 +38,7 @@ use simd::u32x4 as Simdu32x4; /// This type is marked as `#[repr(C)]`. #[repr(C)] #[derive(PartialEq, Eq, Copy, Clone, Hash)] -#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Vector1 { /// The x component of the vector. pub x: S, @@ -49,7 +49,7 @@ pub struct Vector1 { /// This type is marked as `#[repr(C)]`. #[repr(C)] #[derive(PartialEq, Eq, Copy, Clone, Hash)] -#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Vector2 { /// The x component of the vector. pub x: S, @@ -62,7 +62,7 @@ pub struct Vector2 { /// This type is marked as `#[repr(C)]`. #[repr(C)] #[derive(PartialEq, Eq, Copy, Clone, Hash)] -#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Vector3 { /// The x component of the vector. pub x: S, @@ -77,7 +77,7 @@ pub struct Vector3 { /// This type is marked as `#[repr(C)]`. #[repr(C)] #[derive(PartialEq, Eq, Copy, Clone, Hash)] -#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Vector4 { /// The x component of the vector. pub x: S, diff --git a/tests/transform.rs b/tests/transform.rs index 0c1cfbf..b1362a3 100644 --- a/tests/transform.rs +++ b/tests/transform.rs @@ -17,7 +17,7 @@ extern crate approx; extern crate cgmath; -#[cfg(feature = "eders")] +#[cfg(feature = "serde")] extern crate serde_json; use cgmath::*; @@ -46,7 +46,7 @@ fn test_look_at() { assert_ulps_eq!(&t.transform_point(point), &view_point); } -#[cfg(feature = "eders")] +#[cfg(feature = "serde")] #[test] fn test_serialize() { let t = Decomposed {