From 9819e9e08b6f0642dd3590b50db3f0632ecfb1d3 Mon Sep 17 00:00:00 2001 From: poma Date: Sun, 24 Mar 2019 07:47:47 +0300 Subject: [PATCH] Merge singlecore and multicore configs --- Cargo.toml | 1 + src/lib.rs | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b97cbf9..9d6f61c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ crate-type = ["cdylib", "lib", "staticlib"] rand = "0.4" bit-vec = "0.4.4" futures = "0.1" +cfg-if = "0.1.7" pairing = { git = 'https://github.com/matterinc/pairing', tag = "0.16.2" } #pairing = { path = "../pairing" } diff --git a/src/lib.rs b/src/lib.rs index 690219a..23ca127 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,7 @@ #![allow(unused_imports)] +#[macro_use] +extern crate cfg_if; extern crate pairing as pairing_import; extern crate rand; extern crate bit_vec; @@ -20,18 +22,18 @@ mod multiexp; #[cfg(test)] mod tests; -#[cfg(feature = "multicore")] -mod multicore; - -#[cfg(feature = "singlecore")] -mod singlecore; - -mod worker { - #[cfg(feature = "multicore")] - pub use crate::multicore::*; - - #[cfg(feature = "singlecore")] - pub use crate::singlecore::*; +cfg_if! { + if #[cfg(feature = "multicore")] { + mod multicore; + mod worker { + pub use crate::multicore::*; + } + } else { + mod singlecore; + mod worker { + pub use crate::singlecore::*; + } + } } pub mod pairing {