Rename all optional features

- rand-support => rand
- byteorder-support => byteorder
- heapsize-support => heapsize
- quickcheck-support => quickcheck
This commit is contained in:
Herobird 2018-11-05 12:18:39 +01:00
parent 1f94d2747d
commit 6e0453af09
5 changed files with 26 additions and 32 deletions

View File

@ -24,13 +24,7 @@ static_assertions = "0.2"
libc = { version = "0.2", optional = true, default-features = false }
[features]
default = ["std", "libc", "rand-support", "rustc-hex-support", "byteorder-support"]
default = ["std", "libc", "rand", "rustc-hex", "byteorder"]
std = ["rustc-hex/std", "rand/std", "byteorder/std"]
rustc-hex-support = ["rustc-hex"]
rand-support = ["rand"]
byteorder-support = ["byteorder"]
heapsize-support = ["heapsize"]
quickcheck-support = ["quickcheck"]
api-dummy = [] # Feature used by docs.rs to display documentation of hash types

View File

@ -59,13 +59,13 @@ fixed-hash = { version = "0.3", default-features = false }
- Enabled by default.
- `libc`: Use `libc` for implementations of `PartialEq` and `Ord`.
- Enabled by default.
- `rand-support`: Provide API based on the `rand` crate.
- `rand`: Provide API based on the `rand` crate.
- Enabled by default.
- `byteorder-support`: Provide API based on the `byteorder` crate.
- `byteorder`: Provide API based on the `byteorder` crate.
- Enabled by default.
- `heapsize-support`: Provide `HeapsizeOf` implementation for hash types.
- `heapsize`: Provide `HeapsizeOf` implementation for hash types.
- Disabled by default.
- `quickcheck-support`: Provide `quickcheck` implementation for hash types.
- `quickcheck`: Provide `quickcheck` implementation for hash types.
- Disabled by default.
- `api-dummy`: Generate a dummy hash type for API documentation.
- Enabled by default at `docs.rs`

View File

@ -295,7 +295,7 @@ macro_rules! construct_fixed_hash {
// Feature guarded macro definitions instead of feature guarded impl blocks
// to work around the problems of introducing `byteorder` crate feature in
// a user crate.
#[cfg(not(feature = "byteorder-support"))]
#[cfg(not(feature = "byteorder"))]
#[macro_export]
#[doc(hidden)]
macro_rules! impl_byteorder_for_fixed_hash {
@ -309,7 +309,7 @@ macro_rules! impl_byteorder_for_fixed_hash {
// Feature guarded macro definitions instead of feature guarded impl blocks
// to work around the problems of introducing `byteorder` crate feature in
// a user crate.
#[cfg(feature = "byteorder-support")]
#[cfg(feature = "byteorder")]
#[macro_export]
#[doc(hidden)]
macro_rules! impl_byteorder_for_fixed_hash {
@ -428,7 +428,7 @@ macro_rules! impl_byteorder_for_fixed_hash {
// Feature guarded macro definitions instead of feature guarded impl blocks
// to work around the problems of introducing `rand` crate feature in
// a user crate.
#[cfg(not(feature = "rand-support"))]
#[cfg(not(feature = "rand"))]
#[macro_export]
#[doc(hidden)]
macro_rules! impl_rand_for_fixed_hash {
@ -442,7 +442,7 @@ macro_rules! impl_rand_for_fixed_hash {
// Feature guarded macro definitions instead of feature guarded impl blocks
// to work around the problems of introducing `rand` crate feature in
// a user crate.
#[cfg(feature = "rand-support")]
#[cfg(feature = "rand")]
#[macro_export]
#[doc(hidden)]
macro_rules! impl_rand_for_fixed_hash {
@ -579,7 +579,7 @@ macro_rules! impl_libc_for_fixed_hash {
// Feature guarded macro definitions instead of feature guarded impl blocks
// to work around the problems of introducing `rustc-hex` crate feature in
// a user crate.
#[cfg(not(feature = "rustc-hex-support"))]
#[cfg(not(feature = "rustc-hex"))]
#[macro_export]
#[doc(hidden)]
macro_rules! impl_rustc_hex_for_fixed_hash {
@ -593,7 +593,7 @@ macro_rules! impl_rustc_hex_for_fixed_hash {
// Feature guarded macro definitions instead of feature guarded impl blocks
// to work around the problems of introducing `rustc-hex` crate feature in
// a user crate.
#[cfg(feature = "rustc-hex-support")]
#[cfg(feature = "rustc-hex")]
#[macro_export]
#[doc(hidden)]
macro_rules! impl_rustc_hex_for_fixed_hash {
@ -633,7 +633,7 @@ macro_rules! impl_rustc_hex_for_fixed_hash {
// to work around the problems of introducing `heapsize` crate feature in
// a user crate.
#[cfg(not(
all(feature = "heapsize-support", not(target_os = "unknown"))
all(feature = "heapsize", not(target_os = "unknown"))
))]
#[macro_export]
#[doc(hidden)]
@ -649,7 +649,7 @@ macro_rules! impl_heapsize_for_fixed_hash {
// to work around the problems of introducing `heapsize` crate feature in
// a user crate.
#[cfg(
all(feature = "heapsize-support", not(target_os = "unknown"))
all(feature = "heapsize", not(target_os = "unknown"))
)]
#[macro_export]
#[doc(hidden)]
@ -671,7 +671,7 @@ macro_rules! impl_heapsize_for_fixed_hash {
// Feature guarded macro definitions instead of feature guarded impl blocks
// to work around the problems of introducing `quickcheck` crate feature in
// a user crate.
#[cfg(not(feature = "quickcheck-support"))]
#[cfg(not(feature = "quickcheck"))]
#[macro_export]
#[doc(hidden)]
macro_rules! impl_quickcheck_for_fixed_hash {
@ -685,7 +685,7 @@ macro_rules! impl_quickcheck_for_fixed_hash {
// Feature guarded macro definitions instead of feature guarded impl blocks
// to work around the problems of introducing `quickcheck` crate feature in
// a user crate.
#[cfg(feature = "quickcheck-support")]
#[cfg(feature = "quickcheck")]
#[macro_export]
#[doc(hidden)]
macro_rules! impl_quickcheck_for_fixed_hash {

View File

@ -26,7 +26,7 @@ pub extern crate static_assertions;
#[doc(hidden)]
pub use static_assertions::const_assert;
#[cfg(feature = "byteorder-support")]
#[cfg(feature = "byteorder")]
#[doc(hidden)]
pub extern crate byteorder;
@ -34,19 +34,19 @@ pub extern crate byteorder;
#[doc(hidden)]
pub mod libc {}
#[cfg(feature = "heapsize-support")]
#[cfg(feature = "heapsize")]
#[doc(hidden)]
pub extern crate heapsize;
#[cfg(feature = "rustc-hex-support")]
#[cfg(feature = "rustc-hex")]
#[doc(hidden)]
pub extern crate rustc_hex;
#[cfg(feature = "rand-support")]
#[cfg(feature = "rand")]
#[doc(hidden)]
pub extern crate rand;
#[cfg(feature = "quickcheck-support")]
#[cfg(feature = "quickcheck")]
#[doc(hidden)]
pub extern crate quickcheck;

View File

@ -147,7 +147,7 @@ mod is_zero {
}
}
#[cfg(feature = "byteorder-support")]
#[cfg(feature = "byteorder")]
mod to_low_u64 {
use super::*;
@ -199,7 +199,7 @@ mod to_low_u64 {
}
}
#[cfg(feature = "byteorder-support")]
#[cfg(feature = "byteorder")]
mod from_low_u64 {
use super::*;
@ -247,7 +247,7 @@ mod from_low_u64 {
}
}
#[cfg(feature = "rand-support")]
#[cfg(feature = "rand")]
mod rand {
use super::*;
use rand::{SeedableRng, XorShiftRng};
@ -277,7 +277,7 @@ mod rand {
}
}
#[cfg(feature = "rustc-hex-support")]
#[cfg(feature = "rustc-hex")]
mod from_str {
use super::*;
@ -311,7 +311,7 @@ mod from_str {
}
#[cfg(all(
feature = "heapsize-support",
feature = "heapsize",
not(target_os = "unknown")
))]
#[test]
@ -368,7 +368,7 @@ fn from_h256_to_h160_lossy() {
assert_eq!(h160, expected);
}
#[cfg(all(feature = "std", feature = "byteorder-support"))]
#[cfg(all(feature = "std", feature = "byteorder"))]
#[test]
fn display_and_debug() {
fn test_for(x: u64, hex: &'static str, display: &'static str) {