From 58b5fe58833ba9e97ec69241bec4ee4473bf7a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Jan=20Niemier?= Date: Mon, 11 Apr 2016 20:43:07 +0200 Subject: [PATCH] Serializers dependencies --- Cargo.toml | 25 ++++++++++++------------- bigint/Cargo.toml | 8 ++++++-- bigint/src/lib.rs | 2 ++ complex/Cargo.toml | 14 +++++++++++++- complex/src/lib.rs | 6 ++++++ rational/Cargo.toml | 8 ++++++-- rational/src/lib.rs | 2 ++ src/lib.rs | 12 ------------ 8 files changed, 47 insertions(+), 30 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e35c26c..fdb939a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,18 +40,6 @@ path = "rational" [dependencies.num-traits] path = "./traits" -[dependencies.rand] -optional = true -version = "0.3.8" - -[dependencies.rustc-serialize] -optional = true -version = "0.3.13" - -[dependencies.serde] -optional = true -version = "^0.7.0" - [dev-dependencies] [dev-dependencies.rand] @@ -61,4 +49,15 @@ version = "0.3.8" bigint = ["num-bigint"] complex = ["num-complex"] rational = ["num-rational"] -default = ["bigint", "complex", "rand", "rational", "rustc-serialize"] +default = ["bigint", "complex", "rational", "rustc-serialize"] + +serde = [ + "num-bigint/serde", + "num-complex/serde", + "num-rational/serde" +] +rustc-serialize = [ + "num-bigint/rustc-serialize", + "num-complex/rustc-serialize", + "num-rational/rustc-serialize" +] diff --git a/bigint/Cargo.toml b/bigint/Cargo.toml index 56666af..2d2dda0 100644 --- a/bigint/Cargo.toml +++ b/bigint/Cargo.toml @@ -5,8 +5,8 @@ documentation = "http://rust-num.github.io/num" homepage = "https://github.com/rust-num/num" keywords = ["mathematics", "numerics"] license = "MIT/Apache-2.0" -repository = "https://github.com/rust-num/num" name = "num-bigint" +repository = "https://github.com/rust-num/num" version = "0.1.0" [dependencies] @@ -21,9 +21,13 @@ path = "../traits" optional = true version = "0.3.14" +[dependencies.rustc-serialize] +optional = true +version = "0.3.19" + [dependencies.serde] optional = true version = "0.7.0" [features] -default = ["rand"] +default = ["rand", "rustc-serialize"] diff --git a/bigint/src/lib.rs b/bigint/src/lib.rs index 74d7576..effb3ab 100644 --- a/bigint/src/lib.rs +++ b/bigint/src/lib.rs @@ -72,6 +72,8 @@ #[cfg(any(feature = "rand", test))] extern crate rand; +#[cfg(feature = "rustc-serialize")] +extern crate rustc_serialize; #[cfg(feature = "serde")] extern crate serde; diff --git a/complex/Cargo.toml b/complex/Cargo.toml index 3b1f640..854128e 100644 --- a/complex/Cargo.toml +++ b/complex/Cargo.toml @@ -5,8 +5,8 @@ documentation = "http://rust-num.github.io/num" homepage = "https://github.com/rust-num/num" keywords = ["mathematics", "numerics"] license = "MIT/Apache-2.0" -repository = "https://github.com/rust-num/num" name = "num-complex" +repository = "https://github.com/rust-num/num" version = "0.1.0" [dependencies] @@ -14,3 +14,15 @@ version = "0.1.0" [dependencies.num-traits] optional = false path = "../traits" + +[dependencies.rustc-serialize] +optional = true +version = "0.3.19" + +[dependencies.serde] +optional = true +version = "^0.7.0" + +[features] +default = ["rustc-serialize"] +unstable = [] diff --git a/complex/src/lib.rs b/complex/src/lib.rs index b1a0603..333e552 100644 --- a/complex/src/lib.rs +++ b/complex/src/lib.rs @@ -12,6 +12,12 @@ extern crate num_traits as traits; +#[cfg(feature = "rustc-serialize")] +extern crate rustc_serialize; + +#[cfg(feature = "serde")] +extern crate serde; + use std::fmt; #[cfg(test)] use std::hash; diff --git a/rational/Cargo.toml b/rational/Cargo.toml index 9ef95ae..1fa46e3 100644 --- a/rational/Cargo.toml +++ b/rational/Cargo.toml @@ -5,8 +5,8 @@ documentation = "http://rust-num.github.io/num" homepage = "https://github.com/rust-num/num" keywords = ["mathematics", "numerics"] license = "MIT/Apache-2.0" -repository = "https://github.com/rust-num/num" name = "num-rational" +repository = "https://github.com/rust-num/num" version = "0.1.0" [dependencies] @@ -21,10 +21,14 @@ path = "../integer" [dependencies.num-traits] path = "../traits" +[dependencies.rustc-serialize] +optional = true +version = "0.3.19" + [dependencies.serde] optional = true version = "0.7.0" [features] -default = ["bigint"] +default = ["bigint", "rustc-serialize"] bigint = ["num-bigint"] diff --git a/rational/src/lib.rs b/rational/src/lib.rs index 529ff74..f6e2cbd 100644 --- a/rational/src/lib.rs +++ b/rational/src/lib.rs @@ -10,6 +10,8 @@ //! Rational numbers +#[cfg(feature = "rustc-serialize")] +extern crate rustc_serialize; #[cfg(feature = "serde")] extern crate serde; #[cfg(feature = "num-bigint")] diff --git a/src/lib.rs b/src/lib.rs index b928e43..97d0fc1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -67,18 +67,6 @@ pub extern crate num_bigint; #[cfg(feature = "num-rational")] pub extern crate num_rational; -#[cfg(feature = "rustc-serialize")] -extern crate rustc_serialize; - -// Some of the tests of non-RNG-based functionality are randomized using the -// RNG-based functionality, so the RNG-based functionality needs to be enabled -// for tests. -#[cfg(any(feature = "rand", all(feature = "bigint", test)))] -extern crate rand; - -#[cfg(feature = "serde")] -extern crate serde; - #[cfg(feature = "num-bigint")] pub use num_bigint::{BigInt, BigUint}; #[cfg(feature = "num-rational")]