From 95b021dbfbe99c1ce8a3330a4f0162e6c4f7c154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Crozet=20S=C3=A9bastien?= Date: Mon, 12 Apr 2021 12:14:16 +0200 Subject: [PATCH] Don't enable serde by default. Don't enable `serde/std` by default. Add a `serde-serialize-no-std` feature to enable serde without its default features. --- Cargo.toml | 19 ++++++++++--------- nalgebra-glm/Cargo.toml | 8 ++++---- nalgebra-lapack/Cargo.toml | 7 +++---- src/base/array_storage.rs | 20 ++++++++++---------- src/base/coordinates.rs | 2 +- src/base/dimension.rs | 6 +++--- src/base/matrix.rs | 6 +++--- src/base/unit.rs | 6 +++--- src/geometry/dual_quaternion.rs | 6 +++--- src/geometry/isometry.rs | 8 ++++---- src/geometry/orthographic.rs | 6 +++--- src/geometry/perspective.rs | 6 +++--- src/geometry/point.rs | 6 +++--- src/geometry/quaternion.rs | 8 ++++---- src/geometry/rotation.rs | 8 ++++---- src/geometry/similarity.rs | 8 ++++---- src/geometry/transform.rs | 6 +++--- src/geometry/translation.rs | 6 +++--- src/geometry/unit_complex_construction.rs | 2 +- src/lib.rs | 8 ++++---- src/linalg/bidiagonal.rs | 8 ++++---- src/linalg/cholesky.rs | 8 ++++---- src/linalg/col_piv_qr.rs | 8 ++++---- src/linalg/eigen.rs | 8 ++++---- src/linalg/full_piv_lu.rs | 8 ++++---- src/linalg/hessenberg.rs | 8 ++++---- src/linalg/lu.rs | 8 ++++---- src/linalg/permutation_sequence.rs | 8 ++++---- src/linalg/qr.rs | 8 ++++---- src/linalg/schur.rs | 8 ++++---- src/linalg/svd.rs | 8 ++++---- src/linalg/symmetric_eigen.rs | 8 ++++---- src/linalg/symmetric_tridiagonal.rs | 8 ++++---- src/linalg/udu.rs | 8 ++++---- 34 files changed, 132 insertions(+), 132 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 15bf01fb..f2a73636 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,14 +22,14 @@ name = "nalgebra" path = "src/lib.rs" [features] -default = [ "std" ] -std = [ "matrixmultiply", "simba/std", "serde/std" ] -sparse = [ ] -debug = [ "approx/num-complex", "rand" ] -alloc = [ ] -io = [ "pest", "pest_derive" ] +default = [ "std" ] +std = [ "matrixmultiply", "simba/std" ] +sparse = [ ] +debug = [ "approx/num-complex", "rand" ] +alloc = [ ] +io = [ "pest", "pest_derive" ] compare = [ "matrixcompare-core" ] -libm = [ "simba/libm" ] +libm = [ "simba/libm" ] libm-force = [ "simba/libm_force" ] no_unsound_assume_init = [ ] @@ -40,8 +40,9 @@ convert-glam-unchecked = [ "convert-glam" ] # Enable edgy conversions like Mat4 convert-bytemuck = [ "bytemuck" ] # Serialization -serde-serialize = [ "serde", "num-complex/serde" ] -abomonation-serialize = [ "abomonation" ] +serde-serialize-no-std = [ "serde", "num-complex/serde" ] +serde-serialize = [ "serde-serialize-no-std", "serde/std" ] +abomonation-serialize = [ "abomonation" ] # Randomness rand-no-std = [ "rand-package" ] diff --git a/nalgebra-glm/Cargo.toml b/nalgebra-glm/Cargo.toml index 1cfb164d..c67ec9bf 100644 --- a/nalgebra-glm/Cargo.toml +++ b/nalgebra-glm/Cargo.toml @@ -17,10 +17,10 @@ edition = "2018" maintenance = { status = "actively-developed" } [features] -default = [ "std" ] -std = [ "nalgebra/std", "simba/std" ] -arbitrary = [ "nalgebra/arbitrary" ] -serde-serialize = [ "nalgebra/serde-serialize" ] +default = [ "std" ] +std = [ "nalgebra/std", "simba/std" ] +arbitrary = [ "nalgebra/arbitrary" ] +serde-serialize = [ "nalgebra/serde-serialize-no-std" ] abomonation-serialize = [ "nalgebra/abomonation-serialize" ] [dependencies] diff --git a/nalgebra-lapack/Cargo.toml b/nalgebra-lapack/Cargo.toml index 3da66478..fb6516ed 100644 --- a/nalgebra-lapack/Cargo.toml +++ b/nalgebra-lapack/Cargo.toml @@ -17,9 +17,9 @@ edition = "2018" maintenance = { status = "actively-developed" } [features] -serde-serialize = [ "serde", "serde_derive" ] +serde-serialize = [ "serde", "nalgebra/serde-serialize" ] proptest-support = [ "nalgebra/proptest-support" ] -arbitrary = [ "nalgebra/arbitrary" ] +arbitrary = [ "nalgebra/arbitrary" ] # For BLAS/LAPACK default = ["netlib"] @@ -33,8 +33,7 @@ nalgebra = { version = "0.25", path = ".." } num-traits = "0.2" num-complex = { version = "0.3", default-features = false } simba = "0.4" -serde = { version = "1.0", optional = true } -serde_derive = { version = "1.0", optional = true } +serde = { version = "1.0", features = [ "derive" ], optional = true } lapack = { version = "0.17", default-features = false } lapack-src = { version = "0.6", default-features = false } # clippy = "*" diff --git a/src/base/array_storage.rs b/src/base/array_storage.rs index 67384a39..68da4c51 100644 --- a/src/base/array_storage.rs +++ b/src/base/array_storage.rs @@ -4,15 +4,15 @@ use std::fmt::{self, Debug, Formatter}; use std::io::{Result as IOResult, Write}; use std::ops::Mul; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::de::{Error, SeqAccess, Visitor}; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::ser::SerializeSeq; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Deserializer, Serialize, Serializer}; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use std::marker::PhantomData; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use std::mem; #[cfg(feature = "abomonation-serialize")] @@ -173,7 +173,7 @@ where * */ // XXX: open an issue for serde so that it allows the serialization/deserialization of all arrays? -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl Serialize for ArrayStorage where T: Scalar + Serialize, @@ -192,7 +192,7 @@ where } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl<'a, T, const R: usize, const C: usize> Deserialize<'a> for ArrayStorage where T: Scalar + Deserialize<'a>, @@ -205,13 +205,13 @@ where } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] /// A visitor that produces a matrix array. struct ArrayStorageVisitor { marker: PhantomData, } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl ArrayStorageVisitor where T: Scalar, @@ -224,7 +224,7 @@ where } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl<'a, T, const R: usize, const C: usize> Visitor<'a> for ArrayStorageVisitor where T: Scalar + Deserialize<'a>, diff --git a/src/base/coordinates.rs b/src/base/coordinates.rs index 9cf6bd33..bf69b09e 100644 --- a/src/base/coordinates.rs +++ b/src/base/coordinates.rs @@ -23,7 +23,7 @@ macro_rules! coords_impl( /// notation, e.g., `v.x` is the same as `v[0]` for a vector. #[repr(C)] #[derive(Eq, PartialEq, Clone, Hash, Debug, Copy)] - #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] + #[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))] pub struct $T { $(pub $comps: T),* } diff --git a/src/base/dimension.rs b/src/base/dimension.rs index 90a5bdd9..ec70dc4c 100644 --- a/src/base/dimension.rs +++ b/src/base/dimension.rs @@ -8,7 +8,7 @@ use std::fmt::Debug; use std::ops::{Add, Div, Mul, Sub}; use typenum::{self, Diff, Max, Maximum, Min, Minimum, Prod, Quot, Sum, Unsigned}; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Deserializer, Serialize, Serializer}; /// Dim of dynamically-sized algebraic entities. @@ -25,7 +25,7 @@ impl Dynamic { } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl Serialize for Dynamic { fn serialize(&self, serializer: S) -> Result where @@ -35,7 +35,7 @@ impl Serialize for Dynamic { } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl<'de> Deserialize<'de> for Dynamic { fn deserialize(deserializer: D) -> Result where diff --git a/src/base/matrix.rs b/src/base/matrix.rs index bfa2bb35..3b4bc50c 100644 --- a/src/base/matrix.rs +++ b/src/base/matrix.rs @@ -10,7 +10,7 @@ use std::hash::{Hash, Hasher}; use std::marker::PhantomData; use std::mem; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Deserializer, Serialize, Serializer}; #[cfg(feature = "abomonation-serialize")] @@ -213,7 +213,7 @@ where } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl Serialize for Matrix where T: Scalar, @@ -229,7 +229,7 @@ where } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl<'de, T, R, C, S> Deserialize<'de> for Matrix where T: Scalar, diff --git a/src/base/unit.rs b/src/base/unit.rs index 527f7503..c2e60da3 100644 --- a/src/base/unit.rs +++ b/src/base/unit.rs @@ -3,7 +3,7 @@ use std::io::{Result as IOResult, Write}; use std::mem; use std::ops::Deref; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Deserializer, Serialize, Serializer}; #[cfg(feature = "abomonation-serialize")] @@ -36,7 +36,7 @@ unsafe impl bytemuck::Zeroable for Unit where T: bytemuck::Zeroable {} #[cfg(feature = "bytemuck")] unsafe impl bytemuck::Pod for Unit where T: bytemuck::Pod {} -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl Serialize for Unit { fn serialize(&self, serializer: S) -> Result where @@ -46,7 +46,7 @@ impl Serialize for Unit { } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl<'de, T: Deserialize<'de>> Deserialize<'de> for Unit { fn deserialize(deserializer: D) -> Result where diff --git a/src/geometry/dual_quaternion.rs b/src/geometry/dual_quaternion.rs index 471e08bf..b6b127ce 100644 --- a/src/geometry/dual_quaternion.rs +++ b/src/geometry/dual_quaternion.rs @@ -3,7 +3,7 @@ use crate::{ Unit, UnitQuaternion, Vector3, Zero, U8, }; use approx::{AbsDiffEq, RelativeEq, UlpsEq}; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::fmt; @@ -237,7 +237,7 @@ where } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl Serialize for DualQuaternion where T: Serialize, @@ -250,7 +250,7 @@ where } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl<'a, T: SimdRealField> Deserialize<'a> for DualQuaternion where T: Deserialize<'a>, diff --git a/src/geometry/isometry.rs b/src/geometry/isometry.rs index 5d79901f..c5fd844c 100755 --- a/src/geometry/isometry.rs +++ b/src/geometry/isometry.rs @@ -4,7 +4,7 @@ use std::hash; #[cfg(feature = "abomonation-serialize")] use std::io::{Result as IOResult, Write}; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Serialize}; #[cfg(feature = "abomonation-serialize")] @@ -55,15 +55,15 @@ use crate::geometry::{AbstractRotation, Point, Translation}; /// #[repr(C)] #[derive(Debug)] -#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(serialize = "R: Serialize, DefaultAllocator: Allocator>, Owned>: Serialize")) )] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(deserialize = "R: Deserialize<'de>, DefaultAllocator: Allocator>, Owned>: Deserialize<'de>")) diff --git a/src/geometry/orthographic.rs b/src/geometry/orthographic.rs index 255faac1..d6136cec 100644 --- a/src/geometry/orthographic.rs +++ b/src/geometry/orthographic.rs @@ -5,7 +5,7 @@ use rand::{ distributions::{Distribution, Standard}, Rng, }; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::fmt; use std::mem; @@ -45,7 +45,7 @@ impl PartialEq for Orthographic3 { } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl Serialize for Orthographic3 { fn serialize(&self, serializer: S) -> Result where @@ -55,7 +55,7 @@ impl Serialize for Orthographic3 { } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl<'a, T: RealField + Deserialize<'a>> Deserialize<'a> for Orthographic3 { fn deserialize(deserializer: Des) -> Result where diff --git a/src/geometry/perspective.rs b/src/geometry/perspective.rs index e8f582ef..fac8fa99 100644 --- a/src/geometry/perspective.rs +++ b/src/geometry/perspective.rs @@ -6,7 +6,7 @@ use rand::{ Rng, }; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::fmt; use std::mem; @@ -46,7 +46,7 @@ impl PartialEq for Perspective3 { } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl Serialize for Perspective3 { fn serialize(&self, serializer: S) -> Result where @@ -56,7 +56,7 @@ impl Serialize for Perspective3 { } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl<'a, T: RealField + Deserialize<'a>> Deserialize<'a> for Perspective3 { fn deserialize(deserializer: Des) -> Result where diff --git a/src/geometry/point.rs b/src/geometry/point.rs index 33725250..60fa9156 100644 --- a/src/geometry/point.rs +++ b/src/geometry/point.rs @@ -6,7 +6,7 @@ use std::hash; #[cfg(feature = "abomonation-serialize")] use std::io::{Result as IOResult, Write}; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Deserializer, Serialize, Serializer}; #[cfg(feature = "abomonation-serialize")] @@ -67,7 +67,7 @@ where { } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl Serialize for Point { fn serialize(&self, serializer: S) -> Result where @@ -77,7 +77,7 @@ impl Serialize for Point { } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl<'a, T: Scalar + Deserialize<'a>, const D: usize> Deserialize<'a> for Point { fn deserialize(deserializer: Des) -> Result where diff --git a/src/geometry/quaternion.rs b/src/geometry/quaternion.rs index 6d45057f..365095b8 100755 --- a/src/geometry/quaternion.rs +++ b/src/geometry/quaternion.rs @@ -5,9 +5,9 @@ use std::hash::{Hash, Hasher}; #[cfg(feature = "abomonation-serialize")] use std::io::{Result as IOResult, Write}; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use crate::base::storage::Owned; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Deserializer, Serialize, Serializer}; #[cfg(feature = "abomonation-serialize")] @@ -85,7 +85,7 @@ where } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl Serialize for Quaternion where Owned: Serialize, @@ -98,7 +98,7 @@ where } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl<'a, T: Scalar> Deserialize<'a> for Quaternion where Owned: Deserialize<'a>, diff --git a/src/geometry/rotation.rs b/src/geometry/rotation.rs index 74843b21..7b4d609a 100755 --- a/src/geometry/rotation.rs +++ b/src/geometry/rotation.rs @@ -5,10 +5,10 @@ use std::hash; #[cfg(feature = "abomonation-serialize")] use std::io::{Result as IOResult, Write}; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Deserializer, Serialize, Serializer}; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use crate::base::storage::Owned; #[cfg(feature = "abomonation-serialize")] @@ -102,7 +102,7 @@ where } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl Serialize for Rotation where Owned, Const>: Serialize, @@ -115,7 +115,7 @@ where } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl<'a, T: Scalar, const D: usize> Deserialize<'a> for Rotation where Owned, Const>: Deserialize<'a>, diff --git a/src/geometry/similarity.rs b/src/geometry/similarity.rs index c11de6aa..b6e2c379 100755 --- a/src/geometry/similarity.rs +++ b/src/geometry/similarity.rs @@ -6,7 +6,7 @@ use std::hash; #[cfg(feature = "abomonation-serialize")] use std::io::{Result as IOResult, Write}; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Serialize}; #[cfg(feature = "abomonation-serialize")] @@ -24,16 +24,16 @@ use crate::geometry::{AbstractRotation, Isometry, Point, Translation}; /// A similarity, i.e., an uniform scaling, followed by a rotation, followed by a translation. #[repr(C)] #[derive(Debug)] -#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(serialize = "T: Serialize, R: Serialize, DefaultAllocator: Allocator>, Owned>: Serialize")) )] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(deserialize = "T: Deserialize<'de>, R: Deserialize<'de>, DefaultAllocator: Allocator>, diff --git a/src/geometry/transform.rs b/src/geometry/transform.rs index cbc855ea..c7fce902 100755 --- a/src/geometry/transform.rs +++ b/src/geometry/transform.rs @@ -3,7 +3,7 @@ use std::any::Any; use std::fmt::Debug; use std::marker::PhantomData; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Deserializer, Serialize, Serializer}; use simba::scalar::RealField; @@ -194,7 +194,7 @@ where } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl Serialize for Transform where Const: DimNameAdd, @@ -209,7 +209,7 @@ where } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl<'a, T: RealField, C: TCategory, const D: usize> Deserialize<'a> for Transform where Const: DimNameAdd, diff --git a/src/geometry/translation.rs b/src/geometry/translation.rs index 5a4fe357..1a8f4b04 100755 --- a/src/geometry/translation.rs +++ b/src/geometry/translation.rs @@ -5,7 +5,7 @@ use std::hash; #[cfg(feature = "abomonation-serialize")] use std::io::{Result as IOResult, Write}; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Deserializer, Serialize, Serializer}; #[cfg(feature = "abomonation-serialize")] @@ -69,7 +69,7 @@ where } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl Serialize for Translation where Owned>: Serialize, @@ -82,7 +82,7 @@ where } } -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] impl<'a, T: Scalar, const D: usize> Deserialize<'a> for Translation where Owned>: Deserialize<'a>, diff --git a/src/geometry/unit_complex_construction.rs b/src/geometry/unit_complex_construction.rs index 29ed7a01..62a9b416 100644 --- a/src/geometry/unit_complex_construction.rs +++ b/src/geometry/unit_complex_construction.rs @@ -397,7 +397,7 @@ where } } -#[cfg(feature = "rand-no-std")] +#[cfg(feature = "rand")] impl Distribution> for Standard where T::Element: SimdRealField, diff --git a/src/lib.rs b/src/lib.rs index 9d711680..bc6d1718 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -89,13 +89,13 @@ an optimized set of tools for computer graphics and physics. Those features incl #![cfg_attr(all(feature = "alloc", not(feature = "std")), feature(alloc))] #![cfg_attr(feature = "no_unsound_assume_init", allow(unreachable_code))] -#[cfg(feature = "serde-serialize")] -#[macro_use] -extern crate serde; - #[cfg(feature = "rand-no-std")] extern crate rand_package as rand; +#[cfg(feature = "serde-serialize-no-std")] +#[macro_use] +extern crate serde; + #[macro_use] extern crate approx; extern crate num_traits as num; diff --git a/src/linalg/bidiagonal.rs b/src/linalg/bidiagonal.rs index c7c36702..a125ce18 100644 --- a/src/linalg/bidiagonal.rs +++ b/src/linalg/bidiagonal.rs @@ -1,4 +1,4 @@ -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Serialize}; use crate::allocator::Allocator; @@ -11,9 +11,9 @@ use crate::geometry::Reflection; use crate::linalg::householder; /// The bidiagonalization of a general matrix. -#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(serialize = "DimMinimum: DimSub, DefaultAllocator: Allocator + Allocator> + @@ -23,7 +23,7 @@ use crate::linalg::householder; OVector, U1>>: Serialize")) )] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(deserialize = "DimMinimum: DimSub, DefaultAllocator: Allocator + Allocator> + diff --git a/src/linalg/cholesky.rs b/src/linalg/cholesky.rs index 36e164ea..24a6bcf5 100644 --- a/src/linalg/cholesky.rs +++ b/src/linalg/cholesky.rs @@ -1,4 +1,4 @@ -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Serialize}; use num::One; @@ -12,14 +12,14 @@ use crate::dimension::{Dim, DimAdd, DimDiff, DimSub, DimSum, U1}; use crate::storage::{Storage, StorageMut}; /// The Cholesky decomposition of a symmetric-definite-positive matrix. -#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(serialize = "DefaultAllocator: Allocator, OMatrix: Serialize")) )] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(deserialize = "DefaultAllocator: Allocator, OMatrix: Deserialize<'de>")) )] diff --git a/src/linalg/col_piv_qr.rs b/src/linalg/col_piv_qr.rs index 5c776b2d..10997b43 100644 --- a/src/linalg/col_piv_qr.rs +++ b/src/linalg/col_piv_qr.rs @@ -1,5 +1,5 @@ use num::Zero; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Serialize}; use crate::allocator::{Allocator, Reallocator}; @@ -13,9 +13,9 @@ use crate::geometry::Reflection; use crate::linalg::{householder, PermutationSequence}; /// The QR decomposition (with column pivoting) of a general matrix. -#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(serialize = "DefaultAllocator: Allocator + Allocator>, OMatrix: Serialize, @@ -23,7 +23,7 @@ use crate::linalg::{householder, PermutationSequence}; OVector>: Serialize")) )] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(deserialize = "DefaultAllocator: Allocator + Allocator>, OMatrix: Deserialize<'de>, diff --git a/src/linalg/eigen.rs b/src/linalg/eigen.rs index 12d83a02..37b5ddea 100644 --- a/src/linalg/eigen.rs +++ b/src/linalg/eigen.rs @@ -1,4 +1,4 @@ -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Serialize}; use num_complex::Complex; @@ -20,15 +20,15 @@ use crate::linalg::householder; use crate::linalg::Schur; /// Eigendecomposition of a real matrix with real eigenvalues (or complex eigen values for complex matrices). -#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(serialize = "DefaultAllocator: Allocator, OVector: Serialize, OMatrix: Serialize")) )] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(deserialize = "DefaultAllocator: Allocator, OVector: Serialize, OMatrix: Deserialize<'de>")) diff --git a/src/linalg/full_piv_lu.rs b/src/linalg/full_piv_lu.rs index ae14f827..1555913b 100644 --- a/src/linalg/full_piv_lu.rs +++ b/src/linalg/full_piv_lu.rs @@ -1,4 +1,4 @@ -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Serialize}; use crate::allocator::Allocator; @@ -12,16 +12,16 @@ use crate::linalg::lu; use crate::linalg::PermutationSequence; /// LU decomposition with full row and column pivoting. -#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(serialize = "DefaultAllocator: Allocator + Allocator<(usize, usize), DimMinimum>, OMatrix: Serialize, PermutationSequence>: Serialize")) )] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(deserialize = "DefaultAllocator: Allocator + Allocator<(usize, usize), DimMinimum>, OMatrix: Deserialize<'de>, diff --git a/src/linalg/hessenberg.rs b/src/linalg/hessenberg.rs index 09a7d180..be6f667c 100644 --- a/src/linalg/hessenberg.rs +++ b/src/linalg/hessenberg.rs @@ -1,4 +1,4 @@ -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Serialize}; use crate::allocator::Allocator; @@ -10,16 +10,16 @@ use simba::scalar::ComplexField; use crate::linalg::householder; /// Hessenberg decomposition of a general matrix. -#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(serialize = "DefaultAllocator: Allocator + Allocator>, OMatrix: Serialize, OVector>: Serialize")) )] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(deserialize = "DefaultAllocator: Allocator + Allocator>, OMatrix: Deserialize<'de>, diff --git a/src/linalg/lu.rs b/src/linalg/lu.rs index c09a5b77..fce3f3cb 100644 --- a/src/linalg/lu.rs +++ b/src/linalg/lu.rs @@ -1,4 +1,4 @@ -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Serialize}; use crate::allocator::{Allocator, Reallocator}; @@ -12,16 +12,16 @@ use std::mem; use crate::linalg::PermutationSequence; /// LU decomposition with partial (row) pivoting. -#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(serialize = "DefaultAllocator: Allocator + Allocator<(usize, usize), DimMinimum>, OMatrix: Serialize, PermutationSequence>: Serialize")) )] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(deserialize = "DefaultAllocator: Allocator + Allocator<(usize, usize), DimMinimum>, OMatrix: Deserialize<'de>, diff --git a/src/linalg/permutation_sequence.rs b/src/linalg/permutation_sequence.rs index 09aa4f90..4cc8cb25 100644 --- a/src/linalg/permutation_sequence.rs +++ b/src/linalg/permutation_sequence.rs @@ -1,4 +1,4 @@ -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Serialize}; use num::One; @@ -12,14 +12,14 @@ use crate::dimension::{Const, Dim, DimName}; use crate::storage::StorageMut; /// A sequence of row or column permutations. -#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(serialize = "DefaultAllocator: Allocator<(usize, usize), D>, OVector<(usize, usize), D>: Serialize")) )] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(deserialize = "DefaultAllocator: Allocator<(usize, usize), D>, OVector<(usize, usize), D>: Deserialize<'de>")) )] diff --git a/src/linalg/qr.rs b/src/linalg/qr.rs index a09842d0..6d5274e4 100644 --- a/src/linalg/qr.rs +++ b/src/linalg/qr.rs @@ -1,5 +1,5 @@ use num::Zero; -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Serialize}; use crate::allocator::{Allocator, Reallocator}; @@ -13,16 +13,16 @@ use crate::geometry::Reflection; use crate::linalg::householder; /// The QR decomposition of a general matrix. -#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(serialize = "DefaultAllocator: Allocator + Allocator>, OMatrix: Serialize, OVector>: Serialize")) )] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(deserialize = "DefaultAllocator: Allocator + Allocator>, OMatrix: Deserialize<'de>, diff --git a/src/linalg/schur.rs b/src/linalg/schur.rs index 1726ffc9..1903b717 100644 --- a/src/linalg/schur.rs +++ b/src/linalg/schur.rs @@ -1,4 +1,4 @@ -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Serialize}; use approx::AbsDiffEq; @@ -19,14 +19,14 @@ use crate::linalg::Hessenberg; /// Schur decomposition of a square matrix. /// /// If this is a real matrix, this will be a RealField Schur decomposition. -#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(serialize = "DefaultAllocator: Allocator, OMatrix: Serialize")) )] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(deserialize = "DefaultAllocator: Allocator, OMatrix: Deserialize<'de>")) )] diff --git a/src/linalg/svd.rs b/src/linalg/svd.rs index b259ae95..2f5e6a63 100644 --- a/src/linalg/svd.rs +++ b/src/linalg/svd.rs @@ -1,4 +1,4 @@ -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Serialize}; use approx::AbsDiffEq; @@ -16,9 +16,9 @@ use crate::linalg::symmetric_eigen; use crate::linalg::Bidiagonal; /// Singular Value Decomposition of a general matrix. -#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound( serialize = "DefaultAllocator: Allocator> + Allocator, C> + @@ -29,7 +29,7 @@ use crate::linalg::Bidiagonal; )) )] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound( deserialize = "DefaultAllocator: Allocator> + Allocator, C> + diff --git a/src/linalg/symmetric_eigen.rs b/src/linalg/symmetric_eigen.rs index 370df26e..6e3b67fe 100644 --- a/src/linalg/symmetric_eigen.rs +++ b/src/linalg/symmetric_eigen.rs @@ -1,4 +1,4 @@ -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Serialize}; use approx::AbsDiffEq; @@ -14,16 +14,16 @@ use crate::linalg::givens::GivensRotation; use crate::linalg::SymmetricTridiagonal; /// Eigendecomposition of a symmetric matrix. -#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(serialize = "DefaultAllocator: Allocator + Allocator, OVector: Serialize, OMatrix: Serialize")) )] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(deserialize = "DefaultAllocator: Allocator + Allocator, OVector: Deserialize<'de>, diff --git a/src/linalg/symmetric_tridiagonal.rs b/src/linalg/symmetric_tridiagonal.rs index 4e70b59b..9937f76b 100644 --- a/src/linalg/symmetric_tridiagonal.rs +++ b/src/linalg/symmetric_tridiagonal.rs @@ -1,4 +1,4 @@ -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Serialize}; use crate::allocator::Allocator; @@ -10,16 +10,16 @@ use simba::scalar::ComplexField; use crate::linalg::householder; /// Tridiagonalization of a symmetric matrix. -#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(serialize = "DefaultAllocator: Allocator + Allocator>, OMatrix: Serialize, OVector>: Serialize")) )] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(deserialize = "DefaultAllocator: Allocator + Allocator>, OMatrix: Deserialize<'de>, diff --git a/src/linalg/udu.rs b/src/linalg/udu.rs index de3cd2e3..4d3aca6c 100644 --- a/src/linalg/udu.rs +++ b/src/linalg/udu.rs @@ -1,4 +1,4 @@ -#[cfg(feature = "serde-serialize")] +#[cfg(feature = "serde-serialize-no-std")] use serde::{Deserialize, Serialize}; use crate::allocator::Allocator; @@ -8,13 +8,13 @@ use crate::storage::Storage; use simba::scalar::RealField; /// UDU factorization. -#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound(serialize = "OVector: Serialize, OMatrix: Serialize")) )] #[cfg_attr( - feature = "serde-serialize", + feature = "serde-serialize-no-std", serde(bound( deserialize = "OVector: Deserialize<'de>, OMatrix: Deserialize<'de>" ))