Skip to content

Fix compilation errors when the serde-serialize feature is enabled. #387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions nalgebra-lapack/src/cholesky.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[cfg(feature = "serde-serialize")]
use serde;
use serde::{Serialize, Deserialize};

use num::Zero;
use num_complex::Complex;
Expand All @@ -18,7 +18,7 @@ use lapack;
serde(
bound(
serialize = "DefaultAllocator: Allocator<N, D>,
MatrixN<N, D>: serde::Serialize"
MatrixN<N, D>: Serialize"
)
)
)]
Expand All @@ -27,7 +27,7 @@ use lapack;
serde(
bound(
deserialize = "DefaultAllocator: Allocator<N, D>,
MatrixN<N, D>: serde::Deserialize<'de>"
MatrixN<N, D>: Deserialize<'de>"
)
)
)]
Expand Down
10 changes: 5 additions & 5 deletions nalgebra-lapack/src/eigen.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[cfg(feature = "serde-serialize")]
use serde;
use serde::{Serialize, Deserialize};

use num::Zero;
use num_complex::Complex;
Expand All @@ -21,8 +21,8 @@ use lapack;
serde(
bound(
serialize = "DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>,
VectorN<N, D>: serde::Serialize,
MatrixN<N, D>: serde::Serialize"
VectorN<N, D>: Serialize,
MatrixN<N, D>: Serialize"
)
)
)]
Expand All @@ -31,8 +31,8 @@ use lapack;
serde(
bound(
deserialize = "DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>,
VectorN<N, D>: serde::Serialize,
MatrixN<N, D>: serde::Deserialize<'de>"
VectorN<N, D>: Serialize,
MatrixN<N, D>: Deserialize<'de>"
)
)
)]
Expand Down
8 changes: 4 additions & 4 deletions nalgebra-lapack/src/hessenberg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use lapack;
bound(
serialize = "DefaultAllocator: Allocator<N, D, D> +
Allocator<N, DimDiff<D, U1>>,
MatrixN<N, D>: serde::Serialize,
VectorN<N, DimDiff<D, U1>>: serde::Serialize"
MatrixN<N, D>: Serialize,
VectorN<N, DimDiff<D, U1>>: Serialize"
)
)
)]
Expand All @@ -28,8 +28,8 @@ use lapack;
bound(
deserialize = "DefaultAllocator: Allocator<N, D, D> +
Allocator<N, DimDiff<D, U1>>,
MatrixN<N, D>: serde::Deserialize<'de>,
VectorN<N, DimDiff<D, U1>>: serde::Deserialize<'de>"
MatrixN<N, D>: Deserialize<'de>,
VectorN<N, DimDiff<D, U1>>: Deserialize<'de>"
)
)
)]
Expand Down
8 changes: 4 additions & 4 deletions nalgebra-lapack/src/lu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ use lapack;
bound(
serialize = "DefaultAllocator: Allocator<N, R, C> +
Allocator<i32, DimMinimum<R, C>>,
MatrixMN<N, R, C>: serde::Serialize,
PermutationSequence<DimMinimum<R, C>>: serde::Serialize"
MatrixMN<N, R, C>: Serialize,
PermutationSequence<DimMinimum<R, C>>: Serialize"
)
)
)]
Expand All @@ -35,8 +35,8 @@ use lapack;
bound(
deserialize = "DefaultAllocator: Allocator<N, R, C> +
Allocator<i32, DimMinimum<R, C>>,
MatrixMN<N, R, C>: serde::Deserialize<'de>,
PermutationSequence<DimMinimum<R, C>>: serde::Deserialize<'de>"
MatrixMN<N, R, C>: Deserialize<'de>,
PermutationSequence<DimMinimum<R, C>>: Deserialize<'de>"
)
)
)]
Expand Down
10 changes: 5 additions & 5 deletions nalgebra-lapack/src/qr.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[cfg(feature = "serde-serialize")]
use serde;
use serde::{Serialize, Deserialize};

use num::Zero;
use num_complex::Complex;
Expand All @@ -20,8 +20,8 @@ use lapack;
bound(
serialize = "DefaultAllocator: Allocator<N, R, C> +
Allocator<N, DimMinimum<R, C>>,
MatrixMN<N, R, C>: serde::Serialize,
VectorN<N, DimMinimum<R, C>>: serde::Serialize"
MatrixMN<N, R, C>: Serialize,
VectorN<N, DimMinimum<R, C>>: Serialize"
)
)
)]
Expand All @@ -31,8 +31,8 @@ use lapack;
bound(
deserialize = "DefaultAllocator: Allocator<N, R, C> +
Allocator<N, DimMinimum<R, C>>,
MatrixMN<N, R, C>: serde::Deserialize<'de>,
VectorN<N, DimMinimum<R, C>>: serde::Deserialize<'de>"
MatrixMN<N, R, C>: Deserialize<'de>,
VectorN<N, DimMinimum<R, C>>: Deserialize<'de>"
)
)
)]
Expand Down
10 changes: 5 additions & 5 deletions nalgebra-lapack/src/schur.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[cfg(feature = "serde-serialize")]
use serde;
use serde::{Serialize, Deserialize};

use num::Zero;
use num_complex::Complex;
Expand All @@ -21,8 +21,8 @@ use lapack;
serde(
bound(
serialize = "DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>,
VectorN<N, D>: serde::Serialize,
MatrixN<N, D>: serde::Serialize"
VectorN<N, D>: Serialize,
MatrixN<N, D>: Serialize"
)
)
)]
Expand All @@ -31,8 +31,8 @@ use lapack;
serde(
bound(
deserialize = "DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>,
VectorN<N, D>: serde::Serialize,
MatrixN<N, D>: serde::Deserialize<'de>"
VectorN<N, D>: Serialize,
MatrixN<N, D>: Deserialize<'de>"
)
)
)]
Expand Down
14 changes: 7 additions & 7 deletions nalgebra-lapack/src/svd.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[cfg(feature = "serde-serialize")]
use serde;
use serde::{Serialize, Deserialize};

use num::Signed;
use std::cmp;
Expand All @@ -20,9 +20,9 @@ use lapack;
serialize = "DefaultAllocator: Allocator<N, DimMinimum<R, C>> +
Allocator<N, R, R> +
Allocator<N, C, C>,
MatrixN<N, R>: serde::Serialize,
MatrixN<N, C>: serde::Serialize,
VectorN<N, DimMinimum<R, C>>: serde::Serialize"
MatrixN<N, R>: Serialize,
MatrixN<N, C>: Serialize,
VectorN<N, DimMinimum<R, C>>: Serialize"
)
)
)]
Expand All @@ -33,9 +33,9 @@ use lapack;
serialize = "DefaultAllocator: Allocator<N, DimMinimum<R, C>> +
Allocator<N, R, R> +
Allocator<N, C, C>,
MatrixN<N, R>: serde::Deserialize<'de>,
MatrixN<N, C>: serde::Deserialize<'de>,
VectorN<N, DimMinimum<R, C>>: serde::Deserialize<'de>"
MatrixN<N, R>: Deserialize<'de>,
MatrixN<N, C>: Deserialize<'de>,
VectorN<N, DimMinimum<R, C>>: Deserialize<'de>"
)
)
)]
Expand Down
10 changes: 5 additions & 5 deletions nalgebra-lapack/src/symmetric_eigen.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[cfg(feature = "serde-serialize")]
use serde;
use serde::{Serialize, Deserialize};

use num::Zero;
use std::ops::MulAssign;
Expand All @@ -22,8 +22,8 @@ use lapack;
bound(
serialize = "DefaultAllocator: Allocator<N, D, D> +
Allocator<N, D>,
VectorN<N, D>: serde::Serialize,
MatrixN<N, D>: serde::Serialize"
VectorN<N, D>: Serialize,
MatrixN<N, D>: Serialize"
)
)
)]
Expand All @@ -33,8 +33,8 @@ use lapack;
bound(
deserialize = "DefaultAllocator: Allocator<N, D, D> +
Allocator<N, D>,
VectorN<N, D>: serde::Deserialize<'de>,
MatrixN<N, D>: serde::Deserialize<'de>"
VectorN<N, D>: Deserialize<'de>,
MatrixN<N, D>: Deserialize<'de>"
)
)
)]
Expand Down
10 changes: 5 additions & 5 deletions src/geometry/isometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::io::{Result as IOResult, Write};
use std::marker::PhantomData;

#[cfg(feature = "serde-serialize")]
use serde;
use serde::{Serialize, Deserialize};

#[cfg(feature = "abomonation-serialize")]
use abomonation::Abomonation;
Expand All @@ -28,19 +28,19 @@ use geometry::{Point, Translation};
feature = "serde-serialize",
serde(
bound(
serialize = "R: serde::Serialize,
serialize = "R: Serialize,
DefaultAllocator: Allocator<N, D>,
Owned<N, D>: serde::Serialize"
Owned<N, D>: Serialize"
)
)
)]
#[cfg_attr(
feature = "serde-serialize",
serde(
bound(
deserialize = "R: serde::Deserialize<'de>,
deserialize = "R: Deserialize<'de>,
DefaultAllocator: Allocator<N, D>,
Owned<N, D>: serde::Deserialize<'de>"
Owned<N, D>: Deserialize<'de>"
)
)
)]
Expand Down
10 changes: 5 additions & 5 deletions src/geometry/orthographic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use quickcheck::{Arbitrary, Gen};
use rand::distributions::{Distribution, Standard};
use rand::Rng;
#[cfg(feature = "serde-serialize")]
use serde;
use serde::{Serialize, Deserialize, Serializer, Deserializer};
use std::fmt;

use alga::general::Real;
Expand Down Expand Up @@ -43,20 +43,20 @@ impl<N: Real> PartialEq for Orthographic3<N> {
}

#[cfg(feature = "serde-serialize")]
impl<N: Real + serde::Serialize> serde::Serialize for Orthographic3<N> {
impl<N: Real + Serialize> Serialize for Orthographic3<N> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
S: Serializer,
{
self.matrix.serialize(serializer)
}
}

#[cfg(feature = "serde-serialize")]
impl<'a, N: Real + serde::Deserialize<'a>> serde::Deserialize<'a> for Orthographic3<N> {
impl<'a, N: Real + Deserialize<'a>> Deserialize<'a> for Orthographic3<N> {
fn deserialize<Des>(deserializer: Des) -> Result<Self, Des::Error>
where
Des: serde::Deserializer<'a>,
Des: Deserializer<'a>,
{
let matrix = Matrix4::<N>::deserialize(deserializer)?;

Expand Down
10 changes: 5 additions & 5 deletions src/geometry/perspective.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use rand::distributions::{Distribution, Standard};
use rand::Rng;

#[cfg(feature = "serde-serialize")]
use serde;
use serde::{Serialize, Deserialize, Serializer, Deserializer};
use std::fmt;

use alga::general::Real;
Expand Down Expand Up @@ -44,20 +44,20 @@ impl<N: Real> PartialEq for Perspective3<N> {
}

#[cfg(feature = "serde-serialize")]
impl<N: Real + serde::Serialize> serde::Serialize for Perspective3<N> {
impl<N: Real + Serialize> Serialize for Perspective3<N> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
S: Serializer,
{
self.matrix.serialize(serializer)
}
}

#[cfg(feature = "serde-serialize")]
impl<'a, N: Real + serde::Deserialize<'a>> serde::Deserialize<'a> for Perspective3<N> {
impl<'a, N: Real + Deserialize<'a>> Deserialize<'a> for Perspective3<N> {
fn deserialize<Des>(deserializer: Des) -> Result<Self, Des::Error>
where
Des: serde::Deserializer<'a>,
Des: Deserializer<'a>,
{
let matrix = Matrix4::<N>::deserialize(deserializer)?;

Expand Down
14 changes: 7 additions & 7 deletions src/geometry/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::hash;
use std::io::{Result as IOResult, Write};

#[cfg(feature = "serde-serialize")]
use serde;
use serde::{Serialize, Deserialize, Serializer, Deserializer};

#[cfg(feature = "abomonation-serialize")]
use abomonation::Abomonation;
Expand Down Expand Up @@ -57,28 +57,28 @@ where
}

#[cfg(feature = "serde-serialize")]
impl<N: Scalar, D: DimName> serde::Serialize for Point<N, D>
impl<N: Scalar, D: DimName> Serialize for Point<N, D>
where
DefaultAllocator: Allocator<N, D>,
<DefaultAllocator as Allocator<N, D>>::Buffer: serde::Serialize,
<DefaultAllocator as Allocator<N, D>>::Buffer: Serialize,
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
S: Serializer,
{
self.coords.serialize(serializer)
}
}

#[cfg(feature = "serde-serialize")]
impl<'a, N: Scalar, D: DimName> serde::Deserialize<'a> for Point<N, D>
impl<'a, N: Scalar, D: DimName> Deserialize<'a> for Point<N, D>
where
DefaultAllocator: Allocator<N, D>,
<DefaultAllocator as Allocator<N, D>>::Buffer: serde::Deserialize<'a>,
<DefaultAllocator as Allocator<N, D>>::Buffer: Deserialize<'a>,
{
fn deserialize<Des>(deserializer: Des) -> Result<Self, Des::Error>
where
Des: serde::Deserializer<'a>,
Des: Deserializer<'a>,
{
let coords = VectorN::<N, D>::deserialize(deserializer)?;

Expand Down
Loading