فهرست منبع

Serializers dependencies

Łukasz Jan Niemier 9 سال پیش
والد
کامیت
58b5fe5883
8فایلهای تغییر یافته به همراه47 افزوده شده و 30 حذف شده
  1. 12 13
      Cargo.toml
  2. 6 2
      bigint/Cargo.toml
  3. 2 0
      bigint/src/lib.rs
  4. 13 1
      complex/Cargo.toml
  5. 6 0
      complex/src/lib.rs
  6. 6 2
      rational/Cargo.toml
  7. 2 0
      rational/src/lib.rs
  8. 0 12
      src/lib.rs

+ 12 - 13
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"
+]

+ 6 - 2
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"]

+ 2 - 0
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;
 

+ 13 - 1
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 = []

+ 6 - 0
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;

+ 6 - 2
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"]

+ 2 - 0
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")]

+ 0 - 12
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")]