Merge pull request #59 from bfops/master

Fix Encodable/Decodable deprecation warnings
This commit is contained in:
Sébastien Crozet 2014-12-26 06:46:42 +01:00
commit ec44d197b2
11 changed files with 38 additions and 35 deletions

View File

@ -14,3 +14,6 @@ license = "BSD-3-Clause"
[lib] [lib]
name = "nalgebra" name = "nalgebra"
path = "src/lib.rs" path = "src/lib.rs"
[dependencies]
rustc-serialize = "*"

View File

@ -86,7 +86,7 @@ Feel free to add your project to this list if you happen to use **nalgebra**!
#![feature(globs)] #![feature(globs)]
#![doc(html_root_url = "http://nalgebra.org/doc")] #![doc(html_root_url = "http://nalgebra.org/doc")]
extern crate serialize; extern crate "rustc-serialize" as rustc_serialize;
#[cfg(test)] #[cfg(test)]
extern crate test; extern crate test;

View File

@ -18,7 +18,7 @@ use structs::rot::{Rot2, Rot3, Rot4};
/// ///
/// 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.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Show, 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>,
@ -30,7 +30,7 @@ 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.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Show, 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>,
@ -41,7 +41,7 @@ pub struct Iso3<N> {
/// Four dimensional isometry. /// Four dimensional isometry.
/// ///
/// Isometries conserve angles and distances, hence do not allow shearing nor scaling. /// Isometries conserve angles and distances, hence do not allow shearing nor scaling.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Show, 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

@ -17,7 +17,7 @@ use linalg;
/// Special identity matrix. All its operation are no-ops. /// Special identity matrix. All its operation are no-ops.
#[deriving(Eq, PartialEq, Decodable, Clone, Rand, Show, Copy)] #[deriving(Eq, PartialEq, RustcDecodable, Clone, Rand, Show, Copy)]
pub struct Identity; pub struct Identity;
impl Identity { impl Identity {
@ -29,7 +29,7 @@ impl Identity {
} }
/// Square matrix of dimension 1. /// Square matrix of dimension 1.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Show, Copy)]
pub struct Mat1<N> { pub struct Mat1<N> {
pub m11: N pub m11: N
} }
@ -73,7 +73,7 @@ outer_impl!(Vec1, Mat1);
eigen_qr_impl!(Mat1, Vec1); eigen_qr_impl!(Mat1, Vec1);
/// Square matrix of dimension 2. /// Square matrix of dimension 2.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Show, 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
@ -121,7 +121,7 @@ outer_impl!(Vec2, Mat2);
eigen_qr_impl!(Mat2, Vec2); eigen_qr_impl!(Mat2, Vec2);
/// Square matrix of dimension 3. /// Square matrix of dimension 3.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Show, 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,
@ -203,7 +203,7 @@ outer_impl!(Vec3, Mat3);
eigen_qr_impl!(Mat3, Vec3); eigen_qr_impl!(Mat3, Vec3);
/// Square matrix of dimension 4. /// Square matrix of dimension 4.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Show, 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,
@ -303,7 +303,7 @@ outer_impl!(Vec4, Mat4);
eigen_qr_impl!(Mat4, Vec4); eigen_qr_impl!(Mat4, Vec4);
/// Square matrix of dimension 5. /// Square matrix of dimension 5.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Show, 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,
@ -417,7 +417,7 @@ outer_impl!(Vec5, Mat5);
eigen_qr_impl!(Mat5, Vec5); eigen_qr_impl!(Mat5, Vec5);
/// Square matrix of dimension 6. /// Square matrix of dimension 6.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Show, 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

@ -5,7 +5,7 @@ use structs::{Pnt3, Vec3, Mat4};
/// 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.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Show, Copy)]
pub struct Ortho3<N> { pub struct Ortho3<N> {
width: N, width: N,
height: N, height: N,
@ -16,7 +16,7 @@ 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.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Show, Copy)]
pub struct OrthoMat3<N> { pub struct OrthoMat3<N> {
mat: Mat4<N> mat: Mat4<N>
} }

View File

@ -4,7 +4,7 @@ use structs::{Pnt3, Vec3, Mat4};
/// 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.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Show, Copy)]
pub struct Persp3<N> { pub struct Persp3<N> {
aspect: N, aspect: N,
fov: N, fov: N,
@ -15,7 +15,7 @@ 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.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Show, Copy)]
pub struct PerspMat3<N> { pub struct PerspMat3<N> {
mat: Mat4<N> mat: Mat4<N>
} }

View File

@ -14,7 +14,7 @@ use structs::vec::{Vec1, Vec2, Vec3, Vec4, Vec5, Vec6};
/// Point of dimension 0. /// Point of dimension 0.
#[deriving(Eq, PartialEq, Decodable, Clone, Rand, Show, Copy)] #[deriving(Eq, PartialEq, RustcDecodable, Clone, Rand, Show, Copy)]
pub struct Pnt0<N>; pub struct Pnt0<N>;
impl<N> Pnt0<N> { impl<N> Pnt0<N> {
@ -32,7 +32,7 @@ impl<N> Pnt0<N> {
} }
/// Point of dimension 1. /// Point of dimension 1.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Show, 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
@ -70,7 +70,7 @@ pnt_from_homogeneous_impl!(Pnt1, Pnt2, y, x);
num_float_pnt_impl!(Pnt1, Vec1); num_float_pnt_impl!(Pnt1, Vec1);
/// Point of dimension 2. /// Point of dimension 2.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Show, 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,
@ -110,7 +110,7 @@ pnt_from_homogeneous_impl!(Pnt2, Pnt3, z, x, y);
num_float_pnt_impl!(Pnt2, Vec2); num_float_pnt_impl!(Pnt2, Vec2);
/// Point of dimension 3. /// Point of dimension 3.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Show, 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,
@ -152,7 +152,7 @@ pnt_from_homogeneous_impl!(Pnt3, Pnt4, w, x, y, z);
num_float_pnt_impl!(Pnt3, Vec3); num_float_pnt_impl!(Pnt3, Vec3);
/// Point of dimension 4. /// Point of dimension 4.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Show, 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,
@ -196,7 +196,7 @@ pnt_from_homogeneous_impl!(Pnt4, Pnt5, a, x, y, z, w);
num_float_pnt_impl!(Pnt4, Vec4); num_float_pnt_impl!(Pnt4, Vec4);
/// Point of dimension 5. /// Point of dimension 5.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Show, 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,
@ -242,7 +242,7 @@ pnt_from_homogeneous_impl!(Pnt5, Pnt6, b, x, y, z, w, a);
num_float_pnt_impl!(Pnt5, Vec5); num_float_pnt_impl!(Pnt5, Vec5);
/// Point of dimension 6. /// Point of dimension 6.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Show, 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

@ -14,7 +14,7 @@ use traits::structure::{Cast, Indexable, Iterable, IterableMut, Dim, Shape, Base
use traits::geometry::{Norm, Rotation, Rotate, Transform}; use traits::geometry::{Norm, Rotation, Rotate, Transform};
/// A quaternion. /// A quaternion.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Show, 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,
@ -140,7 +140,7 @@ impl<N: ApproxEq<N> + BaseFloat> Div<Quat<N>, Quat<N>> for Quat<N> {
} }
/// A unit quaternion that can represent a 3D rotation. /// A unit quaternion that can represent a 3D rotation.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Show, Copy)]
pub struct UnitQuat<N> { pub struct UnitQuat<N> {
q: Quat<N> q: Quat<N>
} }

View File

@ -13,7 +13,7 @@ use structs::mat::{Mat2, Mat3, Mat4, Mat5};
/// Two dimensional rotation matrix. /// Two dimensional rotation matrix.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Show, Hash, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Show, Hash, Copy)]
pub struct Rot2<N> { pub struct Rot2<N> {
submat: Mat2<N> submat: Mat2<N>
} }
@ -90,7 +90,7 @@ impl<N: BaseFloat> AbsoluteRotate<Vec2<N>> for Rot2<N> {
* 3d rotation * 3d rotation
*/ */
/// Three dimensional rotation matrix. /// Three dimensional rotation matrix.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Show, Hash, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Show, Hash, Copy)]
pub struct Rot3<N> { pub struct Rot3<N> {
submat: Mat3<N> submat: Mat3<N>
} }
@ -288,7 +288,7 @@ impl<N: BaseFloat> AbsoluteRotate<Vec3<N>> for Rot3<N> {
} }
/// Four dimensional rotation matrix. /// Four dimensional rotation matrix.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Show, Hash, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Show, Hash, Copy)]
pub struct Rot4<N> { pub struct Rot4<N> {
submat: Mat4<N> submat: Mat4<N>
} }

View File

@ -15,7 +15,7 @@ use structs::pnt::{Pnt1, Pnt2, Pnt3, Pnt4, Pnt5, Pnt6};
/// Vector of dimension 0. /// Vector of dimension 0.
#[deriving(Eq, PartialEq, Decodable, Clone, Rand, Zero, Show, Copy)] #[deriving(Eq, PartialEq, RustcDecodable, Clone, Rand, Zero, Show, Copy)]
pub struct Vec0<N>; pub struct Vec0<N>;
impl<N> Vec0<N> { impl<N> Vec0<N> {
@ -33,7 +33,7 @@ impl<N> Vec0<N> {
} }
/// Vector of dimension 1. /// Vector of dimension 1.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Show, 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
@ -82,7 +82,7 @@ num_float_vec_impl!(Vec1);
absolute_vec_impl!(Vec1, x); absolute_vec_impl!(Vec1, x);
/// Vector of dimension 2. /// Vector of dimension 2.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Zero, Show, 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,
@ -133,7 +133,7 @@ num_float_vec_impl!(Vec2);
absolute_vec_impl!(Vec2, x, y); absolute_vec_impl!(Vec2, x, y);
/// Vector of dimension 3. /// Vector of dimension 3.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Zero, Show, 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,
@ -187,7 +187,7 @@ absolute_vec_impl!(Vec3, x, y, z);
/// Vector of dimension 4. /// Vector of dimension 4.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Zero, Show, 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,
@ -242,7 +242,7 @@ num_float_vec_impl!(Vec4);
absolute_vec_impl!(Vec4, x, y, z, w); absolute_vec_impl!(Vec4, x, y, z, w);
/// Vector of dimension 5. /// Vector of dimension 5.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Zero, Show, 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,
@ -299,7 +299,7 @@ num_float_vec_impl!(Vec5);
absolute_vec_impl!(Vec5, x, y, z, w, a); absolute_vec_impl!(Vec5, x, y, z, w, a);
/// Vector of dimension 6. /// Vector of dimension 6.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Zero, Show, 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

@ -4,7 +4,7 @@ use std::num::{Float, SignedInt};
use traits::structure::SquareMat; use traits::structure::SquareMat;
/// Result of a partial ordering. /// Result of a partial ordering.
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Show, Copy)] #[deriving(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Show, Copy)]
pub enum POrdering { pub enum POrdering {
/// Result of a strict comparison. /// Result of a strict comparison.
PartialLess, PartialLess,